• 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!
  • 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] Looking for an item with an event modifier

Telemetius

Tele*
  • 256
    Posts
    10
    Years
    Hi forum, so I have a question, how can I code an event modifier that checks if the first pkm of my opponent has a specific item?

    I know about ".setItem" but what i need is just to check if the pkm already has that item.
    Here's what I tried to do:

    Code:
    Events.onTrainerPartyLoad+=proc {|sender,e|
      if e[0] # Trainer data should exist to be loaded, but may not exist somehow
        trainer=e[0][0] # A PokeBattle_Trainer object of the loaded trainer
        items=e[0][1]   # An array of the trainer's items they can use
        party=e[0][2]   # An array of the trainer's Pokémon
        if party[0].isConst?(@item,PBItems,:TESTITEM)
         party[0].form=1
        end
      end
    }

    Any help?
     
    Back
    Top