Jump to content
Sign in to follow this  
tyler4171

IED explosion and Humvees

Recommended Posts

How would I go about making the player move out of the target Humvee and out to the side of the road via this method: (please dont kill me for the CoD video, its just an example)

Also, replacing the Humvee's wreck with the on under Empty objects> Wrecks> HMMVW?

Share this post


Link to post
Share on other sites

Take a look at this command:

http://community.bistudio.com/wiki/moveOut

Getting the player to hop out of the vehicle is relatively easy. Swapping the destroyed Humvee for the wreck model will require some scripting.

The way I would set this up is to pass the name of the Humvee into a script that will handle the whole event. So for example:

null = [myHumvee] execVM "scripts\events\humvee.sqf";

myHumvee is the variable name for the Humvee in which the player is travelling.

/*
First of all, we need to pass the Humvee's name into the script. We will also make the variable private just to be on the safe side.
We are also going to need to get the position and direction of the Humvee so that we can spawn the wreck model in the right place. We will also use variables for this.
*/
private ["_humvee",
	 "_humvee_pos",
	 "_humvee_dir",
	 "_humvee_wreck"
];
_humvee = _this select 0;
_humvee_pos = getPosATL _humvee;
_humvee_dir = getDir _humvee;

//Before we eject the player, we need to make him invincible so that ejecting at speed doesn't kill him.
player allowDamage false;

//Now to eject the player. We do this before destroying the Humvee because we don't want to kill the player.
moveOut player;

/*
Now we will destroy the Humvee. We will also delete it to make room for the wreck model.
We could just delete the Humvee but using setDamage should make it go boom. If we use the two in conjunction then we will have the Humvee explode, then get deleted.
*/
_humvee setDamage 1;
deleteVehicle _humvee;

/*
This is where we will spawn in the wreck. The classname of the wreck is "HMMWVWreck".
We will use createVehicle array to spawn the vehicle. This is because it is faster and provides more parameters to tweak than normal createVehicle.
*/
_humvee_wreck = createVehicle ["HMMWVWreck",_humvee_pos, [], _humvee_dir, "NONE"];

//All that is left to do is now make the player vulnerable again.
player allowDamage true;

I haven't tested this as I don't have time at the moment, but it should work (fingers crossed!).

Hope this helps you :).

Share this post


Link to post
Share on other sites

thanks, will try! no how do I make the player seem unconcious, as in blacking in and out for a few seconds or so with an animation?

Share this post


Link to post
Share on other sites

All works aside from the ejection and replacement of the wreck. I am ejected from the vehicle but I get killed and the Humvee is not replaced

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×