-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add revive modules for Farooq's Revive (#386)
* Support Farooq's Revive The ACE Heal module supports reviving the selected player when Farooq's Revive script is active. It still takes seconds for the player to be up because of Farooq's Revive script. * Support Arma 3 revive system in Heal module * Add Immersive Heal The new Immersive Heal module gives a more realistic feeling compared to the ACE Heal module by sending an AI to revive or heal a player. It has two modes of operation: * When placed on a player the nearest AI of the same side will be sent to revive the player. * When placed on an AI the nearest player (regardless of side) will be revived. Also works on vehicles which will drive up to the player before the driver exits and revives the player. * Fix formatting * Fix healing multiple units with Arma3 revive system * Simplify multi-selection checks * Use lazy evaluation * Fix formatting * Fix variable name * Fix misplaces tab character * Localize * Fix spelling * revie -> revive * unconsious -> unconscious * no dot at end of Zeus messages * Update header and footer includes * Remove punctuation at end of more Zeus bar messages * Use remoteExecCall instead of remoteExec * Rename _revive to _fnc_reviveUnit This states more clearly that it's a function to call. * Localize 'Healed' message * Localize remaining 'Healed' message * Lower search range for immersive heal to 300
- Loading branch information
1 parent
676e895
commit 52d9d54
Showing
6 changed files
with
239 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
...odAchillesExpansion/addons/modules_f_achilles/ACE/functions/fn_ModuleACEImmersiveHeal.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// AUTHOR: ServiusHack | ||
// DESCRIPTION: Command an AI unit to revive a player using farooq's Revive. | ||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
#include "\achilles\modules_f_ares\module_header.inc.sqf" | ||
|
||
#include "\a3\functions_f_mp_mark\revive\defines.inc" | ||
|
||
// Command an AI (second parameter) to revive a player (first parameter). | ||
private _fnc_reviveUnit = { | ||
params ["_player", "_ai"]; | ||
|
||
// Let Zeus know what will happen | ||
[format [localize "STR_AMAE_REVIVE_PLAYER", name _player]] call Ares_fnc_ShowZeusMessage; | ||
|
||
private _vehicle = vehicle _ai; | ||
|
||
if (_vehicle isEqualTo _ai) then | ||
{ | ||
// move unit to perform the revive | ||
_ai doMove (getPos _player); | ||
} else | ||
{ | ||
// make vehicle drive to the player | ||
driver _vehicle doMove (getPos _player); | ||
|
||
// wait for vehicle to be close enough | ||
// Make sure we're close to get off when the vehicle stands still. | ||
waitUntil{ (speed _vehicle) < 0.1 && (_ai distance _player) < 20 }; | ||
|
||
// make sure the vehicle stops | ||
doStop driver _vehicle; | ||
|
||
// make the unit leave the vehicle | ||
_ai action ["GetOut", _vehicle]; | ||
_ai leaveVehicle _vehicle; | ||
|
||
// finally move unit to perform the revive | ||
_ai doMove (getPos _player); | ||
}; | ||
|
||
waitUntil{ (_ai distance _player) < 2 }; | ||
|
||
// make it look nice | ||
_ai lookAt _player; | ||
sleep 2; | ||
_ai playMove "AinvPknlMstpSnonWnonDnon_medic1"; | ||
_ai playMove "AinvPknlMstpSnonWnonDnon_medicEnd"; | ||
_ai playMove "AinvPknlMstpSnonWnonDnon_AmovPercMstpSnonWnonDnon"; | ||
_ai playMove "AmovPknlMstpSnonWnonDnon_AmovPercMstpSnonWnonDnon"; | ||
|
||
// do the actual revive | ||
if (isClass (configfile >> "CfgPatches" >> "ace_medical")) then | ||
{ | ||
if (local _player) then | ||
{ | ||
[_player, _player] call ace_medical_fnc_treatmentAdvanced_fullHealLocal | ||
} else | ||
{ | ||
[_player, _player] remoteExecCall ["ace_medical_fnc_treatmentAdvanced_fullHealLocal", _player] | ||
}; | ||
}; | ||
|
||
if (!isNil "FAR_ReviveMode") then | ||
{ | ||
_player setVariable ["FAR_isUnconscious", 0, true]; | ||
_player setVariable ["FAR_isDragged", 0, true]; | ||
}; | ||
|
||
if (REVIVE_ENABLED(_player) && lifeState _player == "INCAPACITATED" && IS_DISABLED(_player)) then | ||
{ | ||
SET_STATE(_player, STATE_REVIVED); | ||
} else | ||
{ | ||
_player setDamage 0; | ||
}; | ||
|
||
// stop always looking at the revived player | ||
_ai lookAt objNull; | ||
}; | ||
|
||
// Gets the object that the module was placed upon | ||
private _object = [_logic, false] call Ares_fnc_GetUnitUnderCursor; | ||
|
||
// Displays error message if no object or unit has been selected. | ||
if (isNull _object) exitWith | ||
{ | ||
[localize "STR_AMAE_NO_UNIT_SELECTED"] call Achilles_fnc_ShowZeusErrorMessage; | ||
}; | ||
|
||
if (isPlayer _object || isPlayer driver _object) exitWith | ||
{ | ||
// find nearest units | ||
private _nearestUnits = nearestObjects [_object, ["man", "landvehicle"], 300]; | ||
|
||
// find closest AI unit of same side | ||
private _sameSideUnitIndex = _nearestUnits findIf { side group _object isEqualTo side driver _x && !isPlayer driver _x }; | ||
|
||
if (_sameSideUnitIndex == -1) exitWith | ||
{ | ||
[localize "STR_AMAE_REVIVE_NO_NEAR_UNITS"] call Achilles_fnc_ShowZeusErrorMessage; | ||
}; | ||
|
||
// spawn off movement and revive action | ||
[driver _object, driver (_nearestUnits select _sameSideUnitIndex)] spawn _fnc_reviveUnit; | ||
}; | ||
|
||
// Make sure we use a unit. Vehicles support kicks in later. | ||
_object = driver _object; | ||
|
||
if (!isNull _object) exitWith | ||
{ | ||
// find all unconsious players | ||
private _unconsiousPlayers = allPlayers select { _x getVariable ["FAR_isUnconscious", 0] == 1 }; | ||
|
||
// find nearest player to revive | ||
private _sortedPlayers = [_unconsiousPlayers, [], {_x distance _object}, "ASCEND"] call BIS_fnc_sortBy; | ||
private _nearestPlayer = _sortedPlayers select 0; | ||
|
||
if (isNil "_nearestPlayer") exitWith { [localize "STR_AMAE_NO_PLAYER_UNCONSCIOUS"] call Achilles_fnc_ShowZeusErrorMessage; }; | ||
|
||
// spawn off movement and revive action | ||
[_nearestPlayer, _object] spawn _fnc_reviveUnit; | ||
}; | ||
|
||
[localize "STR_AMAE_REVIVE_INVALID_SELECTION"] call Achilles_fnc_ShowZeusErrorMessage; | ||
|
||
#include "\achilles\modules_f_ares\module_footer.inc.sqf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters