• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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] Tri-Splicers Help

HeroesFightingFear

"The Champion of Alon"
  • 99
    Posts
    5
    Years
    I am trying to create an item like the DNA Splicers that takes three Pokemon, using Lucario as a base, Mewtwo as the second Pokemon, and Alakazam as the new third Pokemon variable. When this item is used, it sets Lucario into a new second form, an alternative to its Mega.

    Here is the item in the PBS File.
    Spoiler:
     
    Alright, I tried my hand at coding it. Let me know if this looks alright.
    Code:
    ItemHandlers::UseOnPokemon.add(:TRISPLICERS,proc { |item,pkmn,scene|
      if !pkmn.isSpecies?(:LUCARIO)
        scene.pbDisplay(_INTL("It had no effect."))
        next false
      end
      if pkmn.fainted?
        scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
      end
      # Fusing
      if pkmn.fused==nil
        chosen = scene.pbChoosePokemon(_INTL("Fuse with which Pokémon?"))
        next false if chosen<0
        poke2 = $Trainer.party[chosen]
        poke3 = $Trainer.party[chosen]
        if pkmn==poke2 || pkmn==poke3
          scene.pbDisplay(_INTL("It cannot be fused with itself."))
        elsif poke2.egg? || poke3.egg?
          scene.pbDisplay(_INTL("It cannot be fused with an Egg."))
        elsif poke2.fainted? || poke3.fainted?
          scene.pbDisplay(_INTL("It cannot be fused with a fainted Pokémon."))
        elsif !poke2.isSpecies?(:MEWTWO) &&
              !poke3.isSpecies?(:ALAKAZAM)
          scene.pbDisplay(_INTL("It cannot be fused with those Pokémon."))
        end
        newForm = 0
        newForm = 2 if poke2.isSpecies?(:MEWTWO) && poke3.isSpecies?(:ALAKAZAM)
        pkmn.setForm(newForm) {
          pkmn.fused = poke2 && pkmn.fused = poke3
          pbRemovePokemonAt(chosen)
          scene.pbHardRefresh
          scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name))
        }
        next true
      end
      # Unfusing
      if $Trainer.party.length>=6
        scene.pbDisplay(_INTL("You have no room to separate the Pokémon."))
        next false
      end
      pkmn.setForm(0) {
        $Trainer.party[$Trainer.party.length] = pkmn.fused
        pkmn.fused = nil
        scene.pbHardRefresh
        scene.pbDisplay(_INTL("{1} changed Forme!",pkmn.name))
      }
      next true
    })
     
    Back
    Top