I created this cog to slow down enemies. The only thing it doesn't do is slow them down. It stays on for the right time, and then turns off. Why won't it work? Here it is:
# Jedi Knight Cog Script
#
# FORCE_SLOW.COG
#
#Slows down an enemy for a short period of time.
#Replaces Blinding
#
#
#
#[XXZ]
symbols
thing player local
thing victim local
int rank local
int active=0 local
sound slowsound=forceslow1.wav local
sound slowsound2=forceslow2.wav local
message startup
message activated
message pulse
message timer
message killed
message selected
end
# ========================================================================================
code
startup:
player=GetLocalPlayerThing();
call stop_power;
Return;
# ........................................................................................
activated:
if(active) Return;
rank=GetInv(player, 27);
victim=-1;
active=1;
SetInvActivated(player, 27, 1);
SetPulse(0.33);
SetTimer(rank * 5);
victim=FirstThingInView(player, 30 + 15 * rank, 8, 0x404);
SetActorExtraSpeed(victim, -.5 + rank / 2);
Return;
#-----------------------------------------------------------------------------------------
pulse:
if(GetThingHealth(victim)<=0)
{
call stop_power;
}
Return;
#-----------------------------------------------------------------------------------------
timer:
call stop_power;
Return;
#-----------------------------------------------------------------------------------------
selected:
jkPrintUNIString(player, 27);
Return;
#-----------------------------------------------------------------------------------------
killed:
call stop_power;
Return;
#-----------------------------------------------------------------------------------------
stop_power:
SetPulse(0);
SetActorExtraSpeed(victim, 0);
SetInvActivated(player, 27, 0);
active=0;
Return;
end
# Jedi Knight Cog Script
#
# FORCE_SLOW.COG
#
#Slows down an enemy for a short period of time.
#Replaces Blinding
#
#
#
#[XXZ]
symbols
thing player local
thing victim local
int rank local
int active=0 local
sound slowsound=forceslow1.wav local
sound slowsound2=forceslow2.wav local
message startup
message activated
message pulse
message timer
message killed
message selected
end
# ========================================================================================
code
startup:
player=GetLocalPlayerThing();
call stop_power;
Return;
# ........................................................................................
activated:
if(active) Return;
rank=GetInv(player, 27);
victim=-1;
active=1;
SetInvActivated(player, 27, 1);
SetPulse(0.33);
SetTimer(rank * 5);
victim=FirstThingInView(player, 30 + 15 * rank, 8, 0x404);
SetActorExtraSpeed(victim, -.5 + rank / 2);
Return;
#-----------------------------------------------------------------------------------------
pulse:
if(GetThingHealth(victim)<=0)
{
call stop_power;
}
Return;
#-----------------------------------------------------------------------------------------
timer:
call stop_power;
Return;
#-----------------------------------------------------------------------------------------
selected:
jkPrintUNIString(player, 27);
Return;
#-----------------------------------------------------------------------------------------
killed:
call stop_power;
Return;
#-----------------------------------------------------------------------------------------
stop_power:
SetPulse(0);
SetActorExtraSpeed(victim, 0);
SetInvActivated(player, 27, 0);
active=0;
Return;
end