Rocket Aiming
Moderator: InsideQC Admins
7 posts
• Page 1 of 1
Rocket Aiming
Lets say I wanted to fire a rocket into the ground.
How would I change this code?
How would I change this code?
- Code: Select all
void() W_FireRocket =
{
if (deathmatch != 4)
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
msg_entity = self;
WriteByte (MSG_ONE, SVC_SMALLKICK);
newmis = spawn ();
newmis.owner = self;
newmis.movetype = MOVETYPE_FLYMISSILE;
newmis.solid = SOLID_BBOX;
// set newmis speed
makevectors (self.v_angle);
newmis.velocity = aim(self, 1000);
newmis.velocity = newmis.velocity * 1000;
newmis.angles = vectoangles(newmis.velocity);
newmis.touch = T_MissileTouch;
newmis.voided = 0;
// set newmis duration
newmis.nextthink = time + 5;
newmis.think = SUB_Remove;
newmis.classname = "rocket";
setmodel (newmis, "progs/missile.mdl");
setsize (newmis, '0 0 0', '0 0 0');
setorigin (newmis, self.origin + v_forward*8 + '0 0 16');
};
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
Change
makevectors (self.v_angle);
newmis.velocity = aim(self, 1000);
newmis.velocity = newmis.velocity * 1000;
to:
v_forward = '0 0 -1';
newmis.velocity = '0 0 -1000';
makevectors (self.v_angle);
newmis.velocity = aim(self, 1000);
newmis.velocity = newmis.velocity * 1000;
to:
v_forward = '0 0 -1';
newmis.velocity = '0 0 -1000';
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
In PlayerPostThink, I want to add a line of code that says:
if (my health is less than 10 and I launch a rocket)
How would I do this?
I can't figure out the launch the rocket part.
if (my health is less than 10 and I launch a rocket)
How would I do this?
- Code: Select all
if (self.health < 10 && (self.??????) )
I can't figure out the launch the rocket part.
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
Here's the correct code:
This says: If my health is less than 10 AND my current weapon is the rocket launcher AND I'm pressing the fire button, then I'll do the function in this statement.
- Code: Select all
if (self.health < 10 && self.weapon == IT_ROCKET_LAUNCHER && self.button0)
This says: If my health is less than 10 AND my current weapon is the rocket launcher AND I'm pressing the fire button, then I'll do the function in this statement.
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest