I appretiate it if somebody could modify this so there is a 5 second pause in between shots of this cog. What I mean is just to put a verb in there so people can't keep tapping the button. They can do it once. And then have to wait 5 seconds to do it again. THANKS!
Code:
# Jedi Knight Cog Script
#
# FORCE_BLINDING.COG
#
# FORCEPOWER Script - A powerful force push.
# Bin 31 or 27
#
# (C) 2001 LordXT_IJ
# LucasArts Entertainment Company doesn't support this in any way.
symbols
thing player local
thing victim local
thing potential local
flex mana local
flex cost=50.0 local
flex delay=400.0 local
int rank local
int count local
int retval=0 local
int dummy local
flex dot local
flex maxDot local
sound blindingSound=forcethrow01.wav local
template cone_tpl=+force_blind local
int active=0 local
message startup
message activated
message deactivated
message pulse
message timer
message newplayer
message killed
message deselected
message selected
# ........................................................................................
# External animations
keyframe push=kyfpull0.key local
end
# ========================================================================================
code
startup:
player = GetlocalPlayerThing();
Return;
# ........................................................................................
activated:
if(active) Return;
mana = GetInv(player, 14);
rank = GetInv(player, 24);
if(mana >= cost)
{
victim = -1;
active = 1;
SetInvActivated(player, 27, 1);
SetPulse(0.33);
}
Return;
# ........................................................................................
pulse:
// Check all things for our victim.
victim = -1;
maxDot = 0;
// Search for all players and actors.
potential = FirstThingInView(player, 30 + 15 * rank, 8, 0x404);
while(potential != -1)
{
if(
HasLOS(player, potential) &&
(potential != player) &&
(VectorDist(GetThingPos(player), GetThingPos(potential)) <= (1 + rank)) &&
!(GetThingFlags(potential) & 0x200) &&
!(GetActorFlags(potential) & 0x100) &&
!((jkGetFlags(potential) & 0x20) && !IsInvActivated(player, 23))
)
{
dot = ThingViewDot(player, potential);
if(dot > maxDot)
{
victim = potential;
maxDot = dot;
}
}
potential = NextThingInView();
}
// If we have a victim...
if(victim != -1)
{
jkSetTargetColors(1, 2, 3);
jkSetTarget(victim);
}
else
{
jkEndTarget();
}
Return;
# ........................................................................................
deactivated:
if((victim == -1) || (GetThingHealth(player) <= 0))
{
call stop_power;
Return;
}
SetPulse(0);
jkEndTarget();
mana = GetInv(player, 14);
if(mana >= cost)
{
if(GetInv(player, 65) != 1) ChangeInv(player, 14, -cost);
SetBinWait(player, 27, 0.2);
rank = GetInv(player, 27);
SetTimer(delay);
if(HasLOS(player, victim) && (victim != player))
{
PlayMode(player, 24);
PlayKey(player, push, 1, 0x38);
PlaySoundThing(blindingSound, player, 1.0, -1, -1, 0x80);
SendTrigger(-1, 270, player, randVec, 0, 0);
DetachThing(victim);
ApplyForce(victim, VectorScale(VectorNorm(VectorSub(GetThingPos(victim),GetThingPos(player))), 150 * rank));
}
}
active = 0;
SetInvActivated(player, 27, 0);
Return;
# ........................................................................................
timer:
// This checks that the thing ref is still assigned to the same thing
// (remember he could have died and its refrence reassigned to a generated thing)
Return;
# ........................................................................................
selected:
jkPrintUNIString(player, 27);
Return;
# ........................................................................................
deselected:
call stop_power;
Return;
# ........................................................................................
killed:
if(GetSenderRef() != player) Return;
newplayer:
call stop_power;
Return;
# ........................................................................................
stop_power:
SetPulse(0);
SetInvActivated(player, 27, 0);
active = 0;
jkEndTarget();
Return;
end
Ohh Crap! - Darien Fawkes (The Invisible Man)
).![http://forums.massassi.net/html/smile.gif [http://forums.massassi.net/html/smile.gif]](http://forums.massassi.net/html/smile.gif)
![http://forums.massassi.net/html/biggrin.gif [http://forums.massassi.net/html/biggrin.gif]](http://forums.massassi.net/html/biggrin.gif)