SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Editing > Editing Help

Reply
 
Thread Tools Search this Thread
Old 3 Weeks Ago   #1
Wumbo
More seaweed medley, dear?
 
Wumbo's Avatar
Default Help getting my first character mod working

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.







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!
__________________
I wumbo, you wumbo, he, she, me... wumbo.
Wumbo is offline   Reply With Quote
Old 3 Weeks Ago   #2
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

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?
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record.

Last edited by Monster Iestyn; 3 Weeks Ago at 04:45 PM.
Monster Iestyn is offline   Reply With Quote
Old 3 Weeks Ago   #3
Wumbo
More seaweed medley, dear?
 
Wumbo's Avatar
Default

Quote:
Originally Posted by Monster Iestyn View Post
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.
__________________
I wumbo, you wumbo, he, she, me... wumbo.
Wumbo is offline   Reply With Quote
Old 3 Weeks Ago   #4
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

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.
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record.
Monster Iestyn is offline   Reply With Quote
Old 3 Weeks Ago   #5
Wumbo
More seaweed medley, dear?
 
Wumbo's Avatar
Default

Quote:
Originally Posted by Monster Iestyn View Post
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?
__________________
I wumbo, you wumbo, he, she, me... wumbo.
Wumbo is offline   Reply With Quote
Old 3 Weeks Ago   #6
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

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.
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record.
Monster Iestyn is offline   Reply With Quote
Old 3 Weeks Ago   #7
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

WAIT A MINUTE, what happens if you remove that "SRB2 version = 210" line?
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record.
Monster Iestyn is offline   Reply With Quote
Old 3 Weeks Ago   #8
Wumbo
More seaweed medley, dear?
 
Wumbo's Avatar
Default

Quote:
Originally Posted by Monster Iestyn View Post
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:



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?
__________________
I wumbo, you wumbo, he, she, me... wumbo.

Last edited by Wumbo; 3 Weeks Ago at 07:06 PM.
Wumbo is offline   Reply With Quote
Old 3 Weeks Ago   #9
Lach
Latch? Lock?? Lack???
 
Lach's Avatar
Default

Quote:
Originally Posted by Wumbo View Post
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.
Lach is offline   Reply With Quote
Old 2 Weeks Ago   #10
Wumbo
More seaweed medley, dear?
 
Wumbo's Avatar
Default

Quote:
Originally Posted by Lach View Post
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.
__________________
I wumbo, you wumbo, he, she, me... wumbo.

Last edited by Wumbo; 2 Weeks Ago at 08:50 PM.
Wumbo is offline   Reply With Quote
Old 2 Weeks Ago   #11
jameds
James
Default

If you want the S_SKIN properties for Sonic, see here http://git.magicalgirl.moe/STJr/SRB2...things.c#L2363.

On a side note, there's a lot of insight you can gain from reading the source code.
I find it to be a lot of fun.
jameds is offline   Reply With Quote
Old 2 Weeks Ago   #12
Lach
Latch? Lock?? Lack???
 
Lach's Avatar
Default

Quote:
Originally Posted by Lach View Post
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! :)
Lach is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:14 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.