Files
IL-GSC/BO1/PC/ZM/clientscripts/_sticky_grenade.csc
2024-02-18 17:32:07 -05:00

57 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include clientscripts\_utility;
main()
{
level._effect["grenade_enemy_light"] = loadfx( "weapon/crossbow/fx_trail_crossbow_blink_red_os" );
level._effect["grenade_friendly_light"] = loadfx( "weapon/crossbow/fx_trail_crossbow_blink_grn_os" );
level.zombie_sticky_grenade_spawned_func = ::spawned;
}
spawned( localClientNum, play_sound )
{
self endon( "entityshutdown" );
player = GetLocalPlayer( localClientNum );
enemy = false;
self.fxTagName = "tag_fx";
if ( self.team != player.team )
{
enemy = true;
}
if ( enemy )
{
if( play_sound )
{
self thread loop_local_sound( localClientNum, "wpn_semtex_alert", 0.3, level._effect["grenade_enemy_light"] );
}
else
{
PlayFXOnTag( localClientNum, level._effect["grenade_enemy_light"], self, self.fxTagName );
}
}
else
{
if( play_sound )
{
self thread loop_local_sound( localClientNum, "wpn_semtex_alert", 0.3, level._effect["grenade_friendly_light"] );
}
else
{
PlayFXOnTag( localClientNum, level._effect["grenade_friendly_light"], self, self.fxTagName );
}
}
}
loop_local_sound( localClientNum, alias, interval, fx )
{
self endon( "entityshutdown" );
while(1)
{
self PlaySound( localClientNum, alias );
PlayFXOnTag( localClientNum, fx, self, self.fxTagName );
wait(interval);
interval = (interval / 1.2);
if (interval < .1)
{
interval = .1;
}
}
}