Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → railgun
railgun
2002-02-15, 2:52 AM #1
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).]
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-02-15, 2:57 AM #2
oh yes, another problem in hidekis cog is that GetThingLVec is returning 0 for the z value, so the bullet only flies horizontally...

BTW: i also tried to create a reflection cog,
but it's hard to calculate it only with vectors...any idea about that maybe?

last thing: the touched message doesn't seem to return a wall...it only gets called when sender touched a thing. How do i get a reference on a wall hit by a projectile?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-02-15, 3:37 AM #3
i must add that you can actually see the projectile getting created behind the obstacle, but in most of the cases it is immediatly destroyed after creation...
any solutions?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

↑ Up to the top!