View Full Version : Making a projectile move forward and up.
Stormtrooper
05-07-2003, 02:01 PM
I'm working on a weapon for my current project and I can't figure out how to make the projectile move up and it moves forward. The projectile only lasts about a half a second so it has to move up quickly. If you don't understand what I mean, just ask and I'll draw a picture of it.
------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
DSLS_DeathSythe
05-07-2003, 05:46 PM
FireProjectile(fire_thing, template, sound, submode, offset_vec, error_vec, extra_flex, proj_flags, AA_FOVX, AA_FOVZ);
just change the 'error_vec' like this.
'45.0, 0.0, 0.0'
change the 45.0 to what ever you need it to be. that will make the player fire the projectile forward and up at the angle you want.
------------------
Famous last words - "It seemed like a good idea at the time."
Stormtrooper
05-07-2003, 08:07 PM
I never thought of that, but that would make it move like this
|
|
|
Not that steep mind you. What I need is more like this.
|
|
|
| | | | |
It would go straight for a while and then move up.
------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
Descent_pilot
05-08-2003, 12:25 PM
I might have a solution.
# Jedi Knight Cog Script
#
# Move the projectile up after a certian amount of time
# Projectile class cog
#
# [DP]
#
symbols
message created
message timer
end
# .................................................. ....................................
code
Created:
SetTimerEx(1, GetSenderRef(), GetThingSignature(GetSenderRef()), 0);
Return;
Timer:
If(GetThingSignature(GetSenderID()) != GetParam(0)) Return;
SetThingVel('0 1 1'); // Move upwards
Return;
end There ya go, any questions or problems?
------------------
The Sniper Missions. Current project, The Sniper Missions
The Magician Saber System.
Stormtrooper
05-08-2003, 04:40 PM
My projectile still seems to go straight, here's the template.
# DESC: Flameball
# BBOX: 0 0 0 0 0 0
+flameball _weapon thingflags=0x8000401 light=1.00000 sprite=flame.spr vel=(0.000000/1.000000/0.000000) explode=+force_dest1 fleshhit=+force_dest1 damage=20.000000 typeflags=0xd timer=0.50 cog=flameball.cog
I can't figure out whats wrong, I changed the first value in settimerex to 0.15, but it still doesn't seem to work.
Flameball.cog is what I saved the above cog as.
------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
You'll need to attach a COG to your projectile template that will push the projectile upwards. Use a for loop to simulate exponential growth.
Would this happen to be a flamethrower?
------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Stormtrooper
05-08-2003, 08:00 PM
Yes, this is a very early version of a flame thrower.
How would I go about making that cog work, I have the above one assigned to the template that I posted above, but it doesn't change the path of the projectile.
Sometimes I wish I would have learned cog back when I started editing instead of starting now.
------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
I can't really remember what you have to do specifically, only the logic behind it. Someone else will have to answer that, sorry.
------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
DogSRoOL
05-08-2003, 11:12 PM
Couldn't you just add a "Z" value to your template's vel value?
------------------
May the forks be with you.
There is a great disturbance in my shorts...
Thank you for reading this post. You owe me $24.95 + S&H.
Stormtrooper
05-09-2003, 02:30 PM
If I add a Z value to the template it would look like the first picture, I need it to look like the second.
http://www.geocities.com/l337trooper/flamepath.txt
------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
[SF]pjb
05-09-2003, 03:49 PM
um, why would a flame thrower fire upwards? shurely you want it to be effected by gravity that would pullit down?
oh but then the paly woudl have to fire upwards..... is that what your aiming for??
all i know is you have to place the cog in the template. jsut like with health packs.
------------------
I am pjb.
Another post......
another moment of my life wasted.....
Stormtrooper
05-09-2003, 04:39 PM
pjb, have you ever seen fire be pulled down? When you light a match and hold it upsidedows, the flame still goes up, not down. Thats what flamethrowers do, the fire is shot straight out but it raises up becase thats the characteristics of fire.
I know that the cog has to be in the template, look at my above post where I posted the template. What I need is the cog, I'm working on one myself but its going slowly because I am still new to cog.
I just noticed that my comments may have sounded a little harsh, no harshness wes meant to be there, sorry.
------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
[This message has been edited by Stormtrooper (edited May 09, 2003).]
Stormtrooper
05-09-2003, 04:51 PM
Heres a picture of what I mean.
http://www.geocities.com/l337trooper/flamethrower.txt
See how the flame rises up? Thats what I'm trying to get.
------------------
Look for my current project, The Force in Your Soul.
Last week I cudn't evn spel grajuat, but now I is one.
*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "S-TROOPER WUZ 'ERE!!!"
LordVirus
05-09-2003, 06:19 PM
Use ApplyForce(thing, direction vector);
That should allow it to ramp up.
------------------
His pot is blacker than his kettle!
Phoenix Swords (http://www.phoenixswords.com)
DSLS_DeathSythe
05-10-2003, 07:34 PM
i figured out how to do it if you still need the help.
heres the cog that does it.
# Written By DSLS_DeathSythe
flags=0x240
symbols
#-----
message created
message pulse
thing projectile=-1 local
vector proj_vel local
flex z_vel local
flex add_vel=0.1 local desc=up vel to add
vector up_vec local
flex lif_lft=0.0 local
flex last_pls=0.25 local desc=when the pulse stops adding the vel
#-----
end
#=====
code
#-----
created:
lif_lft = GetLifeLeft(GetSenderRef());
SetThingPulse(GetSenderRef(), (lif_lft / 4));
return;
#-----
pulse:
projectile = GetSenderRef();
proj_vel = GetThingVel(projectile);
z_vel = VectorZ(proj_vel);
z_vel = z_vel + add_vel;
up_vec = VectorSet(0, 0, z_vel);
AddThingVel(projectile, up_vec);
lif_lft = GetLifeLeft(projectile);
if(lif_lft < last_pls)
lif_lft = 0.0;
SetThingPulse(GetSenderRef(), (lif_lft / 4));
return;
#=====
end
put it in the template like you were doing before.
it works but i havent tuned it so that it only sends the projectile up a little bit though.
you will have to adjust the 'add_vel' and the 'last_pls' flex's up in the symbols to get the flame to go up as high as you want.
'add_vel' is like the projectiles rate of climb.
'last_pls' when the projectiles life left is less than this flex it stops adding the up vel to the projectile.
it doesnt change the projectiles look so the projectile will still be looking forward but it will start heading upwards.
hope that helps you.
------------------
Famous last words - "It seemed like a good idea at the time."
[This message has been edited by DSLS_DeathSythe (edited May 10, 2003).]
[SF]pjb
05-11-2003, 02:02 AM
ahh.... that makes sence... kinda. but that image is of a flamthrower idle. when it spurts out all that flameing peterol it will arc as gravity pulls it down, unless its a gas flamthrower. but they arnt as efective as the petrol ones. well thats not technicaly true, peterol flamethrowers are rubbish. you have to mix petrol and disel with some shugar then it works quite neat.
of corse a old tactic is to fire a load of non flameing liqud into the enermy trench and give them time to run away like girls before buning it to hell.
so, unless this is a infiriour gas flame thrower it will be fully efected by gravity. AND hell i whould knwo my grandfather drove the darned crockadile tanks during the war, and he showed me everything about them from the user manules and photgraphes he kept....
------------------
I am pjb.
Another post......
another moment of my life wasted.....
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.