Forcing A Costume Onto The Player At The Start

Need help with any SMBX game-related issues? Ask your questions here.

Moderator: Userbase Moderators

Alby
Koopa
Koopa
Posts: 15
Joined: Fri Jun 12, 2015 11:36 pm

Forcing A Costume Onto The Player At The Start

Postby Alby » Mon May 11, 2020 8:49 am

I'm making a game centered around Toadette as the main character. I wanted her to be able to use the swimming animation, so I'm using SpoonyBardOL's costume for her. What I want to know is if there's a way to start the player using the costume by default instead of having to use the Spade Block to cycle through them as Toad. Can anyone share if there's a way? :3

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

Re: Forcing A Costume Onto The Player At The Start

Postby Emral » Mon May 11, 2020 8:59 am

https://docs.google.com/document/d/1uOd ... a90y9ieh5u
In this code section right here is a setCostume function for the player. The name is the name of the folder in the costumes folder.
Of course if you never switch away from Toadette and don't wanna put it into the costume folder you can just overwrite the default toad sprites for your episode by placing the contents of the costume folder in your episode folder. If there's a costume.lua, you might wanna call its onInit, too.

Alby
Koopa
Koopa
Posts: 15
Joined: Fri Jun 12, 2015 11:36 pm

Re: Forcing A Costume Onto The Player At The Start

Postby Alby » Mon May 11, 2020 9:23 am

Thank you so much, it worked perfectly! :3

Added in 4 hours 15 minutes 59 seconds:
Alby wrote:
Mon May 11, 2020 9:23 am
Thank you so much, it worked perfectly! :3
A correction. Since I opened the project back up, the game still forces the player into Toad first. Is there something I'm missing with the script?
Image

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

Re: Forcing A Costume Onto The Player At The Start

Postby Emral » Mon May 11, 2020 2:11 pm

strings need to be in "quotation marks" to be recognized as such by the program

Alby
Koopa
Koopa
Posts: 15
Joined: Fri Jun 12, 2015 11:36 pm

Re: Forcing A Costume Onto The Player At The Start

Postby Alby » Tue May 12, 2020 12:02 am

I'm still just not... understanding, I guess? I've put it in quotation marks in every way I could, and it still starts me as Toad instead of Toadette. :/

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

Re: Forcing A Costume Onto The Player At The Start

Postby Emral » Tue May 12, 2020 12:51 am

Is the costume in the data/costumes/toad folder? If it's in your episode folder, try one of my other suggestions, such as just dumping the contents of the costume into your episode folder.

Alby
Koopa
Koopa
Posts: 15
Joined: Fri Jun 12, 2015 11:36 pm

Re: Forcing A Costume Onto The Player At The Start

Postby Alby » Tue May 12, 2020 7:06 am

Yeah, I'm just gonna dump it into the episode folder. It does have a Costume.lua file, though. Could you tell me how I call on the onlnit?

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

Re: Forcing A Costume Onto The Player At The Start

Postby Emral » Tue May 12, 2020 7:22 am

Alby wrote:
Tue May 12, 2020 7:06 am
Yeah, I'm just gonna dump it into the episode folder. It does have a Costume.lua file, though. Could you tell me how I call on the onlnit?
This post should answer what you're looking for. Make sure to use CHARACTER_TOAD instead of CHARACTER_MARIO, and you should be good to go!
viewtopic.php?p=371055#p371055

Alby
Koopa
Koopa
Posts: 15
Joined: Fri Jun 12, 2015 11:36 pm

Re: Forcing A Costume Onto The Player At The Start

Postby Alby » Tue May 12, 2020 8:09 am

Okay, so I followed the directions, I think? And I got this as a result... D:
Image

Image

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

Re: Forcing A Costume Onto The Player At The Start

Postby Emral » Tue May 12, 2020 8:16 am

If you used a program different to notepad for scripting it would show you the issue more clearly. -- in lua means a comment, so the line is not interpreted as code. Remove the -- before loading the costume file in the line above onStart.

Alby
Koopa
Koopa
Posts: 15
Joined: Fri Jun 12, 2015 11:36 pm

Re: Forcing A Costume Onto The Player At The Start

Postby Alby » Tue May 12, 2020 8:26 am

Yeah, I probably should get a different program... Now I'm getting this message, though. TT_TT
Image

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

Re: Forcing A Costume Onto The Player At The Start

Postby Emral » Tue May 12, 2020 8:38 am

Alby wrote:
Tue May 12, 2020 8:26 am
Yeah, I probably should get a different program... Now I'm getting this message, though. TT_TT
Image
This reads that it couldn't find a lua file called "Toadette"... You could either rename costume.lua to Toadette.lua, or return the line to what it said previously (requiring a file called "costume").

Alby
Koopa
Koopa
Posts: 15
Joined: Fri Jun 12, 2015 11:36 pm

Re: Forcing A Costume Onto The Player At The Start

Postby Alby » Tue May 12, 2020 8:49 am

Ooooooh... Dang, that was my bad. I'm sorry for all this. Everything seems to work fine now, except for this when I close the test window.
Image

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

Re: Forcing A Costume Onto The Player At The Start

Postby Emral » Tue May 12, 2020 9:09 am

This means you have multiple onStarts. There can only be one. Merge them if you need both.

Alby
Koopa
Koopa
Posts: 15
Joined: Fri Jun 12, 2015 11:36 pm

Re: Forcing A Costume Onto The Player At The Start

Postby Alby » Tue May 12, 2020 9:12 am

Okay! Everything is perfect now! Thank you so much for putting up with my constant questions. I really appreciate it.


Return to “Help and Support”

Who is online

Users browsing this forum: Ahrefs [Bot] and 6 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari