Jump to content
cc_kronus

Trigger to detect injured inside vehicle [SOLVED]

Recommended Posts

Hi, 

I have spent hours looking for what I need but could not find it. 

We use Alive and there is a medevac chopper with Ai pilot.

We also have an auto-heal script

What we want to do is to be able to put injured players (often unconscious ) inside the medevac chopper, and when the medevac lands at the medic helipad back at base , there is a trigger that detect if anybody inside the helicopter is injured and run the auto-heal script on the injured player/s. 

How should be the condition and init of the trigger?

 

Share this post


Link to post
Share on other sites
{

 if((lifeState _x) isEqualTo "INCAPACITATED") then {
			if((_x distance medicalBuilding) < 50) then {
        hint "This unit is injured!";

        //run your auto heal.

      };
   };
} forEach (crew _myHelicopter);

 

  • Like 1

Share this post


Link to post
Share on other sites

condition of the trigger:

{damage _x > 0 OR (lifeState _x) isEqualTo "INCAPACITATED"} count crew YourChopperName > 0

Will return true if there's at least one damaged unit inside the chopper.

To heal all injured units inside the chopper:

{_x setDamage 0} forEach crew YourChopperName

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites
Just now, Grumpy Old Man said:

condition of the trigger:


{damage _x > 0} count crew YourChopperName > 0

Will return true if there's at least one damaged unit inside the chopper.

To heal all injured units inside the chopper:


{_x setDamage 0} forEach crew YourChopperName

 

Cheers

take into consideration, total damage versus being damaged whilst unconscious.

Share this post


Link to post
Share on other sites

Hi folks

 

thanks for your help. The problem is that helicopter is generated by ALiVE and therefore does not have a name.  _x would need to be the helicopter and the trigger should detect people in _x

 

in fact, after thinking, it does not need to detect injured, the script may be run on anyone inside the chopper, healed or not, they all will be healed as soon as the chopper lands on the trigger.

 

Would that make it easier. ?

Share this post


Link to post
Share on other sites

but you could detect the chopper with the trigger an then you have the object of the chopper with thst  you can use Midnighters lines.

Share this post


Link to post
Share on other sites
On 2017-4-5 at 8:24 PM, sarogahtyp said:

but you could detect the chopper with the trigger an then you have the object of the chopper with thst  you can use Midnighters lines.

Not that easy, it is a chopper generated by ALiVE, so it has no name

 

 

I found a function: [_caller, _target] call ACE_medical_fnc_treatmentAdvanced_fullHeal;

 

The issue is to set the syntax of the trigger so that when the chopper has landed at the trigger, apply the function to players in the chopper (injured or not, it does not matter),  The function needs to work in multiplayer, either hosted or in a dedicated server. 

 

I have been banging my head with a wall for weeks with this, trial after trial  and I need expert help to sort this one out.

 

 

Share this post


Link to post
Share on other sites

You don't need a name. You have the object that activates the trigger.

 

Activation type: anyplayer

On activ:

{

    //Heal them

    // _x is one of the units in thislist

    // thislist is all marching units inside the trigger which match the activation type. 

    _x setDamage 0; 

 

} foreach thislist;

 

Also you could set the activation type to whatever side you play on and the airport would be healed as well.

Share this post


Link to post
Share on other sites
On 2017-4-5 at 8:24 PM, sarogahtyp said:

but you could detect the chopper with the trigger an then you have the object of the chopper with thst  you can use Midnighters lines.

How  would be the sintax?  I mean, how do I detect a chopper without name, generated by ALiVE and make the trigger diferentiate between the chopper and the crew inside the vehicle that needs to be healed?

Share this post


Link to post
Share on other sites

Using what has been posted above try this

 

Trigger as follows :-

anyone present

repeating

 

Cond

{damage _x > 0 OR (lifeState _x) isEqualTo "INCAPACITATED"} count crew (thislist select 0) > 0

 

On Act

{ _x setDamage 0} forEach crew (thislist select 0)

That should heal every one in the chopper

Share this post


Link to post
Share on other sites

Create one trigger that detects that the man is inside the trigger area.

 

Create a second trigger that covers the whole map. This trigger detects that the man is injured.

 

Create a third trigger that detects the first two triggers have fired. Voila!

 

.

Share this post


Link to post
Share on other sites

sorry, guys, none of your proposed solutions work

 

I think that i will give up doing it via trigger and instead make the trigger just fire a script that will select the players in cargo and run the funcion on them. I will still need help as my programming skills are close to cero. I am a copy-paster.

Share this post


Link to post
Share on other sites

Just a trigger with accurate position (helipad), you can limit its ceiling to avoid unwanted triggering by fly by, say 5 meters for C coord., enough for landing case, repeatable,

make it act/deact sensible for helo only. So for a BLUFOR present trigger:

cond: this && ({_x isKindOf "helicopter"} count thisList) > 0

{_x setUnconscious false; _x setDamage 0} forEach crew (thisList select 0)

 

Share this post


Link to post
Share on other sites

we have already tried it

 

cond:  (_x isKindOf "air") && (isTouchingGround _x) && {player in thisList} count (playableUnits + switchableUnits) > 0   

 

playableunits + switchable units is due to ensure multiplayer functionality.

 

Please note that your action 

 

{_x setUnconscious false; _x setDamage 0} do not work with ACE3 advanced medicals. 

 

you need to run a function 

 

{[_caller, _target] remoteExecCall ["ACE_medical_fnc_treatmentAdvanced_fullHealLocal", _x, false];} forEach thisList;

 

to heal players in ACE3 advanced medicals.
 

unfortunately the problem is that for whatever reason, we are unable to make the condition to detect players in cargo of the helicopter and apply the function to them.

Share this post


Link to post
Share on other sites

Are you saying that ACE3 is so preemptive on Arma's engine to impede these basic commands? I know why avoiding ACE3, if I didn't so far!

Share this post


Link to post
Share on other sites

Well. isTouchingGround is not really reliable.

Either use isTouchingGround vehicle _x or just check the height.

_x will check , if the players are from the kind AIR, which will be false.

 

I would recommend to do following. I don't have any problems detecting any choppers from alive or  others, as they are the same.

 

As @pierremgi mentioned: Trigger for Blufor (Or your side)

 

cond:

 this && {(vehicle _x) isKindOf "air" && (getPos vehicle _x) select 2 < 3} count thisList > 0;

or alternativ:

 this && {(vehicle _x) isKindOf "air" && isTouchingGround vehicle _x} count thisList > 0;

No need for playableUnits usw.

On acti:

_air = if (count (thislist select {(vehicle _x) isKindOf "AIR" }) != 0) then { _thislist select {(vehicle _x) isKindOf "AIR" } select 0} else { thislist select 0};
{
	_x setVariable ["ace_medical_pain", 0, true];
    _x setVariable ["ace_medical_morphine", 0, true];
    _x setVariable ["ace_medical_bloodVolume", 100, true];

    // tourniquets
    _x setVariable ["ace_medical_tourniquets", [0,0,0,0,0,0], true];

    // wounds and injuries
    _x setVariable ["ace_medical_openWounds", [], true];
    _x setVariable ["ace_medical_bandagedWounds", [], true];
    _x setVariable ["ace_medical_internalWounds", [], true];

    // vitals
    _x setVariable ["ace_medical_heartRate", 80];
    _x setVariable ["ace_medical_heartRateAdjustments", []];
    _x setVariable ["ace_medical_bloodPressure", [80, 120]];
    _x setVariable ["ace_medical_peripheralResistance", 100];

    // fractures
    _x setVariable ["ace_medical_fractures", []];

    // IVs
    _x setVariable ["ace_medical_ivBags", nil, true];

    // damage storage
    _x setVariable ["ace_medical_bodyPartStatus", [0,0,0,0,0,0], true];

    // airway
    _x setVariable ["ace_medical_airwayStatus", 100, true];
    _x setVariable ["ace_medical_airwayOccluded", false, true];
    _x setVariable ["ace_medical_airwayCollapsed", false, true];

    // generic medical admin
    _x setVariable ["ace_medical_addedToUnitLoop", false, true];
    _x setVariable ["ace_medical_inCardiacArrest", false, true];
    _x setVariable ["ace_medical_inReviveState", false, true];
    _x setVariable ["ACE_isUnconscious", false, true];
    _x setVariable ["ace_medical_hasLostBlood", 0, true];
    _x setVariable ["ace_medical_isBleeding", false, true];
    _x setVariable ["ace_medical_hasPain", false, true];
    _x setVariable ["ace_medical_painSuppress", 0, true];

    // medication
    private _allUsedMedication = _x getVariable ["ace_medical_allUsedMedication", []];
    {
       _x setVariable [_x select 0, nil];
    } forEach _allUsedMedication;

    // Resetting damage
    _x setDamage 0;
} forEach crew _air;

Or put it in a fnc.

_caller wasn't defined, that's basically the fnc from ACE without logging it, I just hope that I resolved the gvar right, did it out of the head.

Share this post


Link to post
Share on other sites
7 hours ago, cc_kronus said:

sorry, guys, none of your proposed solutions work

 

I think that i will give up doing it via trigger and instead make the trigger just fire a script that will select the players in cargo and run the funcion on them. I will still need help as my programming skills are close to cero. I am a copy-paster.

All of these solutions work in vanilla a3.

Since you're obviously using ACE3 without mentioning it in the first post, why not go ask in the ACE3 thread?

 

Cheers

Share this post


Link to post
Share on other sites
2 hours ago, crewt said:

Well. isTouchingGround is not really reliable.

Either use isTouchingGround vehicle _x or just check the height.

_x will check , if the players are from the kind AIR, which will be false.

 

I would recommend to do following. I don't have any problems detecting any choppers from alive or  others, as they are the same.

 

As @pierremgi mentioned: Trigger for Blufor (Or your side)

 

cond:


 this && {(vehicle _x) isKindOf "air" && (getPos vehicle _x) select 2 < 3} count thisList > 0;

or alternativ:


 this && {(vehicle _x) isKindOf "air" && isTouchingGround vehicle _x} count thisList > 0;

No need for playableUnits usw.

On acti:


_air = if (count (thislist select {(vehicle _x) isKindOf "AIR" }) != 0) then { _thislist select {(vehicle _x) isKindOf "AIR" } select 0} else { thislist select 0};
{
	_x setVariable ["ace_medical_pain", 0, true];
    _x setVariable ["ace_medical_morphine", 0, true];
    _x setVariable ["ace_medical_bloodVolume", 100, true];

    // tourniquets
    _x setVariable ["ace_medical_tourniquets", [0,0,0,0,0,0], true];

    // wounds and injuries
    _x setVariable ["ace_medical_openWounds", [], true];
    _x setVariable ["ace_medical_bandagedWounds", [], true];
    _x setVariable ["ace_medical_internalWounds", [], true];

    // vitals
    _x setVariable ["ace_medical_heartRate", 80];
    _x setVariable ["ace_medical_heartRateAdjustments", []];
    _x setVariable ["ace_medical_bloodPressure", [80, 120]];
    _x setVariable ["ace_medical_peripheralResistance", 100];

    // fractures
    _x setVariable ["ace_medical_fractures", []];

    // IVs
    _x setVariable ["ace_medical_ivBags", nil, true];

    // damage storage
    _x setVariable ["ace_medical_bodyPartStatus", [0,0,0,0,0,0], true];

    // airway
    _x setVariable ["ace_medical_airwayStatus", 100, true];
    _x setVariable ["ace_medical_airwayOccluded", false, true];
    _x setVariable ["ace_medical_airwayCollapsed", false, true];

    // generic medical admin
    _x setVariable ["ace_medical_addedToUnitLoop", false, true];
    _x setVariable ["ace_medical_inCardiacArrest", false, true];
    _x setVariable ["ace_medical_inReviveState", false, true];
    _x setVariable ["ACE_isUnconscious", false, true];
    _x setVariable ["ace_medical_hasLostBlood", 0, true];
    _x setVariable ["ace_medical_isBleeding", false, true];
    _x setVariable ["ace_medical_hasPain", false, true];
    _x setVariable ["ace_medical_painSuppress", 0, true];

    // medication
    private _allUsedMedication = _x getVariable ["ace_medical_allUsedMedication", []];
    {
       _x setVariable [_x select 0, nil];
    } forEach _allUsedMedication;

    // Resetting damage
    _x setDamage 0;
} forEach crew _air;

Or put it in a fnc.

_caller wasn't defined, that's basically the fnc from ACE without logging it, I just hope that I resolved the gvar right, did it out of the head.

 

Sorry to say it did not work.  

 

What I know is that the trigger on the helipad with the condition:  "this" and the on act : { [_x, _x] remoteExecCall ["ACE_medical_fnc_treatmentAdvanced_fullHealLocal", _x, false];} forEach thisList;      works like a dream:  as soon as a player steps out of the chopper. The problem is that an unconscious player can't do any action and can't get out of the chopper. 

 

An alternative method would be to overlap another trigger so that as soon as the chopper touches ground the trigger force eject/kick all the players out of the chopper. As soon as they fall on the helipad, they would be healed by the above described trigger. The problem is that I could not make work any action function as "eject" or "getout"  with ALiVe chopper. 

Share this post


Link to post
Share on other sites
51 minutes ago, cc_kronus said:

 

An alternative method would be to overlap another trigger so that as soon as the chopper touches ground the trigger force eject/kick all the players out of the chopper. As soon as they fall on the helipad, they would be healed by the above described trigger. The problem is that I could not make work any action function as "eject" or "getout"  with ALiVe chopper. 

And so? As far as you're resetting damage (if I read the last code), how can you say the setUnconscious command doesn't work? Where did you test it?
NOTE: you don't need any more trigger and any "eject" or "get out" action, unless it's specified by ACE team... (I guess not).

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×