I am trying to create a small fx when a player touches a trigger_hurt that is on a long wire, it's supposed to be an electric fence.
The trigger_hurt works ok, but what I wanted was to spawn some sparks where the player touches the wire and play a sound.
Can the trigger_hurt also be a script_obj and call a setthread?
This is what I have tried so far with not much success
Code: Select all
//------------------------
wire_fx:
//------------------------
while (1)
{
for ( local.i=1 ; local.i <= $player.size ; local.i++ )
{
if ( $player[local.i].dmteam != "spectator" )
{
if ( vector_length ( $player[local.i].origin - $elec_wire.origin ) < 40 )
{
local.org = ( vector_length ( $player[local.i].origin -$elec_wire.origin ) * .5 )
local.fx = spawn script_model model "emitters/electric_arc.tik" "origin" local.org
$player[local.i] playsound spark
wait 1
local.fx remove
}
}
}
waitframe
}
end