OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect on 26 Dec 2008, 22:24:06
-
How do I damage enough of a character's legs via a script so that he can't walk and so that I get the damage textures to show up without shooting him myself?
-
Have you tried spawning a bullet or two in his legs? Back in OFP, this was how that was accomplished...
-
Hmm, interesting theory. How would I go about that?
-
There you go:
/*
killLegs.sqf
by Deadfast
Spawn a bullet at unit's legs to render it unable to walk.
SYNTAX: [unit name] execVM "killLegs.sqf"
*/
_unit = _this select 0;
if ((!canStand _unit) || (!alive _unit)) exitWith {}; //unit has damaged legs already or is dead
_i = 0;
while {(canStand _unit) && (_i < 20)} do
{
_pos = _unit ModelToWorld [0.2, -1, 0.01];
_dir = direction _unit;
_bullet = "B_556x45_SD" createVehicleLocal _pos;
_bullet setVelocity [(sin _dir*100),(cos _dir*100),0];
_i = _i + 1;
sleep 0.1;
};
A little disclaimer: script doesn't work if the unit is moving or if the unit is human and is prone (works fine with AI). I'll take a look into it.
-
How do I call an SQF? I'm used to .sqs
-
It's in the script header:
[unit name] execVM "killLegs.sqf"
if you wanna call it from a trigger use something like:
killlegs = [unit name] execVM "killLegs.sqf"
-
Excellant. However, it is killing the unit. >:(
-
Really?
It was working all fine when I tested it (BLUFOR Rifleman, both player operated and AI)...
Try to play with this line:
_pos = _unit ModelToWorld [0.2, -1, 0.01];
-
I think it's because I'm using a community created addon units rather than a standard BIS one. I reckon these guys are weaker.
I tried using various different types of ammo but he still dies.
I'll get on to the addon maker and see what he has to say about the unit's strength.
Cheers for the script though, it works just fine. ;)
-
You could also try to slow the bullets down, I believe if you lower the values (both 100) on this line the bullet will travel slower:
_bullet setVelocity [(sin _dir*100),(cos _dir*100),0];
AFAIK in ArmA the impact velocity affects damage.