• Our software update is now concluded. You will need to reset your password to log in.
  • Please note that the site will be down briefly around 10AM EST, 22 February, for planned maintenance.
  • Welcome to PokéCommunity! Register now and join one of the best places on the 'net to talk Pokémon and more! Community members will not see the bottom screen advertisements.
  • Want to share your adventures playing Pokémon?
    Check out our new Travel Journals forum for sharing playthroughs of ROM Hacks, Fan Games, and other Pokémon content!
  • IMPORTANT: Following a takedown request, the following hacks have been delisted from PokéCommunity:

    • Pokémon Glazed
    • Pokémon: Giratina Strikes Back
    • Pokémon Flora Sky
    • Pokémon Stranded
    The downloads and discussion threads for these hacks will no longer be accessible, and staff will be unable to return questions regarding accessing this content.

[Solved] [Script] Custom Special and Event Triggering - goto_if_set bugging out?

3
Posts
174
Days
  • Age 24
  • Seen Feb 20, 2024
Hi All,

This is my first post looking for debug help, so I apologize if I do this incorrectly.

I want to have a custom event trigger in May's Room during the night hours (Jirachi appears, player gets to catch it, etc.). I've written a special function IsNight that checks if the gLocalTime.hours is < 7 || >= 20. Gratefully, this works no problem! It sets a flag FLAG_IS_NIGHT to true, which I am using to trigger the event. The idea is that if the player has the national dex (FLAG_SYS_NATIONAL_DEX), has not yet caught Jirachi (FLAG_CAUGHT_JIRACHI), it is night (FLAG_IS_NIGHT), and finally if the player is not female (checkplayergender, will be doing the same thing in Brendan's Room for female characters), then the event will trigger. I've included below the time_events.c which has the function in it (again, working so I don't think that's the problem) as well as the script file for May's Room. I think the issue is on line 20, where I am calling goto_if_set FLAG_IS_NIGHT, LittlerootTown_MaysHouse_2F_EventScript_PlayJirachiEvent. When I remove this line, FLAG_IS_NIGHT is set to true, as it should be by the special call on the line above. Including this line however causes the game to blackscreen. The music still plays but nothing loads in. I have tried using a different flag (FLAG_SYS_NATIONAL_DEX) for testing and the same thing occurs. I have also tried pointing it to a different event script, same thing occurs. I edited the PlayJirachiEvent event script to something very simply (playmoncry) and the same thing occurs. Lastly, I have tried adding in a simple msgbox that occurs after the special IsNight is called, and that doesn't seem to work. I have made sure to include def_special IsNight in the specials.inc file. So my thoughts are either of these 2 things:

1. The special call is not finishing before the code continues to execute, causing an error (thus why any script, whether inside the CheckIfNight script or the PlayJirachiEvent script, causes blackscreen).

OR

2. There is something funky going on with me goto_if_set call on line 20.

I am now leaning towards the former, but I'm not sure what could be causing the issue. If someone could please take a look and help out, that would be huge! Thank you all very much. For the script file, I've only included the sections that I've edited (other than movement and text) but if you'd like to see the whole file, please let me know and I'll share it. Thanks so much again!

Spoiler: time_events.h


Spoiler: time_events.c


Spoiler: May's House 2F script.inc
 
3
Posts
174
Days
  • Age 24
  • Seen Feb 20, 2024
I ended up changing how I handled this event, so this is no longer an issue. I was originally trying to handle all of this based on Event Scripts chained from the OnTransition map script, however I believe that all I was trying to accomplish might not have actioned properly because the objects just weren't loaded in. It seems like trying to run commands that affect the movement, speech, etc. of objects on a map can't be done during a map transition.
 
Back
Top