eventleveltimer.lua

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
LM280
Monty Mole
Monty Mole
Posts: 121
Joined: Wed Jan 15, 2014 7:10 pm

eventleveltimer.lua

Postby LM280 » Sun Jul 02, 2017 11:46 pm

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.

TDK
Phanto
Phanto
Posts: 1440
Joined: Wed Nov 11, 2015 12:26 pm
Flair: Retired

Re: eventleveltimer.lua

Postby TDK » Mon Jul 03, 2017 12:14 pm

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


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 6 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari