there's a few steps you gotta do but it's not that complicated overall. first you'd have to add an onEvent function to your code, then make it so when the event you want to be permanent is called (you can check which event is triggered by checking the eventName parameter), you set a SaveData variable (preferably a bool that gets set to true). also, make sure that variable is initialized near the top of the file to make sure it's never nil. then, in onStart, check that SaveData variable to see if it was set, and if it was, trigger the event you want with triggerEvent. it'll look something like this
Code: Select all
-- initialize the saveData variable if it isn't already
SaveData.eventTriggered = SaveData.eventTriggered or false
function onStart()
if SaveData.eventTriggered then
triggerEvent("[name of the event you want]")
end
end
function onEvent(eventName)
if eventName == "[name of the event you want]" then
SaveData.eventTriggered = true
end
end
here's some links in the documentation about what i used if you want to learn more:
https://docs.codehaus.moe/#/reference/lunalua-events
https://docs.codehaus.moe/#/concepts/savedata-gamedata