This was originally a script i made for Deoxys in my game, but i thought you guys may want to use it for something else. Special thanks to DL Kurosh for the Stance Change script. Give credit to both of us if you use this.
Look for this in PokeBattle_Battler script:
Put this right after it (for multiple forms just place one right after each other)
You can remove the Ability condition, but don't remove the Pokemon condition, especially if you are using an Ability condition because it can get traced.
after hp>0 you can add any condition you want. these are the ones i tried:
isConst?(self.ability,PBAbilities,:ABILITY) if the Pokemon has a specific ability, so moves like Worry Seed will temporally disable changing forms. For multiple abilities, separate them with ||.
isConst?(self.species,PBSpecies,:POKEMON) if the Pokemon is a specific species. This should always be in the script so only a specific Pokemon can transform.
thismove.basedamage == 0 if the move deals 0 damage, so every status move fits this condition. You can use < or > instead of == for lower than the value or greater than the value. You can also change 0 to any value you want.
thismove.priority == 0 if the move doesn't have priority. You can change it to > 0 to make every move that has priority fulfill the condition.
thismove.function == 0x2A if the moves function code is 02A (written in hex which is 0x2A, all moves need to be in hex otherwise it won't work). 02A is the function code of Cosmic Power and Defend Order, so if Deoxys uses Cosmic Power, he will change forme. You can use != for not equal, so if Deoxys uses Cosmic Power, he will not transform. If using multiple function codes for the same forme, make sure to separate them with || instead of &&.
There are probably way more, but i haven't tried anything else. Try using thismove.something to find out other things, there is probably one for type.
If dealing with multiple forms, make sure no move can fulfill more than 1 requirement, because otherwise the Pokemon will transform multiple times.
Then look for this:
Put this under it:
This will treat the Pokemon as transformed and will display the message that it transformed.
If you want to have the Pokemon change back to it's first forme at the end of the battle, look for:
Add
If you did everything correctly, it should work.
Here is what it should look like (it's a bit messy because Deoxys has 4 forms, and didn't feel like testing every single function code for multiple transformations)
Look for this in PokeBattle_Battler script:
Code:
if status==PBStatuses::FROZEN && (thismove.flags&0x40)!=0 # flag g: Thaws user before moving
self.status=0
pbCheckForm
@battle.pbDisplay(_INTL("{1} was defrosted by {2}!",pbThis,thismove.name))
end
Put this right after it (for multiple forms just place one right after each other)
Code:
if isConst?(self.ability,PBAbilities,:ABILITY) &&
isConst?(self.species,PBSpecies,:POKEMON) && hp>0
@pokemon.form=1 #change this to whatever form you want
pbCheckForm
end
You can remove the Ability condition, but don't remove the Pokemon condition, especially if you are using an Ability condition because it can get traced.
after hp>0 you can add any condition you want. these are the ones i tried:
isConst?(self.ability,PBAbilities,:ABILITY) if the Pokemon has a specific ability, so moves like Worry Seed will temporally disable changing forms. For multiple abilities, separate them with ||.
isConst?(self.species,PBSpecies,:POKEMON) if the Pokemon is a specific species. This should always be in the script so only a specific Pokemon can transform.
thismove.basedamage == 0 if the move deals 0 damage, so every status move fits this condition. You can use < or > instead of == for lower than the value or greater than the value. You can also change 0 to any value you want.
thismove.priority == 0 if the move doesn't have priority. You can change it to > 0 to make every move that has priority fulfill the condition.
thismove.function == 0x2A if the moves function code is 02A (written in hex which is 0x2A, all moves need to be in hex otherwise it won't work). 02A is the function code of Cosmic Power and Defend Order, so if Deoxys uses Cosmic Power, he will change forme. You can use != for not equal, so if Deoxys uses Cosmic Power, he will not transform. If using multiple function codes for the same forme, make sure to separate them with || instead of &&.
There are probably way more, but i haven't tried anything else. Try using thismove.something to find out other things, there is probably one for type.
If dealing with multiple forms, make sure no move can fulfill more than 1 requirement, because otherwise the Pokemon will transform multiple times.
Then look for this:
Code:
# Giratina
if isConst?(self.species,PBSpecies,:GIRATINA) && hp>0
if [email protected]
[email protected]
transformed=true
end
end
Put this under it:
Code:
if isConst?(self.species,PBSpecies,:POKEMON) && hp>0
if [email protected]
[email protected]
transformed=true
end
end
This will treat the Pokemon as transformed and will display the message that it transformed.
If you want to have the Pokemon change back to it's first forme at the end of the battle, look for:
Code:
def pbResetForm
if !@effects[PBEffects::Transform]
if isConst?(self.species,PBSpecies,:CASTFORM) ||
isConst?(self.species,PBSpecies,:CHERRIM) ||
isConst?(self.species,PBSpecies,:DARMANITAN) ||
isConst?(self.species,PBSpecies,:MELOETTA)
self.form=0
end
end
pbUpdate(true)
end
Add
Code:
isConst?(self.species,PBSpecies,:POKEMON) ||
If you did everything correctly, it should work.
Here is what it should look like (it's a bit messy because Deoxys has 4 forms, and didn't feel like testing every single function code for multiple transformations)
Spoiler:
Code:
if isConst?(self.ability,PBAbilities,:FORMECHANGE) &&
isConst?(self.species,PBSpecies,:DEOXYS) && hp>0 && thismove.basedamage == 0 &&
thismove.function != 0x2A && thismove.function != 0xBA &&
thismove.function != 0x2F && thismove.function != 0x33 &&
thismove.function != 0x71 && thismove.function != 0x72 &&
thismove.function != 0xA3 && thismove.function != 0x1A &&
thismove.function != 0xAA && thismove.function != 0xA1 &&
thismove.function != 0xD9 && thismove.function != 0x10C &&
thismove.function != 0x30 && thismove.function != 0x22 &&
thismove.priority < 1
#All the function codes are used to change Defense and Speed forms, != means not equal
#I didn't feel like checking every function code
#thismove.priority < 1 is there because priority moves trigger Speed Form
#Moves that should trigger Normal Form are Leer, Teleport, Recover, Spikes and few others
@pokemon.form=0 #Normal Forme
pbCheckForm
end
if isConst?(self.ability,PBAbilities,:FORMECHANGE) &&
isConst?(self.species,PBSpecies,:DEOXYS) && hp>0 && thismove.basedamage > 0 &&
thismove.priority < 1
@pokemon.form=1 #Attack Forme
pbCheckForm
end
if isConst?(self.ability,PBAbilities,:FORMECHANGE) &&
isConst?(self.species,PBSpecies,:DEOXYS) && hp>0 && thismove.function == 0x2A ||
thismove.function == 0xBA || thismove.function == 0x2F || thismove.function == 0x33 ||
thismove.function == 0x71 || thismove.function == 0x72 || thismove.function == 0xA3 ||
thismove.function == 0x1A || thismove.function == 0xAA || thismove.function == 0xA1 ||
thismove.function == 0xD9 || thismove.function == 0x10C
#These moves can trigger Defense Form (already ordered, "and" means they share the same
#function code)
#Cosmic Power and Defend Order, Taunt, Acid Armor and Barrier and Iron Defense, Amnesia,
#Counter, Mirror Coat, Light Screen, Safeguard, Detect and Protect, Lucky Chant, Rest,
#Substitude
@pokemon.form=2 #Defense Forme
pbCheckForm
end
if isConst?(self.ability,PBAbilities,:FORMECHANGE) &&
isConst?(self.species,PBSpecies,:DEOXYS) && hp>0 && thismove.function == 0x30 ||
thismove.function == 0x22 || thismove.priority > 0 &&
#Agility and Rock Polish, Double Team, and moves with priority will trigger Speed Form
thismove.function != 0x2A && thismove.function != 0xBA &&
thismove.function != 0x2F && thismove.function != 0x33 &&
thismove.function != 0x71 && thismove.function != 0x72 &&
thismove.function != 0xA3 && thismove.function != 0x1A &&
thismove.function != 0xAA && thismove.function != 0xA1 &&
thismove.function != 0xD9 && thismove.function != 0x10C &&
thismove.function != 0x30 && thismove.function != 0x22
#Just to make sure other moves don't trigger it
@pokemon.form=3 #Speed Forme
pbCheckForm
end