Jump to content
lululala22

Problem with setVariable, getVariable in editing FAR revive

Recommended Posts

I edited FAR revive script in GREUH Liberation so AI can revive players and be reivived by players.

but a problem happed with players reviving another player

 

this is what is executed on the unit revivng another:

FAR_HandleStabilize =
{

	params ["_target", "_healer"];

	if (alive _target) then
	{
		_healer playMove "AinvPknlMstpSlayWrflDnon_medic";

		//if (!("Medikit" in (items _healer)) ) then {
			//player removeItem "FirstAidKit";
		//};

		_target setVariable ["FAR_isStabilized", 1, true];

		sleep 6;
	};
};

 

this is what is excuted on the unit injured:

while { !isNull _unit && alive _unit && _unit getVariable "FAR_isUnconscious" == 1 && _unit getVariable "FAR_isStabilized" == 0 && (FAR_BleedOut <= 0 || time < _bleedOut) } do {
	hintSilent format[localize "STR_BLEEDOUT_MESSAGE" + "\n\n%2", round (_bleedOut - time), call FAR_CheckFriendlies];
	public_bleedout_message = format [localize "STR_BLEEDOUT_MESSAGE", round (_bleedOut - time)];
	public_bleedout_timer = round (_bleedOut - time);

	sleep 0.5;
};

 

when a unit stabilize another unit, "FAR_isStabilized" variable of the injured unit is set to 1 so the while loop has to terminate

these script run without any problem when AI revive players and AI are revived by players

but don't work when a player is reviving another player.

 

when a player tries to stabilize another player, it does the action "AinvPknlMstpSlayWrflDnon_medic" but that while loop doesn't finish so I think there is something wrong with

_target setVariable ["FAR_isStabilized", 1, true];in the FAR_HandleStabilize function and _unit getVariable "FAR_isStabilized" == 0 in condition of the while loop

 

full codes:

https://github.com/lululala22/JLD_Liberation_Dev/tree/master/far_revive

Share this post


Link to post
Share on other sites

How does it not work?  Does it give a script error, does the variable not get updated, ...?

Share this post


Link to post
Share on other sites

you should diag_log [_target, _healer]; to check if your parameters are correct

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

×