• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

[Other] Adding trigger events

  • 4
    Posts
    9
    Years
    • Seen Oct 12, 2020
    This is my first time making a ROM hack. I'm having trouble making a trigger event (not sure if that's the right term for it)
    But basically an example of what I would like to do is to make a trainer appear/disappear only after defeating another trainer.
    Any help or point in the right direction would be greatly appreciated.

    (The game is a hack of pokemon emerald if that makes any difference)
     
  • 59
    Posts
    9
    Years
    • Seen May 16, 2016
    Right, so here's what you need to do:

    Make one trainer set a flag when defeated. They all do this automatically, to make sure you don't repeat the fight. If you open an already written script, you can see this flag. If you're making your own, add one.

    You also need to use showsprite and hidesprite to make people appear/dissappear as you need. Make it so that when the flag is set, the sprite appears. The flag is only set when you beat a trainer.... and there you go.

    I'm not the best scripter, but if you need more help ask!
     
  • 6,355
    Posts
    18
    Years
    • Seen Apr 16, 2020
    Say the person you want appearing and disappearing has "1FF" as Person ID. That Person ID refers to a flag. The person needs to have a Person ID otherwise it'll just appear again after disappearing.

    If the person is not on the same map as the trainer battle, then by using "setflag 0x1FF" in the trainer battle script, the person, and any other person event using ID 1FF will disappear. Using "clearflag 0x1FF" again will make it reappear.

    Now, if it's on the same map, using "hidesprite 0x[peoplenumber]" or "showsprite" works as well, and when the person is hidden that means flag 0x1FF will automatically be set, or cleared if the sprite is shown.
     
    Back
    Top