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

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

22
Posts
261
Days
    • Seen May 16, 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
     
    22
    Posts
    261
    Days
    • Seen May 16, 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