I tried Hidekis railgun cog, but it only works when the projectile hit a thing...
so i wrote my own. The problem is: mine only works sometimes...
here it is:
# Jedi Knight Missions Cog Script
#
# railgun
#
symbols
thing bullet local
thing dummy local
thing boom local
template shot=+rail2 local
template spooky=ghost local
vector pos local
vector dir local
vector ahead local
vector temp local
flex factor local
flex len local
message removed
end
#----------------------------------------------------------------------------
code
removed:
bullet = GetSenderRef();
pos = GetThingPos(bullet);
dir = GetThingVel(bullet);
len = VectorLen(dir) * 2;
factor = 1/len;
temp = VectorScale(dir, factor);
ahead = VectorAdd(pos, temp);
dummy = CreateThing(spooky, bullet);
SetThingPos(dummy, ahead);
boom = CreateThing(shot, dummy);
Sleep(1);
DestroyThing(dummy);
return;
#-------------------------------------------------------------------------------------------
end
the cog is linked to a normal projectile in static.jkl and the second projectile (the one fired in the cog) is the same without the cog linked (since i dont want to create an endless loop)...
[This message has been edited by zagibu (edited February 15, 2002).]
so i wrote my own. The problem is: mine only works sometimes...
here it is:
# Jedi Knight Missions Cog Script
#
# railgun
#
symbols
thing bullet local
thing dummy local
thing boom local
template shot=+rail2 local
template spooky=ghost local
vector pos local
vector dir local
vector ahead local
vector temp local
flex factor local
flex len local
message removed
end
#----------------------------------------------------------------------------
code
removed:
bullet = GetSenderRef();
pos = GetThingPos(bullet);
dir = GetThingVel(bullet);
len = VectorLen(dir) * 2;
factor = 1/len;
temp = VectorScale(dir, factor);
ahead = VectorAdd(pos, temp);
dummy = CreateThing(spooky, bullet);
SetThingPos(dummy, ahead);
boom = CreateThing(shot, dummy);
Sleep(1);
DestroyThing(dummy);
return;
#-------------------------------------------------------------------------------------------
end
the cog is linked to a normal projectile in static.jkl and the second projectile (the one fired in the cog) is the same without the cog linked (since i dont want to create an endless loop)...
[This message has been edited by zagibu (edited February 15, 2002).]
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)