Jump to content
pognivet

[Release] POG Surrender

Recommended Posts

POG Surrender

 

N8Im0K7.jpg

 

Description:

There was something that I thought was desperately missing from Arma 3: the ability for the enemy to realistically surrender. I got sick of doing missions where you're forced to genocide every last enemy in existence. It made them feel like totally inhuman android enemies. Therefore I decided to make this small script for myself to add this functionality the best I could. It's not perfect, but it seems to work. I've used it for a long time, but I've decided to share it to see if anybody had any input or advice on how to improve or optimize it and also because I think  that many people would find it useful for their missions.

 

Features:

- When AI get too scared and the enemy is closing in on them they will surrender.

- AI's fear level is determined by the "morale" parameter and units with higher "courage" subskill can be made less likely to surrender. More info here: https://community.bistudio.com/wiki/morale
- AI will drop their currently held weapon with its currently loaded magazine and it will clatter to the ground with physics as if it fell from their hand. It can be picked up after this.
- AI that are in vehicles or static weapons will exit them before surrendering.
- Surrendering disabled for AI on the player's side in order to avoid breaking missions.
- Some AI have a small chance to decide to stop surrendering and try to flee if nobody is guarding them.
- There are one or two configurable settings.

 

Compatibility:

Everything.

 

Bugs:

- May add a small amount of lag to missions with extremely large amounts of units (like hundreds, D-Day style), but I can't really tell.

 

Please report any bugs you find.

 

Examples of how to increase AI fear:

- Suppress them

- Injure them

- Kill their friends

- Surround them or flank them

- Outnumber them by a large margin

- Be much stronger than they are (i.e. drive a tank up to a guy armed with a handgun)

 

There are many other ways. It's all on the engine level with BI's morale system.

 

REQUIRES ACE

Installation:

 

Drop the files in your mission folder. That's all.

 

If you want you can edit a couple of basic options in "POGSURinit.sqf".

 

Download:

 

Link 1: https://www.dropbox.com/s/63qnl2m09txumyo/pogsur.zip?dl=1

Link 2: http://www.mediafire.com/file/jowj4ptxlazwllw/pogsur.zip/file

 

  • Like 9

Share this post


Link to post
Share on other sites

Updated to Version 1.1.

 

- Fixed errors associated with checking unit's mindstate after having surrendered.

Share this post


Link to post
Share on other sites

Thanks for posting! I'm not well versed in code, should I put the description text you supplied at the top or bottom of my description? 

 

enableDebugConsole = 1;
respawn = 3;
respawnDialog = 0;
respawnOnStart = -1;
author = "DrDetroit";
OnLoadName = "ALIVE_RHS_LYTHIUM_INS_ALPHA1";
OnLoadMission = "US Army 10th Mountain Division and MARSOC assist the Afghan National Army with clearing operations in the Lythium district of Helmand Province, Afghanistan. Currently, activity of the ISIL insurgency is contained in the central-west and north-west region.  There is a Afghan base in the north-east, and FOB ALPHA near the current hot zones located in the central-western portion of Lythium.";
loadScreen = "marsoc_in_morning.jpg";
class Extended_Init_EventHandlers {
 class Man {
  init = "_this call (compile preprocessFileLineNumbers 'POGSURinit.sqf')";
 };
};

Thanks in advance!  Good day!

DrDetroit

Share this post


Link to post
Share on other sites

Unfortunately I am having this error pop-up from POGSURInit.sqf line 10.
BgfMiid.png
 

Edit: 
Got it working without any errors (at least for now) here is the code:
POGSURInit.sqf
- > I decided that the script will be better off without the part with fleeing command since I can't see a point of it being here.
- > I have also replaced the params from execVM part with the numbers themselves (it caused the game not realizing what they mean: Undefined variable in expression: _fear)
- > I made the waitUntil more reading friendly ie. put different things in brackets and fixed the _nearguy condition, still looks a little bit wonky but works
 

_unit = _this select 0;
_fear = -0.2; //Set AI resistance to surrendering after getting scared. This is their actual "morale level" in-game. Ranges from -1.0 to 1.0. I've found that -0.1 feels the best, but you may think differently. (https://community.bistudio.com/wiki/morale)
_nearguy = 30; //Set how close someone of the opposite team has to be in order to keep them under control (guarded).
_badboys = 1; //Sets whether or not you want some AI to stop surrendering and flee if they aren't being guarded. Some AI will never try to flee. There is a 20 percent chance that a surrendered AI could be a "bad boy".

if (side _unit != playerSide) then { 
	_unit spawn {
	waitUntil {(morale _this <= -0.1) && (_this call BIS_fnc_enemyDetected == true) && (((_this findNearestEnemy position _this) distance _this <= 30) == true)};
	[_this, 1, 50, -0.1] execVM "scripts\pogsur\POGSUR.sqf";
	};
};

POGSUR.sqf
Barely done anything to it, I have changed only two things:
- > Defined the _badboy variable at the beginning of the file and also moved the _badboy 'randomizer' to the beginning of the file
- > Edited the waitUntil the same way as in the first file
 

_unit = _this select 0;
_bad = _this select 1;
_nearguy = _this select 2;
_fear = _this select 3;
_badboy = 0;

if (_bad == 1) then {
_badboy = selectRandom [0,1,2,3,4];
} 
else {
_badboy = 0;
};

_unit setUnitPos "AUTO";
_unit enableai "PATH";
_unit setCombatMode "BLUE";
_unit leaveVehicle vehicle _unit;
doGetOut _unit;
_unit action ["Eject", vehicle _unit];
sleep .1;
_weapon = currentWeapon _unit;       
_unit removeWeapon (currentWeapon _unit);
sleep .1;
_weaponHolder = "WeaponHolderSimulated" createVehicle [0,0,0];
_weaponHolder addWeaponCargoGlobal [_weapon,1];
_weaponHolder setPos (_unit modelToWorld [0,.2,1.2]);
_weaponHolder disableCollisionWith _unit;
_dir = random(360);
_speed = 1.5;
_weaponHolder setVelocity [_speed * sin(_dir), _speed * cos(_dir),0];
_unit setUnitPos "UP";
_unit setBehaviour "SAFE";
_unit setSpeedMode "Limited";
sleep 0.1;
["ace_captives_setSurrendered", [_unit, true]] call CBA_fnc_globalEvent;

if (_badboy == 1) then {
sleep random [0,60,120];
waitUntil {(morale _unit >= _fear) && (_unit call BIS_fnc_enemyDetected == false) && (((_unit findNearestEnemy position _unit) distance _unit >= _nearguy) == true) && (_unit getVariable ["ace_captives_isHandcuffed", false])};
["ace_captives_setSurrendered",[_unit,false]] call CBA_fnc_globalEvent;
_unit setUnitPos "AUTO";
_unit setBehaviour "AWARE";
_unit setSpeedMode "NORMAL";
} else {};

All in all it's a great work, couple of errors here and there but they could be caused by some game updates 🙂

Cheers

Share this post


Link to post
Share on other sites

Awesome idea. Our Community used something like this with Drongos Map Population Surrender Module. It worked very well and we would love to see surrendering Enemies in Missions that dont use DMP.

Unfortunately this Script seems to do nothing at all. I tried it vanilla and modded. Installed it exactly as the instructions say, but to no avail. The Enemy, no matter how bad the Situation is will never surrender, not even a single guy with a pistol vs 20 Tanks.

 

Can anybody help?

Share this post


Link to post
Share on other sites

One of the best mods out there, definitively.

 

Been quite useful and adds a lot of immersion, agree with you on the awkwardness of the "Terminator AI" that fought to the very end.

 

Thanks!

Share this post


Link to post
Share on other sites
On 3/2/2021 at 10:27 AM, DerOlli said:

Awesome idea. Our Community used something like this with Drongos Map Population Surrender Module. It worked very well and we would love to see surrendering Enemies in Missions that dont use DMP.

Unfortunately this Script seems to do nothing at all. I tried it vanilla and modded. Installed it exactly as the instructions say, but to no avail. The Enemy, no matter how bad the Situation is will never surrender, not even a single guy with a pistol vs 20 Tanks.

 

Can anybody help?

Hello, 

Did you solve it? I'm having the same problem.

Share this post


Link to post
Share on other sites
On 3/2/2021 at 8:27 AM, DerOlli said:

I tried it vanilla and modded.

 

2 hours ago, MacMillan CCT said:

I'm having the same problem.

 

Are you running ACE? It is required as per the original post.

Share this post


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

 

 

Are you running ACE? It is required as per the original post.

 

Yes, I am running ACE and CBA.

Share this post


Link to post
Share on other sites
24 minutes ago, MacMillan CCT said:

 

Yes, I am running ACE and CBA.

 

Yeah, I just gave it a try, and it's broken as originally presented. With 141_Soap's fixes it appears to do nothing.

 

I saw a glimmer of functionality at one point, so it's likely salvageable, but I can't afford the time at the moment.

Share this post


Link to post
Share on other sites
14 hours ago, Harzach said:

 

Yeah, I just gave it a try, and it's broken as originally presented. With 141_Soap's fixes it appears to do nothing.

 

I saw a glimmer of functionality at one point, so it's likely salvageable, but I can't afford the time at the moment.

Thank you for your attention, I will try again with the 141_Soap's fixes. 

 

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

×