Help getting my first character mod working

Status
Not open for further replies.

Wumbo

edited
Hello, I'm an SRB2 fan that's new to modding.

Recently, I finally got my first actual mod working, which is supposed to add a new character, Sonic with X-Treme sprites and double-jump. I used the wiki to try this, but instead of correctly adding the new character, it simply replaced Sonic's sprites with the X-Treme ones.

Luckily, all the colors worked right, and even though I didn't have the double-jump, I was still happy that I actually got it to work in the first place. But the bad part was that selecting the menu option for X-Treme Sonic would crash the game.

I tried renaming the PLAY in the names of all frames to SNCX because I thought they were replacing regular Sonic's sprites, and it seemed that that was the case. But, the game still crashed every time I selected X-Treme Sonic.

I also tried a more simple approach, where I would try to make it so the WAD was designed to replace Sonic's sprites, but when doing that, the game would crash right when the WAD loaded.

I can't remember how, but when testing my mod the first time, I did get X-Treme Sonic working. I believe I loaded the mod in Egg Rock Zone and went to Greenflower Zone. The only problem was that the colors were odd (I expected that), and I couldn't move. Nevertheless, double-jump was working, and by doing the spindash, I was able to move around a bit until I bumped into a wall, and had to spindash again. I have been unable to replicate this since then.

Since it seems like I can't post downloads in this section, I'll tell you some details about my mod:

-All sprites are named exactly like Sonic's, and follows the same placement.

-Frames that I couldn't replace (such as the Super Sonic and hanging frames) use their regular SRB2 counterparts as placeholders.

-The code for S-SKIN:

Code:
name = sonicxt
realname = XTSonic
hudname = XTSONIC
charsel = CHRXT
face = LIVXT
startcolor = 230
prefcolor = Blue
ability = CA_DOUBLEJUMP
ability2 = CA2_SPINDASH
actionspd = 48
normalspeed = 48
accelstart = 256
acceleration = 64

-The code for SOC_XT:

Code:
SRB2 version = 210

Character
PicName = CHRXT
SkinName = sonicxt
Status = 1
PlayerText = ^2X-Treme Sonic^0 has found his way back to SRB2 after being absent since the Halloween demo!

^2Ability:^0 Double Jump
Reach higher platforms by pressing the jump button two times.

^2Note:^0 X-Treme Sonic still uses a lot of placeholder sprites from regular Sonic that can't be replaced.
#

-I use S_START and S_END markers around Sonic's sprites, and GX_START and GX_END markers around the character select and life icons.

-The character icon is named CHRXT, and the life icon is named LIVXT. CHRXT comes before LIVXT.

-Both S_SKIN and SOC_XT are located inside the S_START and S_END markers. They are both at the top, although SOC_XT comes before S_SKIN.

-The offsets of all X-Treme sprites are X=32 and Y=48.

Here are some images of the WAD, including a GIF of me speedrunning through Greenflower Zone Act 1 with X-Treme sprites to give you an idea of how the mod looks.

zEyOvDO.png


ETqrQFh.png


euDtD9g.gif


So, here are my two questions:

-Is there a problem with how the WAD looks that's preventing the mod from working correctly?

-If I wanted to make this mod just replace Sonic's sprites with his X-Treme counterparts and not add them as a separate character, how would I do that?

Help would very much be appreciated. Thank you!
 
Since you seem to talk about the game crashing when using your character, I'm curious to know: what message, if any, do you get when the game crashes?

That said, I would say you can't normally replace an existing character's sprites, but Sonic's is a special case where his PLAYxxxx sprites are the default and are placed within S_START/S_END markers instead of after an S_SKIN (as you can see in player.dta if you load it up in SLADE; his actual skin data is hardcoded, unlike with Tails and Knuckles). So I guess just do the same thing?
 
Last edited:
Since you seem to talk about the game crashing when using your character, I'm curious to know: what message, if any, do you get when the game crashes?

That said, I would say you can't normally replace an existing character's sprites, but Sonic's is a special case where his PLAYxxxx sprites are the default and are placed within S_START/S_END markers instead of after an S_SKIN (as you can see in player.dta if you load it up in SLADE; his actual skin data is hardcoded, unlike with Tails and Knuckles). So I guess just do the same thing?
When my game crashes, it's on a black screen that says "Speeding off to... GREENFLOWER ZONE, Act 1", and shortly after, a "Program has stopped working" error comes up, but it disappears pretty quickly, and then a message comes up asking if I should close the program.

Also, I tried what you said, and right when the mod loads, the game crashes in the same way as I described above (minus the "Speeding off to..." part). If you want, I could message you the WAD file (I have it uploaded on my MEGA account) so you can take a look at it.
 
Wait, it freezes? that's pretty strange, huh.


Are all your sprites in "Graphic (Doom)" format when viewed in SLADE? I know it crashes when they're something like PNG, but I don't know if that would possibly cause freezing or not, hm.
 
Wait, it freezes? that's pretty strange, huh.


Are all your sprites in "Graphic (Doom)" format when viewed in SLADE? I know it crashes when they're something like PNG, but I don't know if that would possibly cause freezing or not, hm.
Yep, I've converted every single one into Doom format from 64x64 pixel PNG files with cyan backgrounds that came from the PackageX archive.

Maybe it's the size of the original picture that's making it act odd?
 
The size of the images definitely shouldn't cause any problems as far as I'm aware.

Perhaps you could send me a download to your WAD then? I'm kind of stumped now.
 
The size of the images definitely shouldn't cause any problems as far as I'm aware.

Perhaps you could send me a download to your WAD then? I'm kind of stumped now.
Okay, I've found the problem! I guess I did forget to convert a file - The LIVXT file was still in PNG form. Darn it, silly me! I'm really sorry for being too dumb to recognize this.

But now I have a different problem: What I said in the original post. The colors are odd and I can only move after spindashing, until I hit a wall.

Here's a picture:

e5qVODn.png


I was expecting the colors to be odd, but I wasn't expecting it to be so hard to move. I'm going to keep changing some things to see what the problem is, but maybe I made a mistake in S_SKIN?
 
Last edited:
But now I have a different problem: What I said in the original post. The colors are odd and I can only move after spindashing, until I hit a wall.

I was expecting the colors to be odd, but I wasn't expecting it to be so hard to move. I'm going to keep changing some things to see what the problem is, but maybe I made a mistake in S_SKIN?

The S_SKIN values in SRB2 are unsigned 8-bit numbers, so they range from 0 to 255. Your accelstart value of 256 is therefore too high, and the game is interpreting it as 0—that's why your character can't move.

Character skin colors, as I'm sure you've noticed, are defined by the startcolor and prefcolor values in the S_SKIN. Startcolor is the index value of the first of 16 colors to be remapped to the indeces specified by prefcolor. What's happening is, by setting startcolor to 230, you're telling the game to convert indices 230 - 245 to the blue skin color—the reason Sonic looks really light blue here is because 230 is one of the darker blue colors, but you're remapping it to the start of the blue skincolor, which is also light. If you can find out which index the lightest blue on your sprite is, use that value as the startcolor. I bet it's either 224 or 226.
 
The S_SKIN values in SRB2 are unsigned 8-bit numbers, so they range from 0 to 255. Your accelstart value of 256 is therefore too high, and the game is interpreting it as 0—that's why your character can't move.

Character skin colors, as I'm sure you've noticed, are defined by the startcolor and prefcolor values in the S_SKIN. Startcolor is the index value of the first of 16 colors to be remapped to the indeces specified by prefcolor. What's happening is, by setting startcolor to 230, you're telling the game to convert indices 230 - 245 to the blue skin color—the reason Sonic looks really light blue here is because 230 is one of the darker blue colors, but you're remapping it to the start of the blue skincolor, which is also light. If you can find out which index the lightest blue on your sprite is, use that value as the startcolor. I bet it's either 224 or 226.
Okay, I put it to 226 this time, and it worked! Thank you!

But then there's other problem... Movement.

As I said multiple times before, I think I messed up the stats a little bit in S_SKIN, so I can only move if I spindash, and then I'll be able to move freely until I stop moving, and then I'll have to do it again. Also, I want to make my stats the same as Sonic's, although since Sonic's S_SKIN file is hardcoded (I guess), I don't know his S_SKIN stats. Is there any way to see it, or should I just copy off of Tails' stats to give more of an X-Treme feel?

(Also, I'm sorry if my countless questions are getting annoying, I'm new to all of this...)

EDIT: I've tried using Tails' stats for the S_SKIN, and I guess it's working pretty good. I think I'll keep that.

Also, to both you and Monster Iestyn, thank you for helping me. If I do get to posting this in the Character Releases section, I'll make sure to mention you both.
 
Last edited:
The S_SKIN values in SRB2 are unsigned 8-bit numbers, so they range from 0 to 255. Your accelstart value of 256 is therefore too high, and the game is interpreting it as 0—that's why your character can't move.

I think you accidentally read over my solution to the movement problem! :)
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top