Forum Jump :

Author Message


Posts: 3
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2015-02-18 16:09        
     
Hi,

I want to do a script to spawn (or activate via trigger) an AI character who is injured (bleeding) and unconscious. The player should then provide first aid (using the AGM medical system).

That's the command in the NPCs Init box:

_nul = [this, "HitBody", 0.8]execVM "wounded.sqf";

and that's the script so far:

_unit = _this select 0;
_hit = _this select 1;
_damage = _this select 2;

removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
//removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;

_unit playMove "AinjPpneMstpSnonWnonDnon";
_unit setHitPointDamage [_hit, _damage];
_unit setVariable ["AGM_AllowUnconscious", true];
_unit setUnconscious true;
_unit setBleedingRemaining 120;

The Animation works fine and one can see the blood/wounds on the character. AGM medical system says he is wounded at the right spot (the body in this example) and bleeding. But the NPC actually doesn't loose any blood and is still awake. If I check for damage or lifeState of the unit in the Debug Console it says the unit is "healthy" / has 0 damage.

Does anyone know a way to do this? Maybe I just missed an action command or a function. Thanks for any help!


Author Message

Rick  

One of Armaholic's finest ..... by presence....


Posts: 258
Rank:


Country: ca
Location: Alberta
Occupation: Sodbuster
Age: 28
In-game name: runny

 
#2 Posted at 2015-02-18 19:53        
     
Add this to the script:

[_unit, 999999] call AGM_Medical_fnc_knockOut; 

I am very macho.

Advertisement


Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 21
In-game name: Wak

 
#3 Posted at 2015-02-18 20:00        
     
Maybe let him get unconscious before damaging him?
_unit setVariable ["AGM_AllowUnconscious", true];
_unit setHitPointDamage [_hit, _damage];

Also, the command setUnconscious won't work with AGM. It's a remnant of the old ArmA2 default medical system, which was a pain in the ass to set up. Luckily with AGM you don't have to ever use that, AGM wiki has this piece of code that you can use to get him unconscious, so in conclusion the last part of the code whould be as:
_unit playMove "AinjPpneMstpSnonWnonDnon";
_unit setVariable ["AGM_AllowUnconscious", true];
_unit setHitPointDamage [_hit, _damage];
[_unit, 900] call AGM_Medical_fnc_knockOut;
_unit setBleedingRemaining 120;

fn_knockOut.sqf for your reading pleasure.

This post was edited by 654wak654 (2015-02-18 20:37, ago)

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Author Message


Posts: 3
Rank:


Level: Member

Country: de
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2015-02-18 21:49        
     
Awesome! Thank you! Unconscious NPC here I come!

still no bleeding though, but I think thats a general problem with getHit, setHit, setDamage, and so on, there is no physical object that hits the unit and therefore no bleeding wound.

Well, I think I'll just let the AI shoot each other, should create some injuries and hopefully someone survives so I can treat him... ^_^


Author Message

Rick  

One of Armaholic's finest ..... by presence....


Posts: 258
Rank:


Country: ca
Location: Alberta
Occupation: Sodbuster
Age: 28
In-game name: runny

 
#5 Posted at 2015-02-19 00:28        
     
I wouldn't rely on AI to make or break your mission mechanics. Just saying..

I am very macho.

Author Message


Posts: 1515
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#6 Posted at 2015-02-19 01:27        
     
When using _unit setHitPointDamage [_hit, _damage]; the unit is actually damaged it remains 0
it does play the damage action and apply textures.

All you need to do is add real damage to the unit to get him to bleed. _unit setdamage 0.7;
Blood is seen on the ground, I'm using development version but I'm sure it was there in Stable version as well.
setBleedingRemaining
You may need to remove the medikit or he will heal himself.

This post was edited by F2kSel (2015-02-19 01:36, ago)