• 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] Multiple Forms

  • 57
    Posts
    5
    Years
    • Seen Apr 17, 2022
    Hello, I would like to make a pokemon have a form, only if it holds an object and is already in its 1 or 2 shape. It would be something like for example Ultra Necrozma, which can only access that form if it is already in the form of Dusk Mane or Dawn Wings. Only in this case I want it to be permanent until you remove the item. It's possible? If it is, I would appreciate it explained to me.

    Thank you.
     
    Copy how Giratina works in _Forms script but you have to add 'next 3 if pokemon.form!=0 && hasWorkingItem(:XXX)' instead all the map thing about Giratina.
     
    Sorry, but it was not very clear to me. Could you send me a code with that, because I have tried it and it gives me an error.
    This error.
    Spoiler:

    Also, this can't return it to the way it was before, right? I go back to the example, if it was in the Dawn Wings form, which is the 2 form, it will return to Dusk Mane, the first form, right?
     
    So you need to read, study and do a unique script for it inside 'def pbGiveItemToPokemon(item,pokemon,scene,pkmnid=0)' and 'def pbTakeItemFromPokemon(pokemon,scene)'. Also, you have to create a code like we have for 'fused' (I putted like 'mimimi' as example), that way each pokémon will have one, to store its form (1 or 2) before you change to a new one (3).

    Code:
    def pbGiveItemToPokemon(item,pokemon,scene,pkmnid=0)
      newitemname = PBItems.getName(item)
      if pokemon.egg?
        scene.pbDisplay(_INTL("Eggs can't hold items."))
        return false
      elsif pokemon.mail
        scene.pbDisplay(_INTL("{1}'s mail must be removed before giving it an item.",pokemon.name))
        return false if !pbTakeItemFromPokemon(pokemon,scene)
      end
      if pokemon.hasItem?
        olditemname = PBItems.getName(pokemon.item)
        if isConst?(pokemon.item,PBItems,:LEFTOVERS)
          scene.pbDisplay(_INTL("{1} is already holding some {2}.\1",pokemon.name,olditemname))
        elsif ['a','e','i','o','u'].include?(newitemname[0,1].downcase)
          scene.pbDisplay(_INTL("{1} is already holding an {2}.\1",pokemon.name,olditemname))
        else
          scene.pbDisplay(_INTL("{1} is already holding a {2}.\1",pokemon.name,olditemname))
        end
        if scene.pbConfirm(_INTL("Would you like to switch the two items?"))
          $PokemonBag.pbDeleteItem(item)
          if !$PokemonBag.pbStoreItem(pokemon.item)
            if !$PokemonBag.pbStoreItem(item)
              raise _INTL("Could't re-store deleted item in Bag somehow")
            end
            scene.pbDisplay(_INTL("The Bag is full. The Pokémon's item could not be removed."))
          else
            if pbIsMail?(item)
              if pbWriteMail(item,pokemon,pkmnid,scene)
                pokemon.setItem(item)
                scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.",olditemname,pokemon.name,newitemname))
                return true
              else
                if !$PokemonBag.pbStoreItem(item)
                  raise _INTL("Couldn't re-store deleted item in Bag somehow")
                end
              end
            else
              pokemon.setItem(item)
    		  if isConst?(item,PBItems,:MAMMAMIA) && isConst?(pokemon.species,PBSpecies,:MIMI) && pokemon.form>0 && pokemon.form<3
    		    pokemon.mimimi=pokemon.form
    			pokemon.form=3
    		  end
              scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.",olditemname,pokemon.name,newitemname))
              return true
            end
          end
        end
      else
        if !pbIsMail?(item) || pbWriteMail(item,pokemon,pkmnid,scene)
          $PokemonBag.pbDeleteItem(item)
          pokemon.setItem(item)
          if isConst?(item,PBItems,:MAMMAMIA) && isConst?(pokemon.species,PBSpecies,:MIMI) && pokemon.form!=0
    	    pokemon.mimimi=pokemon.form
    		pokemon.form=3
    	  end
          scene.pbDisplay(_INTL("{1} is now holding the {2}.",pokemon.name,newitemname))
          return true
        end
      end
      return false
    end
    
    def pbTakeItemFromPokemon(pokemon,scene)
      ret = false
      if !pokemon.hasItem?
        scene.pbDisplay(_INTL("{1} isn't holding anything.",pokemon.name))
      elsif !$PokemonBag.pbCanStore?(pokemon.item)
        scene.pbDisplay(_INTL("The Bag is full. The Pokémon's item could not be removed."))
      elsif pokemon.mail
        if scene.pbConfirm(_INTL("Save the removed mail in your PC?"))
          if !pbMoveToMailbox(pokemon)
            scene.pbDisplay(_INTL("Your PC's Mailbox is full."))
          else
            scene.pbDisplay(_INTL("The mail was saved in your PC."))
            pokemon.setItem(0)
            ret = true
          end
        elsif scene.pbConfirm(_INTL("If the mail is removed, its message will be lost. OK?"))
          $PokemonBag.pbStoreItem(pokemon.item)
          itemname = PBItems.getName(pokemon.item)
          scene.pbDisplay(_INTL("Received the {1} from {2}.",itemname,pokemon.name))
          pokemon.setItem(0)
          pokemon.mail = nil
          ret = true
        end
      else
        $PokemonBag.pbStoreItem(pokemon.item)
        itemname = PBItems.getName(pokemon.item)
        scene.pbDisplay(_INTL("Received the {1} from {2}.",itemname,pokemon.name))
        if isConst?(pokemon.item,PBItems,:MAMMAMIA) && isConst?(pokemon.species,PBSpecies,:MIMI) && pokemon.form==3
    	  pokemon.form=pokemon.mimimi
    	  pokemon.setItem(0)
    	else
          pokemon.setItem(0)
    	end
        ret = true
      end
      return ret
    end
     
    Back
    Top