Luigikid Ex3 Challenge Demo Support

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

MarioChallengerX2
Buster Beetle
Buster Beetle
Posts: 89
Joined: Sat Dec 31, 2022 4:34 pm
Pronouns: he/him

Luigikid Ex3 Challenge Demo Support

Postby MarioChallengerX2 » Tue May 30, 2023 10:39 pm

So, after my quitting fiasco at MAFAB 3 along with burnout and stress, in 4 months, the deadline for the Luigikid Ex3 Challenge will arrive. (October 31)

With 4 months, I plan on representing the SMBX2 engine myself with this demo project. I love Luigikid's videos a lot, even though they can sometimes give me nightmares but that's my heart acting weak sometimes. Also, Mario EXE story games haven't been really good in regards to performance and feel, so I plan on also showing that a good Mario Exe story driven game can exist. (Similar to SoH style formula, but created in my own way)

Anyway, I just needed some support and knowledge from the community that will help me here, considering I'm a rookie but I'm getting there with some concepts.

Here we go.

#1. Custom cheat code: So, for an easter egg, I wanted to type Luigikid to change my character skin. Somewhat like a cheat code. Is it possible to register if the player types a specific word, code executes?

#2. A custom life system check:
So, in Sonic Exe SoH, you have a custom life system for separate character data. I wanted to implement that in SMBX. How in my case?
Well, I just want my level to be a hub level, you choose the data, and you enter a level as Luigi. Then, once you're in the game, you have like 10 deaths. If Luigi's death counter reaches 10, you go back to the hub, unable to choose him again. So like, the basic thing is to just make a death counter send you back to the hub. Additionally, eventually I would like a check for each player alive(determined by their death counters) Also, certain events in the game that set their death counter to the specific value and collecting 1ups decreases your death counter.

3. Progression without returning to hub. Like, if you beat a level as Luigi, you keep on going instead of returning to the hub. (i.e advance more levels) Sounds simple enough, right?

I think that's all for now, I'll see if I need anything else later on.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9877
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Luigikid Ex3 Challenge Demo Support

Postby Emral » Wed May 31, 2023 6:56 am

MarioChallengerX2 wrote:
Tue May 30, 2023 10:39 pm
#1. Custom cheat code: So, for an easter egg, I wanted to type Luigikid to change my character skin. Somewhat like a cheat code. Is it possible to register if the player types a specific word, code executes?
https://docs.codehaus.moe/#/reference/cheats

You can use Cheats.register to register a new cheat.
The file newcheats.lua contains definitions for all basegame cheats. The one most relevant to you, perhaps, being "dressmeup".
You can copy its code into your lua file, and change the onActivate function to set the costume to your desired costume using Player.setCostume.
MarioChallengerX2 wrote:
Tue May 30, 2023 10:39 pm
#2. A custom life system check:
So, in Sonic Exe SoH, you have a custom life system for separate character data. I wanted to implement that in SMBX. How in my case?
Well, I just want my level to be a hub level, you choose the data, and you enter a level as Luigi. Then, once you're in the game, you have like 10 deaths. If Luigi's death counter reaches 10, you go back to the hub, unable to choose him again. So like, the basic thing is to just make a death counter send you back to the hub. Additionally, eventually I would like a check for each player alive(determined by their death counters) Also, certain events in the game that set their death counter to the specific value and collecting 1ups decreases your death counter.
I don't quite know what you mean by "custom life system for separate character data".
Making a death counter is easy. You use GameData or SaveData (depending on if you want it to be saved across sessions). There you can make a number variable like SaveData.deathCounter, which goes up by 1 in the onPostPlayerKill event. Some other code can check SaveData.deathCounter >= 10 to make a character unavailable.
With regards to 1-ups, the best way I'd say right now to do this is to just keep track of changes in SMBX's own life counter.
An example:

Code: Select all

local defaultLives = mem(0x00B2C5AC, FIELD_FLOAT)

function onTickEnd()
	if mem(0x00B2C5AC, FIELD_FLOAT) > defaultLives then
		SaveData.deathCounter = SaveData.deathCounter - (mem(0x00B2C5AC, FIELD_FLOAT) - defaultLives)
		mem(0x00B2C5AC, FIELD_FLOAT, defaultLives)
	end
end
This example just checks if the lives counter increased and subtracts the difference from the death counter. You might want to add additional checks to prevent it from going below 0 and such.
MarioChallengerX2 wrote:
Tue May 30, 2023 10:39 pm
3. Progression without returning to hub. Like, if you beat a level as Luigi, you keep on going instead of returning to the hub. (i.e advance more levels) Sounds simple enough, right?
Just Level.load(filename)


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari