Lopsided

Post your example zscripts/ACS scripts/etc here.

Lopsided

Postby Hey Doomer » Sat Nov 06, 2021 11:56 am

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 allExpand view
#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 allExpand view
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.
You do not have the required permissions to view the files attached to this post.
Hey Doomer
 
Joined: 25 Sep 2021
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Return to Script Library

Who is online

Users browsing this forum: No registered users and 1 guest