OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect on 06 May 2008, 03:56:43

Title: Hitting a leg?
Post by: The-Architect on 06 May 2008, 03:56:43
Is there a way I can spawn a bullet straight into a unit's leg, or arm or midsection etc?

I want to damage the guy with a bullet and get the puff that goes with it.
Title: Re: Hitting a leg?
Post by: Mr.Peanut on 06 May 2008, 15:49:15
You should be able to createVehicle a single bullet inside the unit. I don't know if this will make a puff. The unit will have to be completely still and you will have to play with modelToWorld to get the right position.
Title: Re: Hitting a leg?
Post by: Wolfrug on 08 May 2008, 18:52:38
You can find all the names of the bullets over here: clicky (http://www.ofpec.com/COMREF/armaweapons.php)

Under ammo classname. Just spawn it like you would a vehicle using createvehicle. I believe rockets and the like (bullets too?) start with a certain initial velocity, so...it's just a matter of aiming well, and as Peanut says, using modeltoworld to good effect!

Wolfrug out.
Title: Re: Hitting a leg?
Post by: Rommel92 on 08 May 2008, 23:30:49
Rockets have a initial velocity, I don't believe bullets do, unless its going straight down because they always seem to hit the ground (ie falling) and yes it was above ground.

So you will most likely want to modifiy the velocity and obvioulsy the direct so it aligns with his arm, perhaps make it a cutscene and him performing a certain animation or the likes.  :good:
Title: Re: Hitting a leg?
Post by: Gielovic on 10 May 2008, 00:43:13
I found a way to do this, i believe somewhere on this forum..here's the code

Code: [Select]
_faceheight = 1.80;
_dir = getdir unittohit;
_dir = _dir - 180;
_px = getpos unittohit select 0;
_py = getpos unittohit select 1;
_npx = _px + (2*(cos _dir));
_npy = _py + (2*(sin _dir));
_dir = _dir + 180;
_bullet = "B_556x45_Ball" createvehicle [_npx,_npy,_faceheight];
_xvel = (1000*(cos _dir));
_yvel = (1000*(sin _dir));
_bullet setVelocity [_xvel,_yvel,0];

Play with the direction, this way the bullet comes from behind and you can actually see it hit the enemy
Adjust the _faceheight, _npx, _npy to hit other bodyparts...
Chanching the 1000 will affect the speed of the bullet...this is an instant kill when hitting the body/head...with a value of around 200 this is not always the case, so also change that if the effect isn't good;)