Jump to content
KC Grimes

Grimes Simple Revive Script

Recommended Posts

Post-release, I noticed one minor bug but @Rockapes noticed a bigger bug that caused G_fnc_initNewAI to not function. These issues have been corrected. A minor optimization was also included.

 

Please see OP for a re-release of V0.92 to include these hotfixes. Sorry for the inconvenience. Thanks for playing, and thanks for the feedback!

  • Like 1

Share this post


Link to post
Share on other sites

Hello Grimes,

 

I'm really enjoying this script. However, I'm having some issues with the AI respawn on a dedicated server mission I'm creating. I want players to respawn at my editor placed respawn position module (which they do when not revived in time), while I want the squad AI (in playable slots) to respawn on the leader. I looked at G_Revive_init.sqf, lines 37-47. I left line 37 like this: G_Squad_Leader_Spawn = false; because I didn't want the players having the option of spawning in on the leader (if they didn't get revived in time of course). For line 43: G_AI_Fixed_Spawn_WEST = "respawn_west_0";  I didn't place the respawn_west_0 marker because I don't want the AI to respawn at a fixed marker far from the action (big map Prei Khmaouch Luong).

 

I did notice the custom execution section at the bottom, specifically line 79: G_Custom_Exec_2 = ""; //File executed when unit is killed (not revivable; unit is officially killed). _killedUnit = _this select 0, and is local. I was thinking this might be a good location to call another .sqf that defines the fix for the above issue, although not sure what that would be.

 

This may not be possible with the script in it's current state, if you have any suggestions please let me know, as I'd like to include your script in the final release of the mission if possible, thanks!

 

*edit

So I made the code "spoiler" while also placing a system(invisible) marker: respawn_west_0 on the map.

 

Spoiler

if (isSever || hasInterface) then
{
_killedUnit = _this select 0;
if (!isPlayer _killedUnit) then
    {
while {true} do
        {
  "respawn_west_0" setMarkerPosLocal (getPos leader player);
  sleep 0.5;
        };
    };
} forEach playableUnits;

 

I'd like to test this, although probably incorrect. How do I insert this code into line79 of the G_Revive_init.sqf G_Custom_Exec_2 = ""; //File executed when unit is killed (not revivable; unit is officially killed). _killedUnit = _this select 0, and is local?

Edited by 4-325Ranger

Share this post


Link to post
Share on other sites
1 hour ago, 4-325Ranger said:

Hello Grimes,

 

I'm really enjoying this script. However, I'm having some issues with the AI respawn on a dedicated server mission I'm creating. I want players to respawn at my editor placed respawn position module (which they do when not revived in time), while I want the squad AI (in playable slots) to respawn on the leader. I looked at G_Revive_init.sqf, lines 37-47. I left line 37 like this: G_Squad_Leader_Spawn = false; because I didn't want the players having the option of spawning in on the leader (if they didn't get revived in time of course). For line 43: G_AI_Fixed_Spawn_WEST = "respawn_west_0";  I didn't place the respawn_west_0 marker because I don't want the AI to respawn at a fixed marker far from the action (big map Prei Khmaouch Luong).

 

I did notice the custom execution section at the bottom, specifically line 79: G_Custom_Exec_2 = ""; //File executed when unit is killed (not revivable; unit is officially killed). _killedUnit = _this select 0, and is local. I was thinking this might be a good location to call another .sqf that defines the fix for the above issue, although not sure what that would be.

 

This may not be possible with the script in it's current state, if you have any suggestions please let me know, as I'd like to include your script in the final release of the mission if possilbe, thanks!

 

 

 

Just to clarify, the issue you are having is that you do not know how to get the AI to spawn on their squad leader? 

 

If that is the case, sorry I did not get around to this feature in time! This is mostly due to the fact that it is an easy workaround, though there are some catches, which I will get to. Anyway, you actually want to execute your custom script with G_Custom_Exec_3, which will handle the unit on respawn. Something like this should do the trick:

 

script.sqf

//Script to move AI to squad leader on respawn
//_respawnedUnit is local
params ["_respawnedUnit"];
//Only move AI to squad leader
if (!isPlayer _respawnedUnit) then {
	//Handling AI, so move them to squad leader
	_respawnedUnit setPos (leader group _respawnedUnit);
	//Assume squad leader's stance
	[_respawnedUnit, animationState (leader group _respawnedUnit)] remoteExecCall ["switchMove", 0, true];
};

I added a little stance change, mostly so that a standing AI does not spawn onto a prone squad leader!

 

Now, there are a few considerations. No need to address them here, just things to think about.

  • What if the squad leader is dead?
  • What if the AI is the squad leader?
  • What if the squad leader is in a vehicle with space available? Full vehicle?

Good luck!

Share this post


Link to post
Share on other sites

Thanks for the reply!

 

Yes! I did consider the first 2 things you mentioned, no vehicles in this mission so not the third one at this time.

 

I did look through a number of old posts and saw you in quite a few asking similar questions back a few years ago.

 

Thanks for the script correction above, however you bring up great points about when the leader is down for that period between being incapacitated and being respawned or healed where an AI mate is the boss. I think I'm going to take the blue pill on this one and climb out of the rabbit hole before I get too deep haha! I do have an initserver.sqf code the kills the AI outright when they die and doesn't deal with them being respawned and rejoined to the group (which is another issue I'ver ran across in my attempts). Probably the direction for now.

 

Share this post


Link to post
Share on other sites

Hi Grimes,
For single player, is it possible to teamswitch while the player is incapacitated? It'd be helpful to switch to another unit to manually save yourself. For example,  I have a helo medevac that is a playable unit back at base. I'm guessing you use "G_Custom_Exec_1" for the player?
Thanks

Share this post


Link to post
Share on other sites
44 minutes ago, PigeonSparrow said:

Hi Grimes,
For single player, is it possible to teamswitch while the player is incapacitated? It'd be helpful to switch to another unit to manually save yourself. For example,  I have a helo medevac that is a playable unit back at base. I'm guessing you use "G_Custom_Exec_1" for the player?
Thanks

 

Team Switch is admittedly something I have never personally used as I tend to play my SP missions in the MP environment. That said, I have recognized Team Switch as a desired feature, though I do not have an ETA or guarantee that it will be implemented. I have not looked into it enough to provide a tested suggested approach to implementing it into this script. If you whip something up, even if it involves using a Custom Execution, please do share (and credit will of course be provided)!

 

If teamSwitch just needs to be executed, I think the cleanest route would actually be enabling the Give Up button, then changing the action of the dialog button (G_Dialogs.hpp, Line 19) from having "player setDamage 1" to "teamSwitch". I have no idea if that will work, what will happen, or how switching back to the unit will work. Best of luck!

Share this post


Link to post
Share on other sites

A bug in the system that incapacitates a unit for revive purposes instead of killing them has been brought to my attention. This bug resulted in certain non-fatal damage resulting in incapacitation. Specifically, critical damage to the hands, arms, and legs would result in incapacitation, when in the stock game that is not the case. This slipped through for so many years because I tend to test with head shots, not leg and arm shots! I imagine most players tend to roll this way in-game too. 

 

The issue has been fixed and pushed to github, though its inclusion in a release is still pending. 

Share this post


Link to post
Share on other sites
2 hours ago, KC Grimes said:

 

Team Switch is admittedly something I have never personally used as I tend to play my SP missions in the MP environment. That said, I have recognized Team Switch as a desired feature, though I do not have an ETA or guarantee that it will be implemented. I have not looked into it enough to provide a tested suggested approach to implementing it into this script. If you whip something up, even if it involves using a Custom Execution, please do share (and credit will of course be provided)!

 

If teamSwitch just needs to be executed, I think the cleanest route would actually be enabling the Give Up button, then changing the action of the dialog button (G_Dialogs.hpp, Line 19) from having "player setDamage 1" to "teamSwitch". I have no idea if that will work, what will happen, or how switching back to the unit will work. Best of luck!


Haha well I'm  the opposite, I pretty much only tinker around in the mission editor and somehow make use of the ai. If I come up with something, I'll be sure to share but I am by no means a competent coder, so might a take a bit. 

Share this post


Link to post
Share on other sites
On 6/29/2018 at 7:50 PM, KC Grimes said:

 

Team Switch is admittedly something I have never personally used as I tend to play my SP missions in the MP environment. That said, I have recognized Team Switch as a desired feature, though I do not have an ETA or guarantee that it will be implemented. I have not looked into it enough to provide a tested suggested approach to implementing it into this script. If you whip something up, even if it involves using a Custom Execution, please do share (and credit will of course be provided)!

 

If teamSwitch just needs to be executed, I think the cleanest route would actually be enabling the Give Up button, then changing the action of the dialog button (G_Dialogs.hpp, Line 19) from having "player setDamage 1" to "teamSwitch". I have no idea if that will work, what will happen, or how switching back to the unit will work. Best of luck!


Replacing "player setDamage 1" to "teamswitch" does exactly what I looking for! One minor thing that happens though is that the dialog box that is supposed to stay closed pops up repeatedly. Not sure why it does that since you have what I'm assuming a line that turns off the dialog once you click give up. 

Share this post


Link to post
Share on other sites
5 hours ago, PigeonSparrow said:


Replacing "player setDamage 1" to "teamswitch" does exactly what I looking for! One minor thing that happens though is that the dialog box that is supposed to stay closed pops up repeatedly. Not sure why it does that since you have what I'm assuming a line that turns off the dialog once you click give up. 

 

Awesome, glad that is working. 

 

The subsequent issue you are having with the dialog is due to a workaround (read: dirty) fix for the dialog sometimes seemingly closing on its own without input. The fix detects the unexpected closure and simply re-opens the dialog. So long as the unit is Incapacitated, as yours is despite doing teamSwitch, this will occur every few seconds. Take a look at G_Unconscious.sqf, Line 157 to 170. I would suggest removing lines 157-170, inclusively, and replacing it with the following code (which used to be inside those lines):

 

private _reviveDialog = createDialog "G_Revive_Dialog";
if (!G_Allow_GiveUp) then {
	((findDisplay 474637) displayCtrl 1600) ctrlShow false;
};

That will fix your issue, which is certainly more of an issue than the periodic unexpected closure of an otherwise cosmetic dialog.

 

Have fun!

Share this post


Link to post
Share on other sites
2 hours ago, KC Grimes said:

 

Awesome, glad that is working. 

 

The subsequent issue you are having with the dialog is due to a workaround (read: dirty) fix for the dialog sometimes seemingly closing on its own without input. The fix detects the unexpected closure and simply re-opens the dialog. So long as the unit is Incapacitated, as yours is despite doing teamSwitch, this will occur every few seconds. Take a look at G_Unconscious.sqf, Line 157 to 170. I would suggest removing lines 157-170, inclusively, and replacing it with the following code (which used to be inside those lines):

 


private _reviveDialog = createDialog "G_Revive_Dialog";
if (!G_Allow_GiveUp) then {
	((findDisplay 474637) displayCtrl 1600) ctrlShow false;
};

That will fix your issue, which is certainly more of an issue than the periodic unexpected closure of an otherwise cosmetic dialog.

 

Have fun!


That works!!! Thanks so much for your help and very useful script! 

Share this post


Link to post
Share on other sites

Hey Grimes, pretty happy with your script, it work's just perfect!

But there's one function that it would be great to be implemented, the possibility of only activate the reviving system for playable units. This would allow having large combats with many units, but only using the revive system on the player's squad, for example.

If you could implement this function, I would be delighted, waiting for your answer ^^

Share this post


Link to post
Share on other sites
3 hours ago, CykaMugged said:

Hey Grimes, pretty happy with your script, it work's just perfect!

But there's one function that it would be great to be implemented, the possibility of only activate the reviving system for playable units. This would allow having large combats with many units, but only using the revive system on the player's squad, for example.

If you could implement this function, I would be delighted, waiting for your answer ^^

 

Thanks for playing. Take a look at G_Revive\G_Revive_Init_Vars.sqf, line 233

if ((side _x) in G_Revive_AI_Incapacitated) then {
	[_x] spawn G_fnc_EH;
};

You could nest another if (or just add another condition), perhaps checking to see if the particular AI _x is playable. 

 

Alternatively, at line 238, you could do something differently than allUnits and allDead, though doing so many also effect players. Either way, testing will be required, particularly with AI systems.

 

On that note, if it hasn't been noticed already, I have started back up in school and am unfortunately putting this project on the back-burner again. I encourage the community to continue to participate in this thread with feedback, suggestions, and bug reports, and help each other keep the project going. I'll try to pop in every now and then, though I can't offer much more until further notice. 

Share this post


Link to post
Share on other sites

Hey Grimes, I've been trying to do what you told me, so in line 238 I've changed "allUnits + allDeadMen" array, to "switchableUnits". 

Having done that, I tested killing a playable IA of my team.

 

The IA gets all the scripts/animations executed right, but, instead of appearing the option "revive", it appears "secure" witch makes you handcuff the IA by holding the space bar. 

 

Given my complete ignorance in what to scripting refers, I'm stuck at this point, so if you could give me a solution, it would be amazing ^^' 

I'm waiting for your answer.

 

Here the lines, in case they are of any help:

 

            //Is an AI
            if ((side _x) in G_Revive_AI_Incapacitated) then {
                [_x] spawn G_fnc_EH;
            };
        };
    };
} forEach switchableUnits;

 

Share this post


Link to post
Share on other sites
1 minute ago, barccy said:

GSR V.92 
ARMA 3 V1.88

Players and playable AI no longer enter a revivable incapacitated state when injured, instead taking damage until death. AIS revive seems *mostly* functional but is also behaving differently than in previous versions of ARMA 3.

 

That's unfortunate. Is anyone else able to confirm?

 

I am in school and will not have the time to address this for at least a few months, assuming it is worth the time come the summer. If someone would care to take a stab at a fix, that would be great and of course credited later on. 

  • Like 1

Share this post


Link to post
Share on other sites

Grimes, this mod has brought me back to Arma 3 after a long hiatus. I absolutely love it, it changes the whole experience for me when using it with team switch. I cannot tell you how grateful my friends and I are that you developed this mod. I have a couple of questions/ suggestions you may be able to help me with:

 

Small guggestion- When i switch from a team leader who has been incapacitated, revive the team leader, the ai team leader no longer carries out his orders. I got around the ai  team switch before using GSR by using the thread started by madmonkey; it worked perfect. Maybe you could implement a similar call? (null=[] spawn {sleep 0.5;onTeamSwitch "selectPlayer (leader _from); {_x doFollow leader _from} foreach units _from; selectPlayer _to;"}) 

 

The priority issue i'm having is units spawned with Enemy Occupation System are not going into a revive state, i shoot them and they die. any units placed on the map will become incapacitated and revive, but not when spawned with EOS. is there any to delay the EOS init? or do you think it's something different? I tried placing the EOS init after GSR and even made a repeatable trigger (dont know if what i put was right).

 

Share this post


Link to post
Share on other sites

The behavior that I am seeing from this script is that sometimes the damaged units go into the revive state and other times they die.   They can also be killed while unconscious.  Perhaps they are set to invulnerable locally and not everywhere?

Share this post


Link to post
Share on other sites

When you "Give up" and respawned, you are loosing your primary weapon ... I don't know if it is something I'm doing wrong on that, but it is happening on both SP/MP. 

It is crucial I guess to be respawned with all weapons - mags - items as you died.

 

Thanks

Share this post


Link to post
Share on other sites

hey Grimes, great script!

i especially love how 2 team members move simultaneously to rescue the wounded.

anyway, i'm trying to implement it with a recruitment system (bon's infantry recruitment redux) and was wondering how to enable the revive abilities to new ai spawned after mission start.

i don't know much about scripting so if anyone could help i'd be super happy!

thanks

Share this post


Link to post
Share on other sites
On 10/10/2019 at 2:34 PM, gio.panda said:

hey Grimes, great script!

i especially love how 2 team members move simultaneously to rescue the wounded.

anyway, i'm trying to implement it with a recruitment system (bon's infantry recruitment redux) and was wondering how to enable the revive abilities to new ai spawned after mission start.

i don't know much about scripting so if anyone could help i'd be super happy!

thanks

Hellow, you need to do this: open bon_recruit_units folder =} open file init_newunit.sqf =} add line:  _unit spawn G_fnc_initNewAI;  under Client stuff line =} profit.

Share this post


Link to post
Share on other sites

Hey im completly new at this. 

When i try to implement the script i get this error:

"g_mobile_sidehere must be array containing only variable names of mrvs"

 

What should i do?

Share this post


Link to post
Share on other sites
17 minutes ago, Silenced.SOS said:

Hey im completly new at this. 

When i try to implement the script i get this error:

"g_mobile_sidehere must be array containing only variable names of mrvs"

 

What should i do?

 

Open up G_revive_init.sqf

Find this code:

//Mobile Respawn Vehicle
//Note - To enable, simply add the editor-placed vehicle's name into the appropriate array depending on the intended side. It will not be wrapped in quotes. So, it will be vehname and not "vehname". If multiple vehicles, separate by commas.
G_Mobile_Respawn_WEST = [MobileRespawnWEST]; 
G_Mobile_Respawn_EAST = [MobileRespawnEAST];
G_Mobile_Respawn_IND = [MobileRespawnIND];
G_Mobile_Respawn_CIV = [];

Replace [MobileRespawnSideHere] with []

 

This will remove the error.

 

Alternatively, place some vehicles in the editor and give them the names that are within the brackets here. They will act as mobile respawn points.

Share this post


Link to post
Share on other sites
12 minutes ago, Rimsiakas said:

 

Open up G_revive_init.sqf

Find this code:


//Mobile Respawn Vehicle
//Note - To enable, simply add the editor-placed vehicle's name into the appropriate array depending on the intended side. It will not be wrapped in quotes. So, it will be vehname and not "vehname". If multiple vehicles, separate by commas.
G_Mobile_Respawn_WEST = [MobileRespawnWEST]; 
G_Mobile_Respawn_EAST = [MobileRespawnEAST];
G_Mobile_Respawn_IND = [MobileRespawnIND];
G_Mobile_Respawn_CIV = [];

Replace [MobileRespawnSideHere] with []

 

This will remove the error.

 

Alternatively, place vehicles in the Editor and give them a name that's within the brackets here. They will act as mobile respawn points.

Thank you!
That took care of it 

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

×