- 220
- Posts
- 10
- Years
- Portugal
- Seen Apr 15, 2024
Lavender Town Ghosts
![[PokeCommunity.com] Lavender Town Ghosts For PE V17.2 [PokeCommunity.com] Lavender Town Ghosts For PE V17.2](https://i46.servimg.com/u/f46/19/96/78/09/lavend10.png)
This is an old essentials recource that existed before the shut down of essentials wiki/forum.
The purpose of this script is to recreate the Ghosts that are inside the Pokemon Tower in Lavender Town from Fire Red game. Before you have the Silph Scope, you can't see the true identity of the ghosts, but if you have it, it will unmask them.
This is for Pokemon Essentials v17.2. This script was tested by me.
So, let's do this!
First the key item that you'll need:
1- In the PBS folder, open "items" then add the key item:
718,SILPHSCOPE,SILPH SCOPE,SILPH SCOPE,8,0,"A scope that makes unseeable POKéMON visible. It is made by Silph Co.",0,0,6,
Note: Change the ID number for yours, plural name and description if you like.
2- Put the required graphics for the key item in: Graphics/Icons folder:
![[PokeCommunity.com] Lavender Town Ghosts For PE V17.2 [PokeCommunity.com] Lavender Town Ghosts For PE V17.2](https://i46.servimg.com/u/f46/19/96/78/09/item7110.png)
Note: Change the ID number of the item for yours. And that's it for the item. You can change the item for whatever item you want, but if you do that, you must rename it in the script too.
Second the script:
Add "LavenderGhostBattle" Script in a new section ABOVE MAIN:
Spoiler:
Code:
def pbLoadGhostBitmap
bitmapFileName="Graphics/Battlers/Ghost.png"
return AnimatedBitmap.new(bitmapFileName)
end
class PokemonBattlerSprite < RPG::Sprite
def setGhostBitmap
@_iconbitmap.dispose if @_iconbitmap
@_iconbitmap=pbLoadGhostBitmap()
self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
self.color=Color.new(0,0,0,0)
end
end
class PokeBattle_Pokemon
def setGhostNoGender
@genderflag=2
end
end
GHOSTMAPS=[50,51,52,53,54]
def isGhostEncountersActive?
onGhostMap=false
for i in 0...GHOSTMAPS.length
if $game_map.map_id==GHOSTMAPS[i]
onGhostMap=true
break
end
end
return onGhostMap && !$PokemonBag.pbHasItem?(:SILPHSCOPE)
end
In the line:
Code:
GHOSTMAPS=[50,51,52,53,54]
You must change the maps ID into yours. And where it says SILPHSCOPE, you can rename there the item for your liking.
In "PokeBattle_Scene" where is :
Code:
def pbStartBattle(battle)
# Called whenever the battle begins
Replace this for the RED LINES:
Code:
@sprites["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
Spoiler:
Code:
trainersprite1=@sprites["trainer"]
trainersprite2=@sprites["trainer2"]
if [email protected]
@sprites["trainer"].visible=false
if @battle.party2.length>=1
if @battle.party2.length==1
[email protected][0].species
[COLOR="Red"]if isGhostEncountersActive?
[email protected][0]
@sprites["pokemon1"].setGhostBitmap()
else
@sprites["pokemon1"].setPokemonBitmap(@battle.party2[0],false)
end[/COLOR]
@sprites["pokemon1"].tone=Tone.new(-128,-128,-128,-128)
@sprites["pokemon1"].x=PokeBattle_SceneConstants::FOEBATTLER_X
@sprites["pokemon1"].x-=@sprites["pokemon1"].width/2
@sprites["pokemon1"].y=PokeBattle_SceneConstants::FOEBATTLER_Y
@sprites["pokemon1"].y+=adjustBattleSpriteY(@sprites["pokemon1"],species,1)
@sprites["pokemon1"].visible=true
@sprites["shadow1"].x=PokeBattle_SceneConstants::FOEBATTLER_X
@sprites["shadow1"].y=PokeBattle_SceneConstants::FOEBATTLER_Y
@sprites["shadow1"].x-=@sprites["shadow1"].bitmap.width/2 if @sprites["shadow1"].bitmap!=nil
@sprites["shadow1"].y-=@sprites["shadow1"].bitmap.height/2 if @sprites["shadow1"].bitmap!=nil
@sprites["shadow1"].visible=showShadow?(species)
trainersprite1=@sprites["pokemon1"]
elsif @battle.party2.length==2
In "PokeBattle_AI" add the RED LINES:
Spoiler:
Code:
################################################################################
# Choose a move to use.
################################################################################
def pbChooseMoves(index)
attacker=@battlers[index]
scores=[0,0,0,0]
targets=nil
myChoices=[]
totalscore=0
target=-1
skill=0
wildbattle=!@opponent && pbIsOpposing?(index)
if wildbattle # If wild battle
[COLOR="Red"] if isGhostEncountersActive?
pbDisplay(_INTL("Ghost: Get out... Get out..."))
return
end[/COLOR]
for i in 0...4
if pbCanChooseMove?(index,i,false)
scores[i]=100
myChoices.push(i)
totalscore+=100
end
end
In "PokeBattle_Battle" right under:
Code:
def pbThrowPokeBall(idxPokemon,ball,rareness=nil,showplayer=false)
Add the RED LINES:
Spoiler:
Code:
def pbThrowPokeBall(idxPokemon,ball,rareness=nil,showplayer=false)
[COLOR="Red"] if isGhostEncountersActive? || $game_switches[333]
pbDisplay(_INTL("It dodged the thrown Ball! This POKéMON can't be caught!"))
return
end[/COLOR]
itemname=PBItems.getName(ball)
battler=nil
if pbIsOpposing?(idxPokemon)
battler=self.battlers[idxPokemon]
else
battler=self.battlers[idxPokemon].pbOppositeOpposing
end
if battler.fainted?
battler=battler.pbPartner
end
In the line:
Code:
if isGhostEncountersActive? || $game_switches[333]
You must renumber the switch into yours.
In the same script add the RED LINES:
Spoiler:
Code:
def pbRun(idxPokemon,duringBattle=false)
thispkmn=@battlers[idxPokemon]
if pbIsOpposing?(idxPokemon)
return 0 if @opponent
@choices[i][0]=5 # run
@choices[i][1]=0
@choices[i][2]=nil
return -1
end
if @opponent
if $DEBUG && Input.press?(Input::CTRL)
if pbDisplayConfirm(_INTL("Treat this battle as a win?"))
@decision=1
return 1
elsif pbDisplayConfirm(_INTL("Treat this battle as a loss?"))
@decision=2
return 1
end
elsif @internalbattle
pbDisplayPaused(_INTL("No! There's no running from a Trainer battle!"))
elsif pbDisplayConfirm(_INTL("Would you like to forfeit the match and quit now?"))
pbSEPlay("Battle flee")
pbDisplay(_INTL("{1} forfeited the match!",self.pbPlayer.name))
@decision=3
return 1
end
return 0
end
[COLOR="Red"] if isGhostEncountersActive?
pbDisplayPaused(_INTL("Got away safely!"))
@decision=3
return 1
end[/COLOR]
if $DEBUG && Input.press?(Input::CTRL)
pbSEPlay("Battle flee")
pbDisplayPaused(_INTL("Got away safely!"))
@decision=3
return 1
end
In the same script, in this Section "# Initialize wild Pokémon" add the RED LINES:
Spoiler:
Code:
#========================
# Initialize wild Pokémon
#========================
if !@opponent
if @party2.length==1
if @doublebattle
raise _INTL("Only two wild Pokémon are allowed in double battles")
end
wildpoke=@party2[0]
[COLOR="Red"] wildpoke.name="Ghost" if isGhostEncountersActive?
wildpoke.setGhostNoGender if isGhostEncountersActive? [/COLOR]
@battlers[1].pbInitialize(wildpoke,0,false)
@peer.pbOnEnteringBattle(self,wildpoke)
Right after the line:
Code:
@peer.pbOnEnteringBattle(self,wildpoke)
Replace the line:
Code:
pbSetSeen(wildpoke)
To this:
Code:
[COLOR="Red"] pbSetSeen(wildpoke) if !isGhostEncountersActive?[/COLOR]
Right after the next line:
Code:
@scene.pbStartBattle(self)
Replace the line:
Code:
pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))
To this:
Spoiler:
Code:
[COLOR="Red"] if isGhostEncountersActive?
pbDisplayPaused(_INTL("The Ghost appeared!"))
pbDisplayPaused(_INTL("Darn!\nThe Ghost can't be ID'd!"))
else
pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))
end[/COLOR]
elsif @party2.length==2
if !@doublebattle
raise _INTL("Only one wild Pokémon is allowed in single battles")
end[CODE][/SPOILER]
In the [B]same script, Section: "# Command phase."[/B] add the RED LINES:
[SPOILER][CODE] # Reset choices to perform Mega Evolution if it wasn't done somehow
for i in 0...2
for j in 0...@megaEvolution[i].length
@megaEvolution[i][j]=-1 if @megaEvolution[i][j]>=0
end
end
for i in 0...4
break if @decision!=0
next if @choices[i][0]!=0
if !pbOwnedByPlayer?(i) || @controlPlayer
if !@battlers[i].fainted? && pbCanShowCommands?(i)
@scene.pbChooseEnemyCommand(i)
end
else
commandDone=false
commandEnd=false
if pbCanShowCommands?(i)
loop do
cmd=pbCommandMenu(i)
if cmd==0 # Fight
[COLOR="Red"] if isGhostEncountersActive? && !@opponent # In a wild battle
pbDisplay(_INTL("{1} is too scared to move!",@battlers[i].pbThis))
commandDone=true[/COLOR]
Replace the next like:
Code:
if pbCanShowFightMenu?(i)
For this line:
Code:
[COLOR="Red"] elsif pbCanShowFightMenu?(i)[/COLOR]
Third, the game events:
A) Create a Parallel Process Event always ON.
B) Add a Conditional Branch Event, in its 4th page, where is script section put this: $PokemonBag.pbQuantity(PBItems::SILPHSCOPE)>0
And check the box below where it says: Set handling when conditions do not apply.
C) Put this switch: LavenderGhostScript tuned OFF before the Conditional Branch else. And under that else, turn the switch ON.
Note: This will detect if the player has the key item: Silph Scope. And rename the switch whatever name you like.
![[PokeCommunity.com] Lavender Town Ghosts For PE V17.2 [PokeCommunity.com] Lavender Town Ghosts For PE V17.2](https://i46.servimg.com/u/f46/19/96/78/09/item_e10.png)
Finaly, add the graphics in: Graphics/Battlers:
![[PokeCommunity.com] Lavender Town Ghosts For PE V17.2 [PokeCommunity.com] Lavender Town Ghosts For PE V17.2](https://i46.servimg.com/u/f46/19/96/78/09/ghost10.png)
Name it Ghost. If you want other name, just rename it and in the script too.
Optional, if you are using Pokemon Birthsigns script add the RED LINES:
Spoiler:
Code:
def pbThrowPokeBall(idxPokemon,ball,rareness=nil,showplayer=false)
[COLOR="Red"]if isGhostEncountersActive? || $game_switches[333]
pbDisplay(_INTL("It dodged the thrown Ball! This POKéMON can't be caught!"))
return
end[/COLOR]
itemname=PBItems.getName(ball)
battler=nil
if pbIsOpposing?(idxPokemon)
battler=self.battlers[idxPokemon]
else
battler=self.battlers[idxPokemon].pbOppositeOpposing
end
if battler.fainted?
battler=battler.pbPartner
end
pbDisplayBrief(_INTL("{1} threw one {2}!",self.pbPlayer.name,itemname))
if battler.fainted?
pbDisplay(_INTL("But there was no target..."))
return
end
All credits goes to zerokid, but the key item section credits goes to me, Richard PT.
Known Issues:
Your Pokemon can still attack the Ghost. For this part i need some help, because i don't know what codes will block your pokemon from using a move against the Ghost. Your pokemon is supposed to be too scared to attack.