Auto-hold player`s controls via Luna Lua?

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
Just_Thomas
Snifit
Snifit
Posts: 233
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Auto-hold player`s controls via Luna Lua?

Postby Just_Thomas » Sat Dec 16, 2023 10:52 am

Hello,
how can you use "Auto-hold player`s controls" via scripting?
I would be surprised if this only works with classic events. I created a level where you "force slide down" a hill a the beginning to teach a new player, that this way enemies can be easily defeated. Works of course with the classic events very well.

But I would like to do it via scipting, since I feel like I could do a little more with it (however I am not any kind of expert there).
Sections "Player Keys constants" or "Player class" from the wiki did not bring me any further.
I can not test everything since sometimes I just do not get anything without a good example.
Custom scripts like the "Flagpole" from Murphmario's NPC Pack Version 1.3.1 were a little bit too complex for me, but it looks like, it only controlled the movement via frames (which is optical only).

So, if somebody can tell me, it would be nice.
Image

Just_Thomas
Snifit
Snifit
Posts: 233
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: Auto-hold player`s controls via Luna Lua?

Postby Just_Thomas » Tue Jan 16, 2024 9:19 am

Is this really not possible? Like I said, I could not find anything about that.
The most common example in the Mario games is the start of 1-2 oder 4-2 in the original SMB, where Mario moves right towards the pipe, before the level actually does begin.

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

Re: Auto-hold player`s controls via Luna Lua?

Postby Emral » Tue Jan 16, 2024 9:38 am

if you set player.keys.right = true in onTick, your player will walk to the right forever
you can ombine this concept with if statements to functionally create automatic player movement

Just_Thomas
Snifit
Snifit
Posts: 233
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: Auto-hold player`s controls via Luna Lua?

Postby Just_Thomas » Wed Jan 17, 2024 10:19 am

Yes, thank you, after some testing and with help of inputs2.locked[1].all I made it work. Code might look sloppy but well... it works for now.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari