Lopsided

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Lopsided

Post 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.

Return to “Script Library”