CerealCat wrote: ↑Wed Oct 20, 2021 5:32 am
I don't know how to code anything and I didn't find any results searching for this. I'm wanting an event to play in my hub world after collecting a certain amount of stars. I don't know if it's possible, but I look forward to waking up tomorrow and seeing what replies I get.
while i assume you mean the overworld by "hub world", i'll offer up a solution to both interpretations just to be sure.
if you mean performing an action when the player enters the overworld for the first time after collecting a set amount of stars, first you have to ensure it can't happen more than once. so, inside onStart() within your "map.lua", you'll want to set a custom field inside SaveData that dictates whether the action has already been done, something like:
Code: Select all
if (SaveData.xStarsEventDone == nil) then SaveData.xStarsEventDone = false end
then, if it hasn't happened (i.e. said field is equal to false), simply compare the player's star count (
global memory 0x00B251E0) to your desired value, and if it's greater than or equal to it, perform the desired action.
if you mean performing an event inside a hub-styled level after a certain amount of stars has been collected, that's also doable. use
onPostNPCKill and check if the killed NPC was a star. then, once again just compare the star counter to your desired value, but this time only trigger the event if it's exactly equal to it (otherwise, the event would trigger with each subsequent collected star)