- 1
- Posts
- 13
- Years
- Seen Aug 22, 2014
Hi all!
I am looking to alter the move Camouflage to make it's type change effect transferable via baton pass. I am also working on implementing terrain moves such as Electric Terrain, Grassy Terrain, and Misty Terrain, which are temporary field effects, so ideally I would prefer the passed type to reflect the terrain condition when the move was first used (ie it does not recheck the terrain when passing, it just passes the type).
This tutorial was really all the information I could find on creating moves with baton passable effects:
Following from that, here's what I'm thinking so far:
However, as is the actual type change is being handled by the MoveEffect, so I'm not sure if it will update the type of the swapped pokemon at all? Any ideas if I need to alter the function so the type change applies within PokeBattle_Battle? Again, ideally the original "type" variable needs to be retained as well!
Thanks in advance for any help.
I am looking to alter the move Camouflage to make it's type change effect transferable via baton pass. I am also working on implementing terrain moves such as Electric Terrain, Grassy Terrain, and Misty Terrain, which are temporary field effects, so ideally I would prefer the passed type to reflect the terrain condition when the move was first used (ie it does not recheck the terrain when passing, it just passes the type).
This tutorial was really all the information I could find on creating moves with baton passable effects:
Spoiler:
Though the wiki mentions it briefly, there isn't really any tutorial that explains how to implement something like this. Easiest way is to just find all instances of aqua ring and copy them, but I'll try to explain what each part does.
First step, look in PBEffects. You'll see a list of Effects that can exist in battle, you're going to add onto this list. Note that effects in this instances are not the same as Statuses or Move Effects. However, a Move Effect is what will change the state of Effects, so they are sort of codependent.
Long story short, you're going to add this
after the last effect in PBEffects, replacing XXX with the next available number.Code:FlareRing = XXX
Effects that would effect a side of the field need to be initialized as 0 (or false for a boolean) in PokeBattle_ActiveSlider, but in this case the effect only affects a specific pokemon, so this is not needed.
Next, in PokeBattle_Battler, after
Code:@effects[PBEffects::AquaRing] = false
add
Code:@effects[PBEffects::FlareRing] = false
This will allow it to be passable via Baton Pass, if you want that sort of thing.
Next we are going to make the effect actually do something. This is in PokeBattle_Battle
Code:# Aqua Ring for i in priority next if i.hp<=0 if i.effects[PBEffects::AquaRing] hpgain=(i.totalhp/16).floor hpgain=(hpgain*1.3).floor if isConst?(i.item,PBItems,:BIGROOT) hpgain=i.pbRecoverHP(hpgain,true) pbDisplay(_INTL("{1}'s Aqua Ring restored its HP a little!",i.pbThis)) if hpgain>0 end end
Under that, we are going to put
Code:# Flare Ring for i in priority next if i.hp<=0 if i.effects[PBEffects::FlareRing] hpgain=(i.totalhp*3/16).floor hpgain=(hpgain*1.3).floor if isConst?(i.item,PBItems,:BIGROOT) hpgain=i.pbRecoverHP(hpgain,true) pbDisplay(_INTL("{1}'s Flare Ring restored its HP a little!",i.pbThis)) if hpgain>0 end end
This section of the code is where all the checks are done before ending a turn and moving onto the next one.
Next we are going to create the Move Effect, that will initiate the effect.
This is the class used for Aqua Ring
Code:################################################################################ # Rings the user. Ringed Pokémon gain 1/16 of max HP at the end of each round. ################################################################################ class PokeBattle_Move_0DA < PokeBattle_Move def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true) if attacker.effects[PBEffects::AquaRing] @battle.pbDisplay(_INTL("But it failed!")) return -1 end pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) attacker.effects[PBEffects::AquaRing]=true @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",attacker.pbThis)) return 0 end end
So we're going to make one for Flare Ring. It's pretty simple.
Code:################################################################################ # Rings the user. Ringed Pokémon gain 3/16 of max HP at the end of each round. ################################################################################ class PokeBattle_Move_XXX < PokeBattle_Move def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true) if attacker.effects[PBEffects::FlareRing] @battle.pbDisplay(_INTL("But it failed!")) return -1 end pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) attacker.effects[PBEffects::FlareRing]=true @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of fire!",attacker.pbThis)) return 0 end end
All we had to do was make it so that it would make the effect true for the user, unless the effect was already true. Make sure to replace XXX with the next available number. 0DG is actually available, but let's not get into all that.
Make sure you make the function code in your moves.txt for this move matches what you replaced XXX with, and you should be good to go. Let me know if you have any questions.
Following from that, here's what I'm thinking so far:
- Add Camouflage to PBEffects like so
Code:Camouflage = XXX
where "XXX" is the next available effect code.
- Add
Code:@effects[PBEffects::Camouflage] = false
to PokeBattle_Battler under the Baton Pass function.
- Not sure if I need to add anything under PokeBattle_Battle to define the status??? Currently Camouflage's functionality is handled completely within PokeBattle_MoveEffects (see below).
- Lastly add
Code:attacker.effects[PBEffects::Camouflage]=true
under the Camouflage's class in PokeBattle_MoveEffects, like so:
Code:class PokeBattle_Move_060 < PokeBattle_Move def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true) if isConst?(attacker.ability(true),PBAbilities,:MULTITYPE) @battle.pbDisplay(_INTL("But it failed!")) return -1 end envtypes=[ :NORMAL, # None :GRASS, # Grass :GRASS, # Tall grass :WATER, # Moving water :WATER, # Still water :WATER, # Underwater :ROCK, # Rock :ROCK, # Cave :GROUND # Sand ] type=envtypes[@battle.environment] if attacker.pbHasType?(type) @battle.pbDisplay(_INTL("But it failed!")) return -1 end pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation) attacker.effects[PBEffects::Camouflage]=true #####added effect newtype=getConst(PBTypes,type) || 0 attacker.type1=newtype attacker.type2=newtype typename=PBTypes.getName(newtype) @battle.pbDisplay(_INTL("{1} transformed into the {2} type!",attacker.pbThis,typename)) return 0 end end
I don't believe there needs to be a check whether the effect is already active because Camouflage can overwrite itself.
However, as is the actual type change is being handled by the MoveEffect, so I'm not sure if it will update the type of the swapped pokemon at all? Any ideas if I need to alter the function so the type change applies within PokeBattle_Battle? Again, ideally the original "type" variable needs to be retained as well!
Thanks in advance for any help.
Last edited: