Need help optimizing ACS that stops player's momentum
Posted: Thu Sep 21, 2017 5:11 am
I wanted to make a simple ACS that would remove the player's momentum as soon as they stop pressing movement keys. (To remove Doom's annoying "sliding" behavior and make real jump puzzles possible). For now it looks something like this:
First, since I'm not great with ACS, I'm pretty sure I added lots of unnecessary stuff. Like, I'm pretty sure the if/else statements can be replaced with while, but I'm not entirely sure about how to reverse the condition properly.
Second, if I step off a cliff and stop pressing any buttons, the script will create hiccups where I stop falling repeatedly then go on. I'd like this thing to not affect Z movement at all.
Third, I'm not sure I need all those delays.
Code: Select all
Script "Movestop" Enter
{
int buttons;
buttons = GetPlayerInput(-1, INPUT_BUTTONS);
if (buttons & BT_FORWARD || buttons & BT_BACK || buttons & BT_MOVELEFT || buttons & BT_MOVERIGHT)
{
delay(5);
restart;
}
else
{
delay(5);
Thing_Stop(0);
}
restart;
}
Second, if I step off a cliff and stop pressing any buttons, the script will create hiccups where I stop falling repeatedly then go on. I'd like this thing to not affect Z movement at all.
Third, I'm not sure I need all those delays.