Jump to content
Sign in to follow this  
austin_medic

[RELEASE] Basic AI Medic FSM

Recommended Posts

This FSM creates AI behaviour to simulate a medic standing around in a base that will heal people that are injured inside the defined radius.

Medic doesn't need any FAK's or medkits, he will auto-heal units once he is within 5 meters of them, or if he can't get to them, he will give up after a few minutes and the unit will be auto-healed.

The unit probably won't stay in the radius for long, he will eventually begin to wander farther off from the first place he started as he runs around healing people.

Not too complex,created in 30 minutes to figure out FSMs a bit better.

how to use:

in init.sqf

[YOUR-UNIT-NAME-HERE,RADIUS] execFSM "AI_medic.fsm";

V1.1 Update

Fixed the last unit in the queue being dropped.

Added animations to the AI medic (he's stupid and usually doesn't face the right way, but he does do something now)

AI medic will return to his starting position when theres nobody else left to heal.

Lowered the distance required to begin healing to 2 meters so the animations look somewhat realistic

Mirror:

Dropbox (1.1)

Edited by austin_medic
  • Like 1

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means soon you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

the FSM could be ripped apart by anyone who wants to as well (fine with me), it contains a type of task queue that could be useful in many situations.

Share this post


Link to post
Share on other sites

Is the medic supposed to heal you with an animation? Because when I use the script, he isn't.

He just stands there or walks towards you and you're magically healed.

I was actually expecting a bit more emmersion than this. Maybe perform an action on the subject at hand where it would also take some time to complete it (maybe on a timer that can be adjusted with a parameter?)

Share this post


Link to post
Share on other sites

V1.1 Update

Fixed the last unit in the queue being dropped.

Added animations to the AI medic (he's stupid and usually doesn't face the right way, but he does do something now)

AI medic will return to his starting position when theres nobody else left to heal.

Share this post


Link to post
Share on other sites

Cool thing! Small hint: Instead of _queue + [_x], use _queue pushBack _x simply because it's faster and you get used to using pushBack. You may remember it later in another script when performance should count. ;)

Share this post


Link to post
Share on other sites
Guest

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means soon you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Would it be possible to have this FSM run on every unit that has large med pack in the inventory? So I dont need to micro medics to heal people.

Edited by Taro8

Share this post


Link to post
Share on other sites
Would it be possible to have this FSM run on every unit that has large med pack in the inventory? So I dont need to micro medics to heal people.

it's not made for regular moving medics, this was made with missions where there's AI standing around in the main base doing nothing productive, this gives them some functionality to make them less useless, and therefore it won't work properly with other units

Share this post


Link to post
Share on other sites

this is pretty awesome man! but -- question. would it be possible to get this to be fully functional with ACE 3?

i just tried it out for a minute in single player -- the medic ran to me within the 10m radius i set him to, and he healed me -- however the only thing left to do that he didn't was stick me with morphine. which i did myself. not a huge deal -- morphine's something i do believe anybody in the squad can administer (or the player themselves can also do), but it'd be neat to see it go back to 100% once a player's dropped off at the medical station. i want it to be fully functional with ACE 3 so if my guys are playing and there isn't a human CLS available, they can medivac the injured back to base and take them to the medic station.

Share this post


Link to post
Share on other sites

ACE3 have no AI healing (Lazy IMHO ). You can edit the script and add some AC3 setVariable while AI healing.

Or just use AGM there are AI healing working like charm.

Edited by DaVIdoSS

Share this post


Link to post
Share on other sites

if its a choice between AGM or ACE 3, i'm going with ACE 3.

plus, ACE 3 JUST came out. its a little ridiculous to call that team lazy.

but, aside from that -- would you be able to entlighten me as to how I could edit the script and add ACE 3-usable code to it? how do i even access the .FSM file?

Share this post


Link to post
Share on other sites
if its a choice between AGM or ACE 3, i'm going with ACE 3.

plus, ACE 3 JUST came out. its a little ridiculous to call that team lazy.

but, aside from that -- would you be able to entlighten me as to how I could edit the script and add ACE 3-usable code to it? how do i even access the .FSM file?

Your free to do what you want with it as long as it doesn't get re-released here or on armaholic in the exact same state it is now (if its modified then thats different).

To edit FSM files you need to download arma 3 tools and use the FSM editor to open and edit it.

Share this post


Link to post
Share on other sites

Who said that i am calling them bad?

They are doing great work and maybe some day we get all stuff working.

For now if you play with AI they cant help you. And that is lazy for me not the devTeam.

I am not a scripter maybe the Author can help you out.

There you have some variables from ace3 medical:

/*
* Author: KoffeinFlummi
* Initializes unit variables.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* ReturnValue:
* nil
*
* Public: No
*/

#include "script_component.hpp"

private ["_unit", "_allUsedMedication", "_logs"];

_unit = _this select 0;

_unit setVariable [QGVAR(pain), 0, true];
_unit setVariable [QGVAR(morphine), 0, true];
_unit setVariable [QGVAR(bloodVolume), 100, true];

// tourniquets
_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true];

// wounds and injuries
_unit setvariable [QGVAR(openWounds), [], true];
_unit setvariable [QGVAR(bandagedWounds), [], true];
_unit setVariable [QGVAR(internalWounds), [], true];
_unit setvariable [QGVAR(lastUniqueWoundID), 1, true];

// vitals
_unit setVariable [QGVAR(heartRate), 80];
_unit setvariable [QGVAR(heartRateAdjustments), []];
_unit setvariable [QGVAR(bloodPressure), [80, 120]];
_unit setVariable [QGVAR(peripheralResistance), 100];

// fractures
_unit setVariable [QGVAR(fractures), [], true];

// triage card and logs
_unit setvariable [QGVAR(triageLevel), 0, true];
_unit setvariable [QGVAR(triageCard), [], true];

// IVs
_unit setVariable [QGVAR(salineIVVolume), 0, true];
_unit setVariable [QGVAR(plasmaIVVolume), 0, true];
_unit setVariable [QGVAR(bloodIVVolume), 0, true];

// damage storage
_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true];

// airway
_unit setvariable [QGVAR(airwayStatus), 100];
_unit setVariable [QGVAR(airwayOccluded), false];
_unit setvariable [QGVAR(airwayCollapsed), false];

// generic medical admin
_unit setvariable [QGVAR(addedToUnitLoop), false, true];
_unit setvariable [QGVAR(inCardiacArrest), false, true];
_unit setVariable ["ACE_isUnconscious", false, true];
_unit setvariable [QGVAR(hasLostBlood), 0, true];
_unit setvariable [QGVAR(isBleeding), false, true];
_unit setvariable [QGVAR(hasPain), false, true];
_unit setvariable [QGVAR(amountOfReviveLives), GVAR(amountOfReviveLives), true];

// medication
_allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []];
{
  _unit setvariable [_x select 0, nil];
} foreach _allUsedMedication;
_unit setVariable [QGVAR(allUsedMedication), [], true];

_logs = _unit getvariable [QGVAR(allLogs), []];
{
   _unit setvariable [_x, nil];
} foreach _logs;
_unit setvariable [QGVAR(allLogs), [], true];

// items
[{
   _this call FUNC(itemCheck);
}, [_unit], 0.5, 0.1] call EFUNC(common,waitAndExecute);

Edited by DaVIdoSS

Share this post


Link to post
Share on other sites
Who said that i am calling them bad?

They are doing great work and maybe some day we get all stuff working.

For now if you play with AI they cant help you. And that is lazy for me not the devTeam.

my mistake, i misread your post i suppose.

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
Sign in to follow this  

×