OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect on 26 Dec 2008, 22:24:06

Title: Dead legs
Post 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?
Title: Re: Dead legs
Post by: Tyger on 26 Dec 2008, 23:12:23
Have you tried spawning a bullet or two in his legs? Back in OFP, this was how that was accomplished...
Title: Re: Dead legs
Post by: The-Architect on 27 Dec 2008, 00:04:33
Hmm, interesting theory. How would I go about that?
Title: Re: Dead legs
Post by: Deadfast on 27 Dec 2008, 13:04:40
There you go:

Code: [Select]
/*
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.
Title: Re: Dead legs
Post by: The-Architect on 27 Dec 2008, 15:04:43
How do I call an SQF? I'm used to .sqs
Title: Re: Dead legs
Post by: Deadfast on 27 Dec 2008, 17:38:55
It's in the script header:

Code: [Select]
[unit name] execVM "killLegs.sqf"


if you wanna call it from a trigger use something like:
Code: [Select]
killlegs = [unit name] execVM "killLegs.sqf"
Title: Re: Dead legs
Post by: The-Architect on 30 Dec 2008, 17:56:54
Excellant. However, it is killing the unit.  >:(
Title: Re: Dead legs
Post by: Deadfast on 30 Dec 2008, 21:52:41
Really?

It was working all fine when I tested it (BLUFOR Rifleman, both player operated and AI)...


Try to play with this line:
Code: [Select]
_pos = _unit ModelToWorld [0.2, -1, 0.01];
Title: Re: Dead legs
Post by: The-Architect on 31 Dec 2008, 12:19:57
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.  ;)
Title: Re: Dead legs
Post by: h- on 31 Dec 2008, 12:27:23
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:
Code: [Select]
_bullet setVelocity [(sin _dir*100),(cos _dir*100),0];
AFAIK in ArmA the impact velocity affects damage.