The Firing Function for Akimbo Rocket Launcher

[use this for other weapons as well]


 

Posted by X-Arch on January 05, 1999 at 22:06:45:

WOW...i did something instead of ask something..hehehe...
==============
Tutorial: Akimbo Rockets (can be used for other weapons as well.)
==============
well this is my first tutorial so dont expect to much and im just writing it cause i know a lot of people want to know...
NOTE: THIS IS ONLY THE FIRING FUNCTION FOR AKIMBO WEAPONS!!!!....THIS WILL JUST SHOOT 2 GRENADES FROM A GRENADE LAUNCHER AT THE RIGHT POSITIONS TO LOOK LIKE A GRENADE IS COMING FROM THE LEFT AND RIGHT HAND..to make this have FULL effect you will need to make a new model or extend on the grenade launcher already and just make the model akimbo...easily done...just goto get the existing one, save it, merge it again and then mirror it so it looks right (thanx goto MrGrim for telling me how to get my model to work with the mirroring and stuff)

Well here is the simple way (prolly not the best way not most efficient but it works):
open up p_weapon.c:
find Weapon_rocketlauncher_fire()
now go down a bit and you should see somethign like this:

AngleVectors (ent->client->v_angle, forward, right, NULL);

VectorScale (forward, -2, ent->client->kick_origin);
ent->client->kick_angles[0] = -1;

VectorSet(offset, 8, 8, ent->viewheight-8);
P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
fire_rocket (ent, start, forward, damage, 550, damage_radius, radius_damage);

now all we are going to do is duplicate that so it fires a second rocket when u shoot, change some stuff so that the second rocket starts from the left hand side, and add a diferent angle for the rocket to end up (about 1 metre in life) from the other rocket..:
simple duplicate that as so (adding it right below the first fire_rocket):

//changes the X position of were the rocket will go....the [1] means v_angle for X //position..if that is a [0] then it means the Y position...
ent->client->v_angle[1] += 10;

//Just the normal code we duplicated
AngleVectors (ent->client->v_angle, forward, right, NULL);

VectorScale (forward, -2, ent->client->kick_origin);
ent->client->kick_angles[0] = -1;

//This is were we get the start position from were the rocket is fired from on the //screen...notice that the VetorSet(offset, -4,-4,blah blahg blah) use to be //VectorSet(offset,8,8,etc etcet)...changing the 8 to a lower number moves the rocket //postition from the right hand over to the left and vise versa.

VectorSet(offset, -4, -4, ent->viewheight-8);
//normal code
P_ProjectSource (ent->client, ent->s.origin, offset, forward, right, start);
fire_rocket (ent, start, forward, damage, 550, damage_radius, radius_damage);

//Add this So that the first rocket goes back to its normal position....
ent->client->v_angle[0] -= 10;

and thats it....you now have 2 rockets that look like guns akimbo when you fire them IF you have a model that is made for this...like i do..once ive made all 10 guns into akimbo models ill post a zip file for pplz to use...saves everyone making there own...just credit for the models would be apreciated..;)
okies well i dont know how clear that has come out but if you have an questions or comments just email me or post a msg or soemthing....
o and i am probably wrong wif some of the meanings i have said so fix me up if you wish....
NOTE: Weapon must be in the right hand (console "hand 3") for it to look right...if you put your wepaon in the left hand..the rockets cross over..hehehe...looks funny...
enjoy!


Follow Ups:

Posted by shade on January 05, 1999 at 22:41:44:

In Reply to: TUTORIAL: The Firing Function for Akimbo Rocket Launcher [use this for other weapons as well] posted by X-Arch on January 05, 1999 at 22:06:45:

If you use G_ProjectSource instead of P_ProjectSource, you won't have the problem of the player being required to have right hand selected in the console.

So you would want to do something like this:

//right hand first
VectorSet(offset, 8, 8, ent->viewheight-8);
G_ProjectSource(ent->s.origin, offset, forward, right, start);
fire_rocket (ent, start, forward, damage, 550, damage_radius, radius_damage);

//now left hand
offset[1] *= -1; //switch Y coordinate to left side
G_ProjectSource(ent->s.origin, offset, forward, right, start);
fire_rocket (ent, start, forward, damage, 550, damage_radius, radius_damage);