• 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.

Call a common event from the script section?

pokemonmasteraaron

The blind Pokémon Master!
  • 322
    Posts
    14
    Years
    Hi there!
    I'm trying to call a common event when a key item is used. Unfortunately, the old way, he RMXP standard way, does not work in essentials. That was something like $game_temp.call_common_event(id), don't remember exactly. How can I do the equivalent i essentials?
    Thanks!
     
    I use this code and it works fine

    pbCommonEvent(id)
     
    That works great, thanks! Is there a way to close the bag automatically though, before the common event happens? It glitches up if I do this with the bag still obviously open. I know the Old Rod, for example, closes the bag before fishing, but I don't see the code responsible for that exactly.
    Thanks,
    Aaron
     
    Hmm, I'm not sure. Is your Item called with the handler UseFromBag like this?

    Code:
    ItemHandlers::UseFromBag.add(:ITEM,proc{|item|
    [COLOR="SeaGreen"]#Item effect code (probably pbCommonEvent(id))[/COLOR]
         next [B][COLOR="Red"]2[/COLOR][/B]
       else
         Kernel.pbMessage(_INTL("Text"))
         next 0
       end
    })

    Cause according to the wiki, 2 or 4 should close the Bag:

    "For when the item is being used from the Bag, but not on a chosen Pokémon. Typically used for Escape Rope, Repels, all Key Items and a few others.
    Returns one of the following numbers:

    0 if the item was not used.
    1 - The item was used, and the Bag screen stays open.
    2 - The item was used, and the Bag screen is closed.
    3 - The item was used, and it was consumed.
    4 - The item was used, it was consumed, and the Bag screen is closed."

    If your item is consumed after use then the value in red should be 4
     
    Back
    Top