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 → Making a projectile move forward and up.
Making a projectile move forward and up.
2003-05-07, 11:01 AM #1
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!!!"
2003-05-07, 2:46 PM #2
Code:
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.
Code:
'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."
Famous last words - "It seemed like a good idea at the time."
2003-05-07, 5:07 PM #3
I never thought of that, but that would make it move like this
Code:
      |
   |
|

Not that steep mind you. What I need is more like this.
Code:
              |
             |
           |
| | | | |

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!!!"
2003-05-08, 9:25 AM #4
I might have a solution.
Code:
# 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.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2003-05-08, 1:40 PM #5
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!!!"
2003-05-08, 4:18 PM #6
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.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2003-05-08, 5:00 PM #7
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!!!"
2003-05-08, 7:28 PM #8
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.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2003-05-08, 8:12 PM #9
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.
Catloaf, meet mouseloaf.
My music
2003-05-09, 11:30 AM #10
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!!!"
2003-05-09, 12:49 PM #11
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.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2003-05-09, 1:39 PM #12
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.

[EDIT]I just noticed that my comments may have sounded a little harsh, no harshness wes meant to be there, sorry.[/EDIT]

------------------
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).]
2003-05-09, 1:51 PM #13
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!!!"
2003-05-09, 3:19 PM #14
Use ApplyForce(thing, direction vector);
That should allow it to ramp up.

------------------
His pot is blacker than his kettle!

Phoenix Swords
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2003-05-10, 4:34 PM #15
i figured out how to do it if you still need the help.
heres the cog that does it.
Code:
# 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).]
Famous last words - "It seemed like a good idea at the time."
2003-05-10, 11:02 PM #16
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.....
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?

↑ Up to the top!