Page 1 of 1

Lopsided

Posted: Sat Nov 06, 2021 11:56 am
by Hey Doomer
Another minimalist attempt to simulate damage. When the player receives damage > 9 (default), a random ChangeActorRoll is initiated for a time proportional to damage. This lopsided view, however brief, can be disorienting. In a heavy firefight it's possible to get slapped back and forth quite a bit, simulating losing balance and struggling to stay upright as the view leans this or that way.

ACS:

Code: Select all

#library "lopsided"
#include "zcommon.acs"

script "lopsided" (int damage)
{
    ChangeActorRoll(0, Random(0.1, 0.9), true);
    Delay(10 * damage);
    ChangeActorRoll(0, 1.0, true);
}
ZScript:

Code: Select all

class lopsided_EventHandler : EventHandler
{
	override
	void WorldThingDamaged(WorldEvent e)
	{
		if (e.thing && e.thing is "PlayerPawn" && e.Damage > CVar.FindCVar("lopsided_damage").GetInt())
		{
			e.thing.A_PlaySound("DSPLPAIN");
			e.thing.ACS_NamedExecute("lopsided", 0, e.Damage, 0, 0);
		}
	}
}
I assume Random(0.0, 0.9) would work also. Just not sure a roll of 0.0 does anything. Anyway, this has the effect of making combat a little more disorienting in close quarters, in turn more difficult to respond when shooting off balance. I haven't tested this with Revenants (mostly because Revenants). I'm not sure what damage limit would be needed to get punched off balance, but the cvar lopsided_damage changes this limit for the curious.