Things I've learned about STR_WALL and STR_FLOOR

PikaJade

Member
I've been working on a character on and off for a few weeks now while learning Lua in the process (a great sounding idea, I know), and part of that character is an attack with some specific properties. The attack comes in three phases: the windup, the attack itself, and the end lag. During the windup phase, the character can break floors below himself, and during the end lag phase, he can break walls in front of him. After a bit of research, I concluded that the best way to go about that was with the pw_strong power.

If you don't know what that means, this post probably isn't for you anyway, but just in case:
Powers are states that players can be in, including powerups, ways that they're being affected by their environment, what the ability they're using does, and so on. pw_strong is one of those powers, and focuses on that last point: what the ability they're currently using does. You can set it to hurt enemies from all manner of sides of the player, break through spikes, power up springs, and, most importantly for this post, break through fragile walls and floors - as well as fragile ceilings, apparently, though I have yet to see any of those in my time playing SRB2.

When I implemented said powers, they weren't working, and I didn't know why. As it turns out, it was because both of those values only work under specific conditions. Firstly, the more simple one, STR_FLOOR. For that to work, the player just needs to have been in the air for at least one (maybe two? I'm not entirely sure) tick before touching the floor you're trying to break. Just pop the player up 2 units (not fracunits) into the air, force a momz of -1 for a tick or two, and you'll be able to bust through the same floors you're standing on seamlessly.

STR_WALL is slightly more complicated, but not that much. It has two conditions that you have to meet. Firstly, the player has to be moving more than 1/100 fracunit per tick. Secondly, there has to be at least the slightest amount of movement input in the direction the player is moving. Just set a thrust of 656 in the direction of the wall for a frame and set the ticcmd's forwardmove and/or sidemove to 1 or -1 as needed, and lo and behold, the wall is gone without you having (seemingly) moved an inch.

I'm not sure if any of this is common knowledge, but I just found out today, and I figured I'd share it in a more permanent place than The App Where Good Information Goes to Die (Discord). Feel free to correct me if I'm wrong in any way.
 
Last edited:

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

Back
Top