A couple character questions

Status
Not open for further replies.

Smash Corliss

~=Fighter=~
Not gonna go into my habit of posting once every 3-4 years this time, so let me just get straight to the point. There are two main things I'd like to know about character abilities.

1: Is it possible to give a character a Sonic 1 roll attack without being able to spin-charge? (and if possible, without spin-jumping as well?)

2: Exactly how does one go about giving a custom character a super form nowadays? I've only seen one character do it, and I assume there was some kind of hax involved non-standard roundabout way of getting it to work. This is probably a question I should direct to the creator of said character, however I'll take any answer I can get. I'm curious to know why this was restricted to begin with.


I was going to ask about custom abilities as well, but I should probably wait until I actually make an attempt at coding those before wasting anybody's time on that.
 
Last edited:
All of this is can be and has been done with Lua. Just read up about it on the Wiki or dissect a few character wads.
 
Just use Slade or something and read the Lua file. It's not that hard man. lol.
 
That's not really what I meant, although I admittedly made it sound worse than it is. The fact is I have done so before, and it worked but at the cost of breaking things slightly. (loading my wad alongside the original character wads breaks even more.)

So because of that, I feel it's more of a temporary solution until I can learn Lua properly.
 
If you want your character to not spincharge, be able to roll, and not make a spinjump (which is weird.), you can basically do something like that

Code:
addHook("ThinkFrame", do // Create a new Hook
	for player in players.iterate // For our player.
	if not player.mo return end // Don't continue if the player is a spectator.

	if (player.pflags & PF_JUMPED) // Is the player jumping?
	or player.speed == 0 // Or if the player is ready to spindash
	and player.mo.skin == "sonic" // Change the name if you want it to be for a specific character, or delete it if you want it for everyone.
		player.charability2 = CA2_NONE // Don't make him spin.
        else
                player.charability2 = CA2_SPINDASH // Let it spin if the conditions up there are not met.
		end // End the nonspin.
	end // End the "iteration"
end) // End the Hook.

Forgive mediocre Lua skill, but it's working anyway, just copypaste it into a LUA_xxxx lump.
EDIT: My bad, it didn't let them roll. Should work now.

EDIT2: As for super forms, I think just adding the SF_SUPER flag to the player should work, but I remember making a check for all emeralds, 50 rings, no shield and jump button pressed in the air to make Sylveon able to turn Super.
 
Last edited:

There's a slight problem with your code, Lat. When you press the spin button while on the ground, characters who can spindash will start charging one up if they're standing still or if they're moving very slowly, going into a roll otherwise. Since you only accounted for when the character is perfectly still, a sort of non-chargeable spindash action can still be achieved by inching forward from a standstill and then pressing the spin button.

Smash, here's a script that should do what you want:
Code:
//Check if a player mobj is not in some kind of special state and is ready to perform an action
local function P_PlayerActionCheck (mo)
    local player = mo.player
        if (mo.health) and (player) and (player.valid) then
            if not (player.pflags & PF_NIGHTSMODE)
            and not (player.pflags & PF_MACESPIN)
            and not (player.pflags & PF_ROPEHANG)
            and not (player.pflags & PF_ITEMHANG)
            and not (player.pflags & PF_SLIDING)
            and not (player.pflags & PF_CARRIED)
            and not (player.pflags & PF_STASIS)
            and not (player.pflags & PF_JUMPSTASIS)
            and not (player.exiting)
            and (player.powers[pw_nocontrol] == 0)
            and not ((mo.tracer) and (mo.tracer.type == MT_TUBEWAYPOINT))
            and not (P_PlayerInPain(player))
            and not ((mo.state >= S_PLAY_SUPERTRANS1) and (mo.state <= S_PLAY_SUPERTRANS9)) then
                return true
            else
                return false
            end
        end
    return false
end

//Check if a player mobj is ready to perform an action that involves pressing Spin
local function P_SpinActionCheck (mo)
    local player = mo.player
        if (mo.health) and (player) and (player.valid) then
            if (P_PlayerActionCheck(mo))
                and not ((P_IsObjectOnGround(mo) == false)
                and (((player.powers[pw_super] == 0) and (player.powers[pw_shield] == SH_JUMP))
                    or ((player.powers[pw_super]) and (player.charability == CA_FLY)))) then
                        return true
        else
            return false
        end
    end
    return false
end

//Extra character actions
addHook("ThinkFrame", do
    for player in players.iterate
         if (player.mo and player.mo.health) then
             //Sonic's actions
             if (player.mo.skin == "sonic") then
                 if (P_PlayerActionCheck(player.mo)) //If you're not hurt or disabled or anything
                 and (player.pflags & PF_JUMPED) //and you're jumping
                 and (player.panim != PA_ROLL) then //and you're not spinning
                     player.mo.state = S_PLAY_ATK1 //Start spinning, because otherwise you might not have a spinning jump animation
                 end
                 if ((P_IsObjectOnGround(player.mo)) //If you're on the ground
                     and (P_SpinActionCheck(player.mo)) //and you could start a spin(dash) if you wanted to
                     and (FixedHypot(player.rmomx, player.rmomy) > FixedMul(5*FRACUNIT, player.mo.scale))) //and you're moving fast enough to start spinning without going into a spindash
                 or (player.panim == PA_ROLL) then //...or you're spinning already
                     player.charability2 = CA2_SPINDASH //Spinning is permitted
                 else
                     player.charability2 = CA2_NONE //Spinning is not permitted
                 end
             end
         end
     end
end)
 
Oh great, thanks. That does work.
The reason I wanted that was so that I could give a character a sliding ability to make up for the lack of a spindash.
The only problem I have with this code is that it changes the jumping animation from the standard springing to the same as the sliding. (both of which are currently using PLAY\, which are the pain frames.)
I don't really have the sliding sprites ready but I'd like to keep the standard nospin-jumping animation.

Correct me if I'm wrong, but is it this part of the code that I should be looking at?

Code:
if (player.mo.skin == "sonic") then
                 if (P_PlayerActionCheck(player.mo)) //If you're not hurt or disabled or anything
                 and (player.pflags & PF_JUMPED) //and you're jumping
                 and (player.panim != PA_ROLL) then //and you're not spinning
                     player.mo.state = S_PLAY_ATK1 //Start spinning, because otherwise you might not have a spinning jump animation
                 end
 
Correct me if I'm wrong, but is it this part of the code that I should be looking at?

Code:
if (player.mo.skin == "sonic") then
                 if (P_PlayerActionCheck(player.mo)) //If you're not hurt or disabled or anything
                 and (player.pflags & PF_JUMPED) //and you're jumping
                 and (player.panim != PA_ROLL) then //and you're not spinning
                     player.mo.state = S_PLAY_ATK1 //Start spinning, because otherwise you might not have a spinning jump animation
                 end

Yes. Removing that code entirely will cause the character to use the non-spinning jump animation if they're moving slow and the spinning one if they're moving fast. If you want them to always use the non-spinning animation, replace "player.panim != PA_ROLL" with "player.panim == PA_ROLL" and "player.mo.state = S_PLAY_ATK1" with "player.mo.state = S_PLAY_SPRING." That way, instead of making you spin if you aren't spinning, the code will make you uncurl if you are spinning.
 
replace "player.mo.state = S_PLAY_ATK1" with "player.mo.state = S_PLAY_SPRING."

Glad I guessed this much correctly.
Thanks a bunch. It's all working perfectly. With that out of the way, spriting this character is all I really need to do.

I should probably stop being so vague and actually show where all this is going to.

ooGpd6N.png


Been working on this character for a while, but I have never been fully satisfied with her sprites. She's far too messy to show ingame right now, but perhaps when I'm done I'll release her here.

Really appreciate the help, you guys. I'll come back if I have any other questions!

EDIT: Ack, I forgot. Characters with the swimming ability can run on water. Is there a way to have swimming without running on water? I checked the list of flags and I saw SF_RUNONWATER, but to my understanding that does the opposite (allow people without the ability to swim to run on water.) Is there a specific way to turn this flag off?
 
Last edited:
EDIT: Ack, I forgot. Characters with the swimming ability can run on water. Is there a way to have swimming without running on water? I checked the list of flags and I saw SF_RUNONWATER, but to my understanding that does the opposite (allow people without the ability to swim to run on water.) Is there a specific way to turn this flag off?

I've tried myself, but didn't turn out well after testing. This is what I tried in-game just now:

Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if player.mo and not player.spectator
		and (player.charability == CA_SWIM)
			player.charflags = $1 & ~(SF_RUNONWATER)
		end
	end
end)

Everything turns out ok, no errors or anything, but it doesn't remove the flag, as SRB2 forces it on by default for swimmers (I think the same applies to super players, too), and cannot be removed through LUA, as I've tried here, so I don't think that's possible to do.
 
Everything turns out ok, no errors or anything, but it doesn't remove the flag, as SRB2 forces it on by default for swimmers (I think the same applies to super players, too), and cannot be removed through LUA, as I've tried here, so I don't think that's possible to do.

Hi, I'm Wolfy, aka the guy who implemented the SF_RUNONWATER flag!

The conditions to run on water are to either be super or have CA_SWIM as your character ability. Super characters and characters with CA_SWIM will not have SF_RUNONWATER on by default, since they already meet the conditions for enabling the behavior. Think of the flag as a way to force-enable it, even when the other conditions aren't met.
 
The conditions to run on water are to either be super or have CA_SWIM as your character ability. Super characters and characters with CA_SWIM will not have SF_RUNONWATER on by default, since they already meet the conditions for enabling the behavior. Think of the flag as a way to force-enable it, even when the other conditions aren't met.

So, if it's forced to on all of the time, is there any way do force-disable it via LUA, or can it not be done?
 
Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if (player.mo and player.mo.skin == "tails")
			if player.mo.eflags & MFE_UNDERWATER
				player.charability = CA_SWIM
			elseif player.charability == CA_SWIM
				player.charability = CA_NONE
			end
		end
	end
end)

Try this. im pretty sure it removes the run on water with swimming characters. with this you can give your character another ability when its outside the water
 
Last edited:
Thanks for this, but the problem with this code is that while it works, it causes you to stop swimming when you jump out of the water, and keeps you from swimming until you jump from solid ground again.
 
Status
Not open for further replies.

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

Back
Top