Home   Help Search Login Register  

Author Topic: Hitting a leg?  (Read 1437 times)

0 Members and 1 Guest are viewing this topic.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Hitting a leg?
« 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.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Hitting a leg?
« Reply #1 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.
urp!

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Hitting a leg?
« Reply #2 on: 08 May 2008, 18:52:38 »
You can find all the names of the bullets over here: clicky

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.
"When 900 years YOU reach, look as good you will not!"

Offline Rommel92

  • Members
  • *
Re: Hitting a leg?
« Reply #3 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:

Offline Gielovic

  • Contributing Member
  • **
Re: Hitting a leg?
« Reply #4 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;)
« Last Edit: 10 May 2008, 00:45:43 by Gielovic »