Page 1 of 1

eventleveltimer.lua

Posted: Sun Jul 02, 2017 11:46 pm
by LM280
So this is a pretty simple edit of leveltimer.lua that makes a few changes that make it a bit easier to use in my opinion.

Changes:
-You can now use an SMBX event called Timer=(Number) to set the timer instead of doing it in lunadll.lua. Now you can just use the API in the lunaworld.lua file even if you want different times in different levels. I recommend making an autostart event with that name in every level and no other Timer= event.
-You can use an event called Timer+(Number) to add to the timer, a feature new to this patch (won't exceed 999). +(Number) flashes below the timer and plays the "increase.wav" sound effect in the folder. (Default is the "inventory" sound from Super Mario Bros 3) I recommend attaching this event to an axe.
-Minor changes to help center the text at the end of a level a bit better.
-Running out of time SFX will no longer play if the level already starts with less than 100 seconds. If you do want the sound to play simply go to line 77 and replace it with this:

Code: Select all

if secondsleft - timeelapsed <= 100 then
I'm absolutely not an expert in Lua so the new code is fairly messy and patchy, but it seems to work without issue under normal circumstances (and by that I mean the player can't screw it up if it's implemented normally). If you run into bugs, please let me know.

Download:
http://www.mediafire.com/file/bvn1knxk3 ... ltimer.zip

To use, just load the API "eventleveltimer" in the lunaworld.lua file.

Re: eventleveltimer.lua

Posted: Mon Jul 03, 2017 12:14 pm
by TDK
Sounds like it might be useful.
However I don't like how you have to directly edit the API if you want the running out of time SFX, I would prefer doing it in the lunadll.lua file.
I updated your API.
http://www.mediafire.com/file/vhtzz34jy ... ltimer.zip

So now you would have to enter this into your lunadll.lua file to get the running out of time SFX.

Code: Select all

eventleveltimer.runningoutSFX = true