dop2000 & WackyToaster
You two are awesome! Setting the variables to static fixed the issue! I just had to add that the logged_in variable has to be set to 0 afterwards.
It's also odd that it does work outside the function.
I guess it is because I ordered the last two events (that got skipped) as sub-events of the event block containing the promise script. If I'm honest I didn't know about setting the variables to static. In that cases I just made other events sub-events to prevent resetting, lol. But seems like inside functions that does not work compared to outside of functions. But with that knowledge I will use static variables instead of sub-events in the future.
Thank you both!