• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Cyndy, May, Hero (Conquest), or Wes - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Using a Field Effect to Change Forms

sonicfan7895

Just a dude, I guess
  • 120
    Posts
    14
    Years
    I need some help again... >:(

    So with everything I've gotten to figure out so far, there is one thing that is still puzzling me to this very day, and something I'd like to get done in the development of our game.

    So, in our team's game, Pokemon Zen Version, we are including Giratina as an integral part of our story, and one of the things that we changed about Giratina is how it changes into Origin Forme. Rather than using the Griseous Orb, we want it to be able to change into Origin Forme through the use of a field effect, which is only obtainable through a new ability.

    Everything about the field effect (and every desired effect) has been put into the game, the only thing that's puzzling me is how to execute a change in forme using only the field effect in question, called "Distortion".

    This is the code I have thus far:
    Code:
    MultipleForms.register(:GIRATINA,{
    [...]
    "getForm"=>proc{|pokemon|
       maps=[49,50,51,72,73]   # Map IDs for Origin Forme
       if @field.effects[PBEffects::DistortionField]>=1 ||
          ($game_map && maps.include?($game_map.map_id))
         next 1
       end
       next 0

    This came from Pokemon_MultipleForms, lines 553-577 ending at that "next 0" line.

    If this looks correct at all, and I'm just missing something, please let me know.
     
    That is not the right place for the code. You don't need the check for the field effects there because the field effects in vbattle are out of scope and not accesesablt from a pokemon object. (ie. Runtime errors if you tried to use this.)
    You'll need to do almost the same thing but in def pbCheckForm in PokeBattle_Battler.

    Code:
    if isConst?(self.species,PBSpecies,:GIRATINA)
          if [email protected]
            [email protected]
            transformed=true
          end
        end
    Look for this.
    Change to this.
    Code:
    if isConst?(self.species,PBSpecies,:GIRATINA)
        if [email protected]
            [email protected]
            transformed=true
          end  
        if battle.field.effects[PBEffects::DistortionField]>=1
            self.form=1
            transformed=true
          end
        end
    Not tested, so may syntax error. (sorry in a rush)
     
    That is not the right place for the code. You don't need the check for the field effects there because the field effects in vbattle are out of scope and not accesesablt from a pokemon object. (ie. Runtime errors if you tried to use this.)
    You'll need to do almost the same thing but in def pbCheckForm in PokeBattle_Battler.

    Code:
    if isConst?(self.species,PBSpecies,:GIRATINA)
          if [email protected]
            [email protected]
            transformed=true
          end
        end
    Look for this.
    Change to this.
    Code:
    if isConst?(self.species,PBSpecies,:GIRATINA)
        if [email protected]
            [email protected]
            transformed=true
          end  
        if battle.field.effects[PBEffects::DistortionField]>=1
            self.form=1
            transformed=true
          end
        end
    Not tested, so may syntax error. (sorry in a rush)

    It works for the most part, but it checks form and "transforms" it after literally everything that happens in battle. Attack a Pokemon, "transformation". Enemy Pokemon makes a turn, "transforms". Then it "transforms" twice more after that in the post turn checks.
     
    [snip to get your attention]
    Sorry, I didn't realize that would happen. Now it checks if its form is not 1 and the effect is active and then does the stuff.
    Code:
    if isConst?(self.species,PBSpecies,:GIRATINA)
        if [email protected]
            [email protected]
            transformed=true
          end  
        [COLOR="Red"]if @battle.field.effects[PBEffects::DistortionField]>=1 && self.form!=1[/COLOR]
            self.form=1
            transformed=true
          end
        end
     
    Last edited:
    Snip to grab your attention

    So it no longer transforms it after every single thing that happens, which is a great thing! But now the problem becomes changing formes back to 0 after a battle ends, like a Mega Evolution.

    I tried looking into how Cherrim's form changed and how it changed back and tried to implement it, but it didn't work at all... Any ideas?
     
    [attention snip]


    That's in def pbResetForm, just below the method we were working with.
    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) ||
    isConst?(self.species,PBSpecies,:AEGISLASH) ||
    isConst?(self.species,PBSpecies,:XERNEAS) ||
    isConst?(self.species,PBSpecies,:GIRATINA)

    self.form=0
    end
    end
    pbUpdate(true)
    end

    Resets on faint, recall, and battle end.
     
    Back
    Top