Code:
# Jedi Knight Cog Script
#
# FORCE_LIGHTNING.COG
#
# FORCEPOWER Script - Lightning
# Dark Side Power
# Bin 32
#
# [YB]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
thing player local
flex cost=40.0 local
int rank local
int mana local
int bin local
template auraflare=+dest_cloud local
template ball=+force_ltpeice local'
model round=sphere2.3do local
model long=aura.3do local
template ring=+conccloud local
template blast=+Force_repel local
template flash=+ssparks_saber local
sound fireSound=ForceLitning02.wav local
int fireChannel=-1 local
int modeTrack=-1 local
sound transform=transform.wav local
flex autoAimFOV=45 local
message startup
message activated
message deactivated
message fire
message killed
message selected
message pulse
message timer
end
# ========================================================================================
code
startup:
player = GetLocalPlayerThing();
aura=0;
Return;
activated:
ringcount=0;
if(aura == 0)
{
aura=1;
setpulse(0.01);
setinvactivated(player, 21, 1);
if(getinv(player, 14) >= 2)
{
randa=rand()*2;
randb=rand()*2;
if(randa < 1)
{
FireProjectile(player, flash, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 0.0, 0.0);
}
randb=rand()*2;
if(randb < 1)
{
FireProjectile(player, blast, -1, -1, '0 0 0', '0 0 0', 1.0, 0, 0.0, 0.0);
}
}
}
else
if(aura == 1)
{
aura=0;
call stop_power;
}
Return;
selected:
jkPrintUNIString(player, 32);
Return;
deactivated:
bin = GetSenderRef();
DeactivateBin(player, bin);
Return;
# ........................................................................................
killed:
if(GetSenderRef() != player) Return;
call stop_power;
Return;
# ........................................................................................
stop_power:
setinv(player, 63, 1);
setinvactivated(player, 21, 0);
setpulse(0);
if(getinvactive(player, 22) != 1)
{
setactorextraspeed(player, 0);
}
Return;
pulse:
player=getlocalplayerthing();
if(getthinghealth(player) > 0)
{
if(getinv(player, 14) >=2)
{
if(getinvactive(player, 22) != 1)
{
setactorextraspeed(player, 2);
}
else
{
return;
}
setinv(player, 63, 2);
changeinv(player, 14, -0.5);
thrust=getthingthrust(player);
if(vectorx(thrust) == 0 && vectory(thrust) == 0 && vectorz(thrust) == 0)
{
projectile=FireProjectile(player, ball, -1, -1, '0 0 0', '0, 0, 0', 1.0, 0, 0.0, 0.0);
setthingmodel(projectile, round);
}
else
{
if(isthingmoving(player) > 0)
{
projectile=FireProjectile(player, ball, -1, -1, '0 0 0', '0, 0, 0', 1.0, 0, 0.0, 0.0);
setthingmodel(projectile, long);
call align;
}
}
setlifeleft(projectile, 0.01);
if(getattachflags(player) == 0x1)
{
ringcount=ringcount+1;
if(ringcount == 10)
{
ringcount=0;
creatething(ring, player);
}
}
}
else
{
call stop_power;
}
}
return;
align:
player=getlocalplayerthing();
SetThingLook(projectile,VectorSub(GetThingPos(player), GetThingPos(projectile)));
return;
endThis is a cog for a ki boost mode/ssj mode for my dragon ball Z mod.
It's quite l33t so far, except for the aura.
Here's what I'm trying to accomplish:
You notice that the projectiles have an 0.01 lifespan, just like the pulse.
The idea is that when the player is not moving or trying to move, it fires one aura 3do.
When the player is moving, it fires a different aura 3do, with a ki trail, and makes it point at him.
The problem is that, for whatever reason, the projectile disappears. I traced the problem down to setthinglook() in align: and I don't know what else to do, so I'll ask you guys.
