Page 1 of 1

This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:23 pm
by Shidomaru
I have finally discovered how you make the game write "GAME OVER" on the center of the screen when you lose your last life!

Code: Select all

#0 //Section number where it applies. 0 means always
OnGlobalMem,0x00B2C5AC,0,0,1001,0,f //Checks if the player's number of lives equals 0 and calls event 1001

#1001
OnPlayerMem,0x16,0,0,1002,0,w //Checks if the player's number of hearts equals 0 as well (not tested with Mario or Luigi) and calls event 1002

#1002
ShowText,0,300,260,3,1,GAME OVER //Shows the text for 1 frame, you'll see why

Now, this code has THREE weaknesses that I know of:

First and most important issue with this code is it will lag the game for the short time the player's last death animation lasts. This is because the code is ALWAYS checking the variables, and when both variables are 0 it prints the text EVERY SINGLE FRAME over and over, thus why the ShowText only lasts 1 frame, as it lags much worse if it lasts any longer.

Secondly, I was unable to get a lunaglobal.txt file to work, so you will have to do the tedious task of writing this code in the lunadll.txt of EVERY level! Thankfully for me, my projects are much shorter than those of the average SMBX community member.

Lastly, as mentioned in the comments of the code itself, it works with hearts, so I doubt it will work with Mario and Luigi, who are the most used characters. My project uses Toad, so at least I can guarantee it works with him.

That's all. Use this code and enjoy your lagging Game Over screens. And if any of you finds a way to improve on this code (i.e: getting it to NOT lag), be sure to post it so we all know!

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:29 pm
by Marina
wait people still use lunadll

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:31 pm
by RudeGuy
Shidomaru wrote:Now, this code has THREE weaknesses that I know of
Solution: learn lua and start writing lunadll things using that language

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:36 pm
by Shidomaru
Marina wrote:wait people still use lunadll
No :( Those aiming for vanilla episodes (everybody in this forum except for a few counted with the fingers of one hand) don't use it at all. The one guy who asked how to make a Game Over screen with LunaDLL apparently does. Thanks for ungratefully making fun of me after I struggled to find out this shit. :cry:
RudeGuy07 wrote:Solution: learn lua and start writing lunadll things using that language
NO! :x Having to learn a new programming language (Flash) is what killed my dream of programming videogames and the reason why I'm forced to use SMBX in the first place!

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:38 pm
by RudeGuy
Shidomaru wrote:NO! :x Having to learn a new programming language (Flash) is what killed my dream of programming videogames and the reason why I'm forced to use SMBX in the first place!
I don't know flash but I'm pretty sure Lua is easier than it (correct me if I'm wrong). Besides, Lua offers a lot more than lunadll, and it's also not that hard to understand.

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:39 pm
by Marina
Shidomaru wrote:
Marina wrote:wait people still use lunadll
No :( Those aiming for vanilla episodes (everybody in this forum except for a few counted with the fingers of one hand) don't use it at all. The one guy who asked how to make a Game Over screen with LunaDLL apparently does. Thanks for ungratefully making fun of me after I struggled to find out this shit. :cry:
Nono it's cool that you made this. It's just that everyone switched to LunaLua and few people use LunaDLL anymore..

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:42 pm
by XerX
Shidomaru wrote:
Marina wrote:wait people still use lunadll
No :( Those aiming for vanilla episodes (everybody in this forum except for a few counted with the fingers of one hand) don't use it at all. The one guy who asked how to make a Game Over screen with LunaDLL apparently does. Thanks for ungratefully making fun of me after I struggled to find out this shit. :cry:
RudeGuy07 wrote:Solution: learn lua and start writing lunadll things using that language
NO! :x Having to learn a new programming language (Flash) is what killed my dream of programming videogames and the reason why I'm forced to use SMBX in the first place!
Jumping right into Action Script is kinda risky without any prior knowledge. Learning to code is like literally learning a new language. You need to take baby steps.

Now regarding the script, it's pretty cool. Not too many people use the old script anymore. Also those who use LunaLua can still make vanilla episodes you know. ; )

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:47 pm
by Shidomaru
RudeGuy07 wrote:I don't know flash but I'm pretty sure Lua is easier than it (correct me if I'm wrong). Besides, Lua offers a lot more than lunadll, and it's also not that hard to understand.
I can't even program in Game Maker! :x Much less will I be able to use a program that has been used in professional videogame programming!
Marina wrote:Nono it's cool that you made this. It's just that everyone switched to LunaLua and few people use LunaDLL anymore..
It's NOT cool if it doesn't work in LunaLua! :x
XerX wrote:Jumping right into Action Script is kinda risky without any prior knowledge. Learning to code is like literally learning a new language. You need to take baby steps.

Now regarding the script, it's pretty cool. Not too many people use the old script anymore. Also those who use LunaLua can still make vanilla episodes you know. ; )
I didn't jump into ActionScript without prior knowledge: I had programmed in DIV2 Games Studio, a DOS tool that died with the arrival of Windows XP.

And as I told Marina, it's not cool if people can't use it because they're all using something entirely different now.

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:50 pm
by bossedit8
I do think LunaLua will work with LunaDLL since Lua is more complexful rather than DLL.

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:55 pm
by XerX
Ok that's nothing to get mad about really. There was a reason people moved to LunaLua, and that's because it's easier to use than the old script.

I did a search of DIV Games Studio and saw the script for it. It's not very different from Lua. Lua just has some different functions that you could easily learn from a quick google search, as well as using the Wiki for LunaLua : http://engine.wohlnet.ru/pgewiki/Category:LunaLua_API

And just because you learned one language doesn't mean you can immediately jump into another thinking you'll know enough. You need to look up that languages syntax and global functions. A lot of them are the same but some are different. Game Maker uses a lot of simple syntax that, again, you could learn if you did a google search or used their HowTo manual.

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 2:58 pm
by Mable
Dude no offense but you flip out by small things like this and it will make others see you as someone who easily rages out.

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 3:24 pm
by Shidomaru
Tinkerbell wrote:Dude no offense but you flip out by small things like this and it will make others see you as someone who easily rages out.
That is because I AM someone who easily rages out, even in real life.

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 3:27 pm
by RudeGuy
Shidomaru wrote:I can't even program in Game Maker! :x Much less will I be able to use a program that has been used in professional videogame programming!
Okay, so? Why exactly can't you learn LunaLua? It's not that hard after all.

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 3:34 pm
by FireyPaperMario
That's very helpful! Thanks! ^.^')

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 3:36 pm
by Shidomaru
RudeGuy07 wrote:Okay, so? Why exactly can't you learn LunaLua? It's not that hard after all.
Fine, I'll look into it.
NintendoOtaku93 wrote:That's very helpful! Thanks! ^.^')
You're welcome :)

Re: This is how you put a Game Over message with LunaDLL

Posted: Fri Sep 04, 2015 6:33 pm
by Imaynotbehere4long
Shidomaru wrote:
Marina wrote:Nono it's cool that you made this. It's just that everyone switched to LunaLua and few people use LunaDLL anymore..
It's NOT cool if it doesn't work in LunaLua! :x
Don't worry; LunaLua is backwards-compatible with LunaDLL scripts, so your code will work in LunaLua.

Re: This is how you put a Game Over message with LunaDLL

Posted: Sat Sep 05, 2015 8:34 am
by Shidomaru
Imaynotbehere4long wrote:Don't worry; LunaLua is backwards-compatible with LunaDLL scripts, so your code will work in LunaLua.
Well, that's a partial relief... Still, from what I could find out recently, LunaDLL seems to be VERY limited in comparison to LunaLua. Sooner or later I'm going to have to learn to use Lua.