SRB2 Message Board  

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

Reply
 
Thread Tools Search this Thread
Old 01-22-2018   #1
Wumbo
Uninteresting the Character
 
Wumbo's Avatar
Default Extra Frames for Character Animations

Hello again...

I made a thread a while back on how to get an X-Treme Sonic character WAD to work. Well, now I want to redo the entire WAD, but this time, with all frames. So, as you can guess, that will more than double the usual amount of frames for a character (I had to use an additional second prefix for the frames due to the large amount).

I have all the frames renamed, imported, ordered, and converted to use in the final WAD, if I ever complete it. I also have the S_SKIN and MAINCFG files all ready, which were imported from my old X-Treme Sonic WAD. So far, it'll actually work without crashing in the game, but as you can infer, all the sprites are being loaded for the wrong animations. I'm still an amateur at doing anything more than making simple character WADs and levels, so I'm not sure what to do. All I know is that it will probably require states and SOCs, and possibly some Lua (which I hope it won't require; I don't want to get into that, but I know I'll have to if I ever want to complete this WAD). So far, I think I have the states ready to use...? (Just look at the picture)

I've tried using the wiki, but it's just pretty confusing to me and doesn't seem to have anything specifically about adding extra frames to custom objects or characters. So what I'm asking is, what do I need to do to make these extra frames appear only for my character, at the right times, acting the right way? And does it require making states for every frame or using a Lua script? (Keep in mind that I don't want to add in any custom abilities, just a character with Tails-based stats and a double-jump)

Spoiler: Picture
__________________
I make abominations so you don't have to

My shameless WAD Vault
Wumbo is offline   Reply With Quote
Old 01-22-2018   #2
Petit The Hedge
2020 News: -SRB2.2 is out!-
 
Petit The Hedge's Avatar
Default

Um, i not completely sure,(because until now, i've not done this type of spriting) but i guess it has something related to:

Names,Order. For example, separating a frame name, from other. Have you done that yet?

---------- Post added at 11:26 PM ---------- Previous post was at 11:23 PM ----------

Wait, just checked the image, i can see you did. Ummm... i'm starting to guess this is related to LUA, never really did this before, as i said, but if i remember right, that's how the extra frames for F Sonic were made right?
__________________
SONIX 3 & KNUCKLEX&KNUCKLEZ 3DBLAST 5 COLORS ADVENTURE2 UNLEASHEDSTORM GENERATIONS WORLDS CLASH 15
Petit The Hedge is offline   Reply With Quote
Old 01-22-2018   #3
Lach
damn she thicc
 
Lach's Avatar
Default

Yes, it will require both SOC and Lua. I'll go over the process in its most basic form, and then if you have questions about dealing with specific animations, feel free to ask! The process might be a little complicated if you've never done any programming before. It's pretty long, so take it one step at a time and try to understand what it is you're actually doing before moving onto the next step. It'll make the process a lot easier in the long run.

Spoiler: Very long tutorial
Idle and waiting animations will probably be the easiest to set up, so I'll cover those in this post. I can see that you've set up the freeslots for them already. Have you defined each of the states yet? Follow this tutorial if you haven't. (You can ignore the "Called states" part—that's specific to object creation. Skip straight to the "Attributes" part. The sections afterwards detail how to actually set up the state, which can be done in SOC or Lua, whichever you prefer.) You'll more than likely want to set your states' NEXTSTATE values so that they create an animation loop (e.g. I assume S_XTWAIT4 loops back into S_XTWAIT1). (Also check out the "States - MT_PLAYER" table at the bottom of this page for cool and handy information, as well as a good reference for estimating how long your custom state durations might be.)

Once you've set those up, you'll need to use Lua to tell the game when to use each animation and when not to. While you've already mentioned that you're not adding any custom abilities (though I bet you will want to once you are fluent with this!), it's set up the same way, so please take a thorough read-through of this tutorial (at the very least the first section).

Now that you have your ThinkFrame set up, it's time to start modifying the player's states! Let's start with your idle animation, which I am going to assume replaces S_PLAY_STND. All you'll need to do is check when the player's state is S_PLAY_STND, and if so, set it to S_XTIDLE1. This is actually super easy. Just stick this code in under the skin check in your ThinkFrame:
Code:
if player.mo.state == S_PLAY_STND
    player.mo.state = S_XTIDLE1
end
This will, assuming you've done everything correctly, put Sonic in the new idle animation you've set up in the SOC whenever he's caught standing around. You can test the wad out at this point if you like! However, you'll probably quickly notice that he'll stay in this animation when he starts moving. Not to worry! We'll deal with this after we set up the waiting animation.

The waiting animation can usually be replaced by checking to see if the player's state is S_PLAY_TAP1 and setting it to S_XTWAIT1, but the catch is that you have a custom standing animation now, so Sonic will never reach S_PLAY_TAP1 anymore. That means we'll have to set up a timer. (Ooh, aah.) Just like player.mo.skin or player.mo.state, you can make your own variables, such as player.mo.xttimer, or player.mo.poopface, or player.mo.aaaaaaaa - name it whatever you want! Basically, when the player is set to S_XTIDLE1, we're going to set the timer to a certain amount of time, and then as long as the player is in those idle states, count down until it reaches 0. Here's an example of how you might set that up using the code we've already established:
Code:
if player.mo.state == S_PLAY_STND
    player.mo.state = S_XTIDLE1
    player.mo.xttimer = 140
end

if player.mo.state >= S_XTIDLE1 and player.mo.state <= S_XTIDLE8
    if player.mo.xttimer > 0
        player.mo.xttimer = player.mo.xttimer - 1
    else
        player.mo.state = S_XTWAIT1
    end
end
For reference, I set the timer to 140 because there are 35 tics in one second, so the timer will last 4 seconds here. You can change the number to whatever you like. You should be able to test out the waiting animation at this point if you wish!

Now, let's get the player out of these animations when Sonic starts moving. All we have to do is detect when the player has speed while in the idle or waiting animations, and put them into the walking states. Thankfully, we already have a variable set up for us that gives us the player's speed. Just add this code in below what we just did:
Code:
if player.mo.state >= S_XTIDLE1 and player.mo.state <= S_XTWAIT4 and player.speed > 0
    player.mo.state = S_XTRUN1
end
You'll now notice that Sonic won't go back into his standing animations once he stops walking. To fix this all you'll have to do is check for when Sonic is in his walking states and has no speed. With all the information I've just given you, that shouldn't be hard to work out. ;)

Good luck!
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 07:49 PM.


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