Jump to content
Sign in to follow this  
DarkRise

Need help for SP revive script

Recommended Posts

Hi all,

desperate to see that BI don't want to add a SP revive function in Arma 3, I decided to create one for my mission but I can't use the one of Norrin because there is a bug with my mission : my team become invincible x) !

So, I'm almost done with the script but some problems remain :

I have four playable units : unit1, unit2, unit3 and unit4. unit1 is the team leader/player.

1 - there is my first script (named "test.sqf") and First problem : I don't know how to apply this script to all the members of my team so for the example, I choose unit3 :

_damage = damage unit3;
_Hurt = _damage > 0.5;
if (_Hurt) then {unit3 execVM "injured.sqf"} else {execVM "test.sqf"};

For this, I want to know how can I get the damages of unit1 to unit4 and check if _damage > 0.5 to execute injured.sqf for all of the units who are hurt.

2 - Injured.sqf, same problem than test.sqf :

unit3 allowDamage false;
unit3 playMove "AinjPpneMstpSnonWrflDnon_rolltoback";
sleep 3;
unit3 playMove "AinjPpneMstpSnonWrflDnon_InhuredHealed";
unit3 DisableAI "MOVE";
unit3 addAction ["Revive", "Heal.sqf", nil, 6, true, true, "", "(_target distance _this) < 2"];

3 - Heal.sqf - the most Important = First, I don't know if the 3 variables are correct (_wounded = the wounded / _medic = the caller of the action / _revive = the ID of the action); _medic playmove ... seems to do nothing (I think the problem is _medic) and finally, player playmove "animation_name" doesn't work, but work with an AI, do you have an idea ? :

_wounded = this select 0;
_medic = this select 1;
_revive = this select 2;

_medic playmove "Acts_TreatingWounded_in";
sleep 3;
_medic playmove "Acts_TreatingWounded01";
sleep 5;
_medic playmove "Acts_TreatingWounded02";
sleep 8;
_medic playmove "Acts_TreatingWounded03";
sleep 9;
_medic playmove "Acts_TreatingWounded_Out";
sleep 4;
_medic setDamage 0;
sleep 2;
unit3 playMove "AinjPpneMstpSnonWrflDnon_rolltofront";
sleep 3;
unit3 playMove "AmovPpneMstpSrasWrflDnon_AmovPercMstpSrasWrflDnon";
unit3 setCaptive false;
unit3 allowDamage true;
_wounded removeAction _revive;

Thanks for the help ^^ !

Edited by DarkRise

Share this post


Link to post
Share on other sites

in the init of all those players you wish to allocate the revive to - place this...

DRiseRevive = [] execVM "DRRivive.sqf";

DRRivive.sqf

_unitPlayer = _this;

while {true}
{
_damage = damage _unitPlayer;

waituntil {_damage > 0.5};

   [unitPlayer] execVM "injured.sqf";

waituntil {_damage <= 0.5};
};

Injured.sqf

_unitPlayer = _this;
_unitPlayer allowDamage false;
_unitPlayer playMove "AinjPpneMstpSnonWrflDnon_rolltoback";
sleep 3;
_unitPlayer playMove "AinjPpneMstpSnonWrflDnon_InhuredHealed";
_unitPlayer DisableAI "MOVE";
_unitPlayer addAction ["Revive", "Heal.sqf", nil, 6, true, true, "", "(_target distance _this) < 2"]; 

Heal.sqf

_wounded = this select 0;
_medic = this select 1;
_actionId = this select 2;
//medic does his bit - person who activated the script
_medic playmove "Acts_TreatingWounded_in";
sleep 3;
_medic playmove "Acts_TreatingWounded01";
sleep 5;
_medic playmove "Acts_TreatingWounded02";
sleep 8;
_medic playmove "Acts_TreatingWounded03";
sleep 9;
_medic playmove "Acts_TreatingWounded_Out";
sleep 4;


//wounded person - the person with the addaction applied to him
_wounded setDamage 0;
sleep 2;
_wounded playMove "AinjPpneMstpSnonWrflDnon_rolltofront";
sleep 3;
_wounded playMove "AmovPpneMstpSrasWrflDnon_AmovPercMstpSrasWrflDnon";
_wounded setCaptive false;
_wounded allowDamage true;
_wounded removeAction _revive; 

Not tested but appears to be a reasonable way of doing it

Share this post


Link to post
Share on other sites

Hi, thanks for your answer but it doesn't seem to work. I've try to rewrite some of the DRRevive.sqf code, but I can't get something that work. Are you sure this code is for a Single Player usage ?

Share this post


Link to post
Share on other sites

Sorry my bad - i really didnt check your code thoroughly and worse still, i didnt check that which i provided you

Tested below and it works :)

init of players that can be healed (done via editor)

DRRevive = [this] execVM "DRRevive.sqf";

DRRevive.sqf

private ["_unitPlayer"];
_unitPlayer = _this select 0;

while {true} do
{

waituntil {damage _unitPlayer > 0.5};

   [_unitPlayer] execVM "injured.sqf";

waituntil {damage _unitPlayer <= 0.5};
};

injured.sqf

_unitPlayer = _this select 0;
_unitPlayer allowDamage false;
_unitPlayer playMove "AinjPpneMstpSnonWrflDnon_rolltoback";
sleep 3;
_unitPlayer playMove "AinjPpneMstpSnonWrflDnon_InhuredHealed";
_unitPlayer DisableAI "MOVE";
_unitPlayer addAction ["Revive", "Heal.sqf", nil, 6, true, true, "", "(_target distance _this) < 2"];

heal.sqf

_wounded = _this select 0;
_medic = _this select 1;
_actionId = _this select 2;

//medic does his bit - person who activated the script
_medic playAction  "Medic";
sleep 3;

//wounded person - the person with the addaction applied to him
_wounded setDamage 0;
sleep 2;
_wounded playMove "AinjPpneMstpSnonWrflDnon_rolltofront";
sleep 3;
_wounded playMove "AmovPpneMstpSrasWrflDnon_AmovPercMstpSrasWrflDnon";
_wounded setCaptive false;
_wounded allowDamage true;
_wounded removeAction _actionId;

those animations for the healing were working - and i couldnt be bothered to work out the correct command - sorry - but least its working

Mike

Share this post


Link to post
Share on other sites

Thanks, it works, finally !! But I found two problems, the wounded can be auto-revive (so is there a way to remove the action just for _wounded ?). And if the unit take the damage too fast, the script is not executed, and the unit die. And I've found nothing on google but if you know how I can execute the animViewer animations by the player, it could be very usefull for me ^^ ! I have already tried playMove/switchMove, and there is too many BIS functions... :'(

Share this post


Link to post
Share on other sites

best way to tackle this is using addeventhandler - killed and respawn

when player dies you can make it so that it appears he is just unconscious - then invoke the eventhandler to call your heal script. that way there is no auto revive.

not really messed around with new animations sorry so not sure how to call them correctly. If i get a chance ill see if i can knock up a quick script to demonstrate the eventhandlers - in the meantime if you dont understand eventhandlers then check out the wiki page. I think in chapter 3 of my tutorials (click on my sig) there is stuff on evethandlers - basic but gives you an understanding

Share this post


Link to post
Share on other sites

I can't try it now but what about the selectPlayer or selectNoPlayer ? If the animation works for the AI and I remove the input of the player on the unit during the animation, it become an AI, and the animation will works ?

thank you for your answer, you help me a lot ^^ !

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  

×