Jump to content
Sign in to follow this  
Doofy

Flight medical surgeon script

Recommended Posts

I have been trying for sometime now to create once the medic is inside of the chopper he is able to heal wounded units vea add actions and a couple simple scripts but cant seem to get more addictions to come up with in the script.So im wondering if there is anyone here that would like to help me on it or has any input.I want to be able to add 5 add actions. 1.Apply bandages 2.Check vitals 3.apply EPI 4.Apply morphine 5.Check vitals, then when the last one is complete have it come up Vitals are stable and only heals the unit 80 percent..Any thing would be greatly appreciated..Thank you gents

Share this post


Link to post
Share on other sites

_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

That add action will only appear once the player is inside a helicopter named ch1. Colour is red.

For all you want there will be no animations, AI will all be sitting in their seats.

Simple heal script to 80%:

private ["_target","_caller","_id","_actionId"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;

_target removeAction _id;

sleep 5;
hint "1st aid complete";
_target removeAction _actionId;
_caller setDamage 0.2;
sleep 3;
hint "";

Share this post


Link to post
Share on other sites

lol you should see mine..I was way over thinking lol Thank you so much

---------- Post added at 20:36 ---------- Previous post was at 20:18 ----------

ouu it wont work with ace ..hmmm permision to mess around with code?

---------- Post added at 21:04 ---------- Previous post was at 20:36 ----------

oh and how can i get it so it the caller isnt the one.the flight medic will be inside so i want him to be able to heal everyone.not the caller. ill give you a cookie :)))) hehe

Share this post


Link to post
Share on other sites
_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

That add action will only appear once the player is inside a helicopter named ch1. Colour is red.

For all you want there will be no animations, AI will all be sitting in their seats.

Simple heal script to 80%:

private ["_target","_caller","_id","_actionId"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;

_target removeAction _id;

sleep 5;
hint "1st aid complete";
_target removeAction _actionId;
_caller setDamage 0.2;
sleep 3;
hint "";

That looks very useful, thanks for sharing & to Doofy for a +1 idea.

Three questions:

1. Could it be modified so that a medic in the player's team will treat all wounded inside any vehicle (such as a truck, boat, etc.) the medic is in?

2. Could it be modified so that any & all medics can treat wounded when they & the casualties are in any vehicle?

3. If the answer to Q.2 is yes, would it be possible to apply it also to medics spawned later in the mission?

As you've probably guessed, I'm very much a beginner at scripting, but this could fill what is IMHO a signal lack in the vanilla game. There are some nice medic automation scripts & addons such as COSLX and Demonized's Automedic script, but healing (especially automated) inside vehicles would be really cool. I like that you limited the amount of healing - mimics emergency treatment in a confined or limited space.

BR

Orcinus

Share this post


Link to post
Share on other sites

I would love to take credit for the code but it was just the idea that i brought up :) Not really what I'm after with Ace though.. i kind of want like the same thing as the ace wounding module but only works inside the chopper and only by a medic ..Only he can heal everyone else in the chopper but the huge script I'm working on now will hopefully add Five add actions..I'm trying to figure out a way to use the attach script in mid flight then once you have come close to your patients you'll get five add actions with dialog.making it more realistic then when done back to original seat.. Repeating the process over and over.. Hence Flight surgeon only thing I'm getting stuck on is finding out who is wounded with in the chopper then have the add action come up .I just attached a trigger for a hint but cant figure out the code though.

Share this post


Link to post
Share on other sites
Doofy, doesn't ACE already have this? Reinventing the wheel?

@all: just to be clear, I'm hoping for something that will work in non-ACE missions. Quite happy if it doesn't have animations. One addendum to my earlier post - I think any such script should heal in a pseudo-realistic time-frame, i.e. with duration proportionate to the damage. Wouldn't do to have instant, magic healing for a whole truckload of injured.

@Doofy: there are three existing addons I know of that have routines for detecting injured and directing units to them:

- SLX (search for COSLX thread), though that probably isn't the best as it directs all sufficiently close units (unless under fire, etc.) to heal any wounded, even enemies.

- Demonized's Automedic script (very nice, I use it a lot in my own missions)

- DAP's DAPMAN (addon)

those addons might give you some ideas, also both authors seem very approachable as well as skilled & might respond to a request for advice if you get stuck.

BR

Orcinus

Share this post


Link to post
Share on other sites
_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("Stabilize Patient") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

That add action will only appear once the player is inside a helicopter named ch1. Colour is red.

For all you want there will be no animations, AI will all be sitting in their seats.

Simple heal script to 80%:

private ["_target","_caller","_id","_actionId"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;


sleep 2;
hint "Applying bandages";
_unit setDamage 0.4;
sleep 10;
hint "Checking vitals";
_unit setDamage 0.3;
sleep 5;
hint "Patient is Hypertension 140-160mmHg, Hearts BPM 80-100, 9-14 Breaths/Minute";
sleep 3;
hint "Applying EPI";
_unit setDamage 0.2;
sleep 12;
hint "Applying Morphine";
_unit setDamage 0.1;
sleep 12;
hint "Checking vitals";
sleep 5;
hint "Vitals are good patient is stable";

would this be more realistic time frame?

---------- Post added at 11:33 ---------- Previous post was at 11:28 ----------

@all: just to be clear, I'm hoping for something that will work in non-ACE missions. Quite happy if it doesn't have animations. One addendum to my earlier post - I think any such script should heal in a pseudo-realistic time-frame, i.e. with duration proportionate to the damage. Wouldn't do to have instant, magic healing for a whole truckload of injured.

@Doofy: there are three existing addons I know of that have routines for detecting injured and directing units to them:

- SLX (search for COSLX thread), though that probably isn't the best as it directs all sufficiently close units (unless under fire, etc.) to heal any wounded, even enemies.

- Demonized's Automedic script (very nice, I use it a lot in my own missions)

- DAP's DAPMAN (addon)

those addons might give you some ideas, also both authors seem very approachable as well as skilled & might respond to a request for advice if you get stuck.

BR

Orcinus

Thanks for the help..there's some good people on this site.good people

Share this post


Link to post
Share on other sites

Had a go at this and come up with the following, hope there are some ideas in there for you:

Medics init: nul = [this] execVM "medic2.sqf";

private ["_wounded","_caller","_medicGrp","_time"];
_caller=_this select 0;
_medicGrp = group _caller;

while {true} do {
if ((vehicle _caller != _caller) && (alive _caller) && ({getDammage _x >[color="#FF0000"]0[/color]} count units _medicGrp) != 0) then {
         _wounded = {getDammage _x > 0} count units _medicGrp;
       vehicle _caller vehicleChat format ["%1 Wounded on board, medic giving 1st aid",_wounded];
_time = _wounded * 2;
          sleep _time;
{_x setDamage [color="#FF0000"]0[/color]} forEach units _medicGrp;
          vehicle _caller vehicleChat "1st aid complete";
};
};

Change the red 0's to other values eg 0.2 for 80% damage

If you want to count the entire crew change the count units / for each units to crew (vehicle _caller) eg:

if ((vehicle _caller != _caller) && (alive _caller) && ({getDammage _x} count (crew (vehicle _caller)) != 0)) then {

and

_wounded = {getDammage _x > 0} count crew (vehicle _caller);

Share this post


Link to post
Share on other sites

its just now wanting to work with ACE or ACE 2 :( im not going to sleep tell i figure this out..Are flyboys for are clan want this real bad

Share this post


Link to post
Share on other sites
Had a go at this and come up with the following, hope there are some ideas in there for you:

Not sure if this was aimed at me or at Doofy, but it has certainly given me some ideas - thanks! :)

@doofy: yes, adding sleep statements in there would be fine. Since I won't be using Ace for the missions I'm currently working on I'ld leave out most of the hints, though. I think I'll try to put in a conditional statement that varies the sleep proportionate to the level of damage, which seems clearer now. Thanks for the pointer.

BR

orcinus

Edited by Orcinus

Share this post


Link to post
Share on other sites
Had a go at this and come up with the following, hope there are some ideas in there for you:

Medics init: nul = [this] execVM "medic2.sqf";

private ["_wounded","_caller","_medicGrp","_time"];
_caller=_this select 0;
_medicGrp = group _caller;

while {true} do {
if ((vehicle _caller != _caller) && (alive _caller) && ({getDammage _x >[color="#FF0000"]0[/color]} count units _medicGrp) != 0) then {
         _wounded = {getDammage _x > 0} count units _medicGrp;
       vehicle _caller vehicleChat format ["%1 Wounded on board, medic giving 1st aid",_wounded];
_time = _wounded * 2;
          sleep _time;
{_x setDamage [color="#FF0000"]0[/color]} forEach units _medicGrp;
          vehicle _caller vehicleChat "1st aid complete";
};
};

Change the red 0's to other values eg 0.2 for 80% damage

If you want to count the entire crew change the count units / for each units to crew (vehicle _caller) eg:

if ((vehicle _caller != _caller) && (alive _caller) && ({getDammage _x} count (crew (vehicle _caller)) != 0)) then {

and

_wounded = {getDammage _x > 0} count crew (vehicle _caller);

Ive even tried simple stuff like this

_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("Stabilize Patient") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

this setVariable ["ace_w_heal", true];

Also added in the init of chopper so both but no go^

private ["_target","_caller","_id","_actionId"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;


sleep 2;
hint "Applying bandages";
["ace_sys_wounds_rev", {
   // This code will be executed when PMR enabled, and killed (but can still be revived), countdown starting
   // _this select 0  contains the unit
}] call CBA_fnc_addEventhandler;

};
["ace_sys_wounds_rev2", {
  // This code will be executed when PMR enabled, and killed (countdown ended)
  // _this select 0  contains the unit
}] call CBA_fnc_addEventhandler;

};
sleep 5;
hint "Vitals are good patient is stable";

Idk lol im wracking my brain

Share this post


Link to post
Share on other sites

@doof

For that add action to work in an init you need to name the helicopter to ch1 or change the line to this, then you can use it on any vehicle. You will also need a script saved in the mission folder as medic.sqf

this addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic.sqf", [], 1, true, true, "", "vehicle player != player"];

Share this post


Link to post
Share on other sites

almost had it in ace but it kept breaking :( im keeping on keeping on

Share this post


Link to post
Share on other sites

Got it working for Ace and Ace 2 but doesn't have all the animations

what you put in the chopper named ch1

_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

code

private ["_target","_caller","_id"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;



sleep 2;
hint "Checking patient";
sleep 10;
hintsilent "Applying bandages";
_caller setDamage 0;
_caller setVariable ["ace_w_bleed", 0];
sleep 2;
_caller setVariable ["ace_w_bleed", 0];
sleep 10;
hintsilent "Applying Morphine";
   playSound "ACE_Injector";
_caller setVariable ["ace_w_pain", 0];
sleep 2;
_caller setVariable ["ace_w_pain", 0];
sleep 10;
hintsilent "Applying EPI";
   playSound "ACE_Injector";
_caller setVariable ["ace_w_state", 0];
sleep 2;
_caller setVariable ["ace_w_state", 0];
sleep 10;
hintsilent "Checking Vitals";
sleep 8;
hint "Patient is stable vitals are good";
_caller setVariable [QGVAR(uncon),false,false];

i plan on making it so that just a medic inside the chopper finds the wounded then does this .But for main testing and for guys that just want the simple on here ya go.oh mess around with it

Edited by Doofy

Share this post


Link to post
Share on other sites

Hi Doofy

Thanks for posting this (and again, thanks for a really good idea!) - I'll try to make a non-ACE version.

I'm surprised that any animations work inside the chopper - I think I read somewhere that it was an engine limitation, but I (or whoever posted that wherever) could be wrong.

Cheers

Orcinus

Share this post


Link to post
Share on other sites

yeah Ive been messing around with Attach command but when in seated position in the chopper and you scroll to move to patient you get stuck in between..still working on it though..And in theory they should as long as the unit is attached to the chopper...Haven't got to the animations yet .still working out the platform..

Edited by Doofy

Share this post


Link to post
Share on other sites

if someone could have a go at this and let me know what im doing wrong it would be great..K so i have the code you put in he Init of the chopper called ch1

_nul = [this] execVM "medic.sqf";

then i have the first script in the main mission folder named medic.sqf calling the add action if wounded is inside Ch1

private ["_target","_wounded","_id"];
_target=_this select 0;
_wounded=("ace_w_bleed", 0.1);
_id=_this select 2;




waitUntil {_wounded distance ch1 < 6};
hint "wounded on board";
_target addAction ["Check Patient", "scripts\medic2.sqf", [], 11, false, true, "", "player in (crew ch1)"];
sleep 2;

when Add action is pressed i want it to start healing the wounded ..a alive player would haft to call it of course.

private ["_wounded","_medicGrp"];

_medicGrp = ch1

while {true} do {
if (alive _medicGrp) && ({getDammage _x >0} count units _medicGrp) != 0) then {
_wounded = {getDammage _x > 0} count units _medicGrp;
forEach units _medicGrp;
_wounded setUnconscious false; 
sleep 2;
hintsilent "Checking patient";
sleep 10;
hintsilent "Applying bandages";
_wounded setDamage 0;
_wounded setVariable ["ace_w_bleed", 0];
sleep 2;
_wounded setVariable ["ace_w_bleed", 0];
sleep 10;
hintsilent "Applying Morphine";
   playSound "ACE_Injector";
_wounded setVariable ["ace_w_pain", 0];
sleep 2;
_wounded setVariable ["ace_w_pain", 0];
sleep 10;
hintsilent "Applying EPI";
   playSound "ACE_Injector";
_wounded setVariable ["ace_w_state", 0];
sleep 2;
_wounded setVariable ["ace_w_state", 0];
sleep 10;
hintsilent "Checking Vitals";
sleep 8;
hint "Patient is stable vitals are good";

Any help would be greatly appreciated :) i just need a alive player to call this script that looks for wounded and heals them no animations..im still working on that

Share this post


Link to post
Share on other sites

Hey PELHAM.

Been trying out this way you said:

_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

And then this:

private ["_target","_caller","_id","_actionId"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;

_target removeAction _id;

sleep 5;
hint "1st aid complete";
_target removeAction _actionId;
_caller setDamage 0.2;
sleep 3;
hint "";

But it only lets me heal the once. After heal the action is gone, even in the chopper the action isnt there anymore. When your hit you can also

heal "AT THE CHOPPER" outside of it. So how to do it so it can be constant revives as in for a medivac script and only in the chopper not outside if possible.

Thanks

Share this post


Link to post
Share on other sites
Hey PELHAM.

Been trying out this way you said:

_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

And then this:

private ["_target","_caller","_id","_actionId"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;

_target removeAction _id;

sleep 5;
hint "1st aid complete";
_target removeAction _actionId;
_caller setDamage 0.2;
sleep 3;
hint "";

But it only lets me heal the once. After heal the action is gone, even in the chopper the action isnt there anymore. When your hit you can also

heal "AT THE CHOPPER" outside of it. So how to do it so it can be constant revives as in for a medivac script and only in the chopper not outside if possible.

Thanks

_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

private ["_target","_caller","_id","_actionId"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;

sleep 5;
_caller setDamage 0.2;
hint "1st aid complete";
sleep 3;
hint "";

:) there you go buddy

Share this post


Link to post
Share on other sites

Well for me either of these two lines does not show the action outside the chopper because of the condition at the end??? Not sure why it doesn't work for you.

_actionid = ch1 addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic3.sqf", [], 1, true, true, "", "player in (crew ch1)"];

or

this addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic.sqf", [], 1, true, true, "", "vehicle player != player"];

For continued revive get rid of the line that removes the addaction, at it's simplest it would be this:

private ["_caller"];
_caller=(_this select 1);

sleep 5;
hint "1st aid complete";
_caller setDamage 0;
sleep 3;
hint "";

Edited by PELHAM

Share this post


Link to post
Share on other sites
_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("1st Aid") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

private ["_target","_caller","_id","_actionId"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;

sleep 5;
_caller setDamage 0.2;
hint "1st aid complete";
sleep 3;
hint "";

:) there you go buddy

Thanks alot mate :)

Share this post


Link to post
Share on other sites

Hey Pelham i was messing around with what you were saying and dont know what im doing wroung i mean it looks legit lol .could you take a look at her for me ..anyone take a look would be great lol

This i added to ch1 heli

_actionId1 = ch1 addAction [("<t color=""#FF3300"">" + ("Check wounded") +"</t>"), "medic.sqf", [], 1, true, true, "", "player in (crew ch1)"];

then this medic.sqf

private ["_target","_caller","_id","_actionId"];
_target=_this select 0;
_caller=(_this select 1);
_id=_this select 2;


sleep 8;
hint "Checking Patient";
sleep 3;
hint "";

Then i have this in the init line of medic then under the sqf named medic2.sqf

nul = [this] execVM "medic2.sqf";

private ["_wounded","_caller","_medicGrp"];
_caller=_this select 0;
_medicGrp = group _caller;

while {true} do {
if ((vehicle _caller != _caller) && (alive _caller) then {
         _wounded = {getDammage _x > 0} count units _medicGrp;
       vehicle _caller vehicleChat format ["%1 Wounded on board, medic giving 1st aid",_wounded];
hint "working";
{_x setDamage 0} forEach units _medicGrp;
hintsilent "Applying bandages";
{_x setVariable ["ace_w_bleed", 0]} forEach units _medicGrp;
sleep 15;
hintsilent "Applying Morphine";
playSound "ACE_Injector";
{_x setVariable ["ace_w_bleed", 0]} forEach units _medicGrp;
sleep 12;
hintsilent "Applying EPI";
playSound "ACE_Injector";
{_x setVariable ["ace_w_pain", 0]} forEach units _medicGrp;
sleep 10;
hintsilent "Checking Vitals";
{_x setVariable ["ace_w_state", 0]} forEach units _medicGrp;
sleep 8;
hint "Patient is stable vitals are good";
          vehicle _caller vehicleChat "1st aid complete";
};
};

im begging for some pointers..That first hint.."working is what im trying to get to lol

Edited by Doofy

Share this post


Link to post
Share on other sites

lol i cant believe that.evrytime ..i had it in my bat file for my shortcut but then my computer took a crap so haven't done the bat files yet..I downloaded squint but it does not want to open now ..

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  

×