REO-EE/_module/nss/gas_canister.nss
Jaysyn904 f82740bbbd Initial commit
Initial commit
2024-02-22 13:22:03 -05:00

39 lines
1.4 KiB
Plaintext

// Call this on the OnDeath event of gas canisters.
// When destroyed, gas canisters explode and deal damage to everyone within 5 meters, including PCs.
// Also lights targets on fire for a random amount of time.
#include "cbt_atk_inc"
void main()
{
object oSelf = OBJECT_SELF;
int iCount = 1;
object oTarget = GetNearestObject(OBJECT_TYPE_CREATURE, oSelf, iCount);
location lLocation = GetLocation(oSelf);
object oKiller = GetLastKiller();
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_IMPLOSION), lLocation);
while(GetIsObjectValid(oTarget))
{
float fDistance = GetDistanceBetweenLocations(GetLocation(oTarget), lLocation);
if(fDistance > 6.5 || fDistance == 0.0) break;
AssignCommand(oKiller, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(Random(10) + 5, DAMAGE_TYPE_FIRE), oTarget));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_INFERNO_CHEST), oTarget, 1.0);
int bCurrentlyOnFire = GetLocalInt(oTarget, "INCENDIARY_DAMAGE_COUNTER");
SetLocalInt(oTarget, "INCENDIARY_DAMAGE_COUNTER", Random(4) + 1);
if(!bCurrentlyOnFire)
DelayCommand(1.0, IncendiaryDamage(oTarget, Random(3) + 3));
// Fix the reputation - prevents zombies from bashing gas canisters
AdjustReputation(oSelf, oTarget, 100);
iCount++;
oTarget = GetNearestObject(OBJECT_TYPE_CREATURE, oSelf, iCount);
}
}