[Solved] Force the player to take a status

Description: Internal scripting system of SMBX-38A Engine based on the simple VB-like language
Moderators: Lx Xzit, Yoshi021, 5438A38A, Semi-moderatos, Moderators

Super Mario Player M
Topic author, Duke
Duke
Avatar
Super Mario Player M
Topic author, Duke
Duke
Age: 21
Reputation: 29
Posts: 141
Joined: 23 Jun 2016
Location: Planet Earth
Youtube channel URL Tencent QQ

Post #1by Super Mario Player » 5 Jul 2016, 13:16

I wanna assign a value to Char(1).Status to force the player to have a certain power-up, is there a way to do it? Or if not, is there a way to force the player to be Super Mario, for example? That's because I'm working on a script for a SMB3 power-up system but the only method I found so far was to create a mushroom at the player's position, so they become Super Mario instead of Small Mario; but the problem is, sometimes the player doesn't grab the mushroom, and some other times the mushroom goes in their item box.
Thanks in advance!
Last edited by Super Mario Player on 17 Aug 2016, 12:31, edited 1 time in total.
My current project:
Spoiler
The Tower of Challenges

Languages (for PMs):

Image

YouTube channel:
Image
Image

rotom407 M
Nice citizen
Nice citizen
rotom407 M
Nice citizen
Nice citizen
Age: 25
Reputation: 0
Posts: 15
Joined: 28 Jun 2016

Post #2by rotom407 » 5 Jul 2016, 14:01

When players get hurt, there is an animation shown (switching between states), which causes Char(1).Status switching between two values quickly.
Therefore, the following script trying to lock the player's state won't work.
(executes when the player gets hurt)

Code: Select all

Char(1).Status=2

This one works because it sets Char(1).Status to 2 continuously and lasts longer than that animation. (requires a variable)
(executes when the player gets hurt)

Code: Select all

v(a)=0
Do
Char(1).Status=2
call sleep(1)
v(a)=v(a)+1
Loop Until v(a)>20

kitkat F
Marquis
Marquis
Avatar
kitkat F
Marquis
Marquis
Age: 18
Reputation: 28
Posts: 191
Joined: 15 May 2016
Location: Mementos

Post #3by kitkat » 5 Jul 2016, 16:11

It doesn't work when I tried it... it just puts me at Mario. :comando:

rotom407 M
Nice citizen
Nice citizen
rotom407 M
Nice citizen
Nice citizen
Age: 25
Reputation: 0
Posts: 15
Joined: 28 Jun 2016

Post #4by rotom407 » 5 Jul 2016, 16:52

DaveDaCat101 wrote:It doesn't work when I tried it... it just puts me at Mario. :comando:
This is what the script meant to do. It lacks something to be a complete SMB3 power-up system. :)

kitkat F
Marquis
Marquis
Avatar
kitkat F
Marquis
Marquis
Age: 18
Reputation: 28
Posts: 191
Joined: 15 May 2016
Location: Mementos

Post #5by kitkat » 5 Jul 2016, 17:01

rotom407 wrote:
DaveDaCat101 wrote:It doesn't work when I tried it... it just puts me at Mario. :comando:
This is what the script meant to do. It lacks something to be a complete SMB3 power-up system. :)
I don't get it...

Super Mario Player M
Topic author, Duke
Duke
Avatar
Super Mario Player M
Topic author, Duke
Duke
Age: 21
Reputation: 29
Posts: 141
Joined: 23 Jun 2016
Location: Planet Earth
Youtube channel URL Tencent QQ

Post #6by Super Mario Player » 6 Jul 2016, 18:56

rotom407 wrote:When players get hurt, there is an animation shown (switching between states), which causes Char(1).Status switching between two values quickly.
Therefore, the following script trying to lock the player's state won't work.
(executes when the player gets hurt)

Code: Select all

Char(1).Status=2

This one works because it sets Char(1).Status to 2 continuously and lasts longer than that animation. (requires a variable)
(executes when the player gets hurt)

Code: Select all

v(a)=0
Do
Char(1).Status=2
call sleep(1)
v(a)=v(a)+1
Loop Until v(a)>20
It worked for me! Thanks :good:
Here's the level I used to test it:
smb3_powerup(2).zip
(20.9 KiB) Downloaded 198 times
My current project:
Spoiler
The Tower of Challenges

Languages (for PMs):

Image

YouTube channel:
Image
Image

kitkat F
Marquis
Marquis
Avatar
kitkat F
Marquis
Marquis
Age: 18
Reputation: 28
Posts: 191
Joined: 15 May 2016
Location: Mementos

Post #7by kitkat » 6 Jul 2016, 20:20

How do you make it work with other power-ups (such as propeller suit)?

Pilzinsel64
Count
Count
Pilzinsel64
Count
Count
Reputation: 42
Posts: 226
Joined: 24 Jan 2016

Post #8by Pilzinsel64 » 6 Jul 2016, 21:28

DaveDaCat101 wrote:How do you make it work with other power-ups (such as propeller suit)?

Mario: Status = 1
Super-Mario: Status = 2
All other modes (like propeller suit or hammer suit): Status > 2

So, if the player hurts (the Status changes to 1 (Mario)) while the Status is bigger then 2, then it changes the 1 (Mario) to 2 (Super-Mario).

Super Mario Player M
Topic author, Duke
Duke
Avatar
Super Mario Player M
Topic author, Duke
Duke
Age: 21
Reputation: 29
Posts: 141
Joined: 23 Jun 2016
Location: Planet Earth
Youtube channel URL Tencent QQ

Post #9by Super Mario Player » 6 Jul 2016, 23:21

Pilzinsel64 wrote:
DaveDaCat101 wrote:How do you make it work with other power-ups (such as propeller suit)?

Mario: Status = 1
Super-Mario: Status = 2
All other modes (like propeller suit or hammer suit): Status > 2

So, if the player hurts (the Status changes to 1 (Mario)) while the Status is bigger then 2, then it changes the 1 (Mario) to 2 (Super-Mario).
There is an exception for Status = 11 which corresponds to Mini-Mario, since in that form, getting hit kills the player instantly.
Here's the script I used:
if val(form) > 2 and val(form) <> 11 then
v(a)=0
Do
Char(1).Status=2
call sleep(1)
v(a)=v(a)+1
Loop Until v(a)>20
end if
Where val(form) is set to be equal to Char(1).Status. I used it for debug purposes as I didn't notice that the value of Char(1).Status was equal to the # of the sprites in the Mario graphics folder
My current project:
Spoiler
The Tower of Challenges

Languages (for PMs):

Image

YouTube channel:
Image
Image


Return to “TeaScript”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest