Jump to content
Persian MO

[Release] Injured Ai script/Mod

Recommended Posts

ok so the problem was probably that I was spawning units as zeus and they probably have first aid kits so wont act? Our dedicated server is basically a modded zeus/MCC/Ares server.

 

I'll try testing it again asap.

 

Thanks for all your work on this Persian, having better and more dynamic enemy squad AI is going to be awesome :)

Share this post


Link to post
Share on other sites

Persian it seems AI are being equipped with smoke grenades by default with this script correct?

 

Is there anyway to disable that feature in the init? My units wont have smoke by default so seeing them throw it is weird,they are non military.

 

 

PS. I love the audio after killing some one....."SOMEFRIESSSS MOTHERF*CKER!!!"   :lol:

Share this post


Link to post
Share on other sites

Stephsen i just tested it with Ravage mod and it worked.

 

Are your units classed as civilian?

 

no,i test it with unsung soldiers units, i think the units in Ravage-mod ( not zombies) are vanilla units.

Share this post


Link to post
Share on other sites

Stephson you may be correct,

 

Make sure you try vanilla weapon aka mx rifle,dont test on friendly AI,turn probability to 100 in the init file.

 

Out of curiousity,are you using any AI mod/damage modifier,ragdoll animation mod?

 

Also after you kill a member of an enemy group,does that group go into combat mode or detect you?

Share this post


Link to post
Share on other sites

Thanks guys.

 

 

 

ok so the problem was probably that I was spawning units as zeus and they probably have first aid kits so wont act?

I have to fix this issue too, for next update but still you can change it by added a code line to loop line.

 

End of injured.sqf, important note part, replace below code lines with yours.

//******* IMPORTANT NOTE ****\\\\\\\\\\\
//look for number 70 means 70% chance to ai get injured and Unconscious instead dead.you can change it to increase or decrease Unconscious chance.
// ( min value 1 - max value 100 )
/////////////////////////////////////////////////////
if (isServer) then {
	
_units = [];

while { (true) } do {

{



		
		 if ((_x isKindOf "Man") && (!isplayer _x)) then
            {
				_uls = lifeState _x;
				

            if ((_uls != "INCAPACITATED") &&
			   !(_x getVariable ["MBG_ready",false])) then 
			   {
				_units pushBack _x; 
				_x removeItems "FirstAidKit";

				_x removeAllMPEventHandlers "MPHit";
				_x setVariable ["MBG_ready",true];

				call compile format[" 
			%1 addMPEventHandler ['MPHit',{
				if (vehicle %1 == %1) then {
					_rand = random 100;
					
					if (_rand < 70) then {
						[%1] spawn fnc_injured;
					};
				};
			}]
 	",[_x] call BIS_fnc_objectVar];
	};
	
	};
	
} forEach allUnits;

sleep 10;

};

};



 

Persian it seems AI are being equipped with smoke grenades by default with this script correct?

 

Is there anyway to disable that feature in the init? My units wont have smoke by default so seeing them throw it is weird,they are non military.

 

 

 

Smokes just drop by script, I should add a option for it to enable or disable it, next update.

You can change it in inCap.sqf

remove line 27 to 33

if (isServer) then {
_smokeColor1 = ["SmokeShellRed", "SmokeShell", "SmokeShellGreen", "SmokeShellBlue", "SmokeShellOrange" ] call BIS_fnc_selectRandom;
_smoke1 = createVehicle [_smokeColor1, _unit, [], 2, "CAN_COLLIDE"];
_smokeColor2 = ["SmokeShellRed", "SmokeShell", "SmokeShellGreen", "SmokeShellBlue", "SmokeShellOrange" ] call BIS_fnc_selectRandom;
_smoke2 = createVehicle [_smokeColor2, _unit, [], 4, "CAN_COLLIDE"];

};

 

 

no,i test it with unsung soldiers units, i think the units in Ravage-mod ( not zombies) are vanilla units.

Open demo mission and run it once with vanilla units and then try with unsung units.If units not wear vest or the weapon is high caliber , shouted unit will die.

I don't have unsung mod right now but with cup units that happen most times because they vest is weak or not wear one, i think.

Try to hit them with a pistol,

Share this post


Link to post
Share on other sites

ok i found my failure , you must write "this" in the line from the modul where is written "player1"

Share this post


Link to post
Share on other sites

Very cool!

 

Is it possible to make it so that medics and combat life savers in a squad can revive, carry, drag or help their fallen squad mates get back into the fight?

I know its probably very complex, but it would be great to have an AI squad actually act to help defend a fallen soldier. Throwing smoke to cover a downed soldiers position so a medic can extract them to a safe place and revive them or simply work on them on the spot. The AI also seems very hesitant to use full auto suppression fire to create a "beaten zone" the will give human players a pause for thought while such actions are being taken.

 

Again I don't know how much of this is possible or easy, but having medics revive squad mates seems like a logical progression for this script.

 

Kan,

 

First off, I haven't tested this, but you can add this bardosy script to your medic unit's init  https://forums.bistudio.com/topic/165907-automated-medic/   In the thread, Davidoss offers a compatible version for ACE users (that I use :) )  Again, I'm not sure if this would run compatible, but if you have time, you might want to see if you can get anything out of it.

Share this post


Link to post
Share on other sites

Hi persian

 

if i remove the code as you suggested,to prevent ai from throwing smoke,

 

if (isServer) then {
_smokeColor1 = ["SmokeShellRed", "SmokeShell", "SmokeShellGreen", "SmokeShellBlue", "SmokeShellOrange" ] call BIS_fnc_selectRandom;
_smoke1 = createVehicle [_smokeColor1, _unit, [], 2, "CAN_COLLIDE"];
_smokeColor2 = ["SmokeShellRed", "SmokeShell", "SmokeShellGreen", "SmokeShellBlue", "SmokeShellOrange" ] call BIS_fnc_selectRandom;
_smoke2 = createVehicle [_smokeColor2, _unit, [], 4, "CAN_COLLIDE"];

};

 

it seems to prevent AI from dragging.Tested numerous times,AI were always within range but they never dragged.

Share this post


Link to post
Share on other sites

No problem when i tested.

 New version incap.sqf

 
if (!isServer) exitWith {}; // Server only

_unit = _this select 0;
_anim = _this select 1;

private ["_arr","_aCount","_Pos","_dummy","_unit","_anim","_nearestunits","_dragger","_hls","_posFound","_emptyHouse","_nearesthouses",
"_houseList","_randomHouse","_outside","_weapon","_magazine","_smokeColor1","_smoke1","_smokeColor2","_smoke2","_dis","_bCount",
"_ls","_animN"];

_arr = [];


_nearestunits = _unit nearEntities ["Man", 25];
_dragger = selectRandom _nearestunits;
if (_nearestunits isEqualTo _arr) exitwith {};
_hls = lifeState _dragger;

if ((!isNull _dragger) && (alive _unit) && (side _dragger != civilian) && (!isPlayer _dragger) && (_dragger != _unit) && (_hls != "INCAPACITATED") && (alive _dragger) && ((AnimationState _dragger) != "AcinPknlMwlkSrasWrflDb")) then {


[_dragger] joinSilent grpNull;
_dragger removeAllMPEventHandlers "MPHit";
_dragger setUnitPos "MIDDLE";			
_dragger doMove getpos _unit;


/*
if (isServer) then {
_smokeColor1 = ["SmokeShellRed", "SmokeShell", "SmokeShellGreen", "SmokeShellBlue", "SmokeShellOrange" ] call BIS_fnc_selectRandom;
_smoke1 = createVehicle [_smokeColor1, _unit, [], 2, "CAN_COLLIDE"];
_smokeColor2 = ["SmokeShellRed", "SmokeShell", "SmokeShellGreen", "SmokeShellBlue", "SmokeShellOrange" ] call BIS_fnc_selectRandom;
_smoke2 = createVehicle [_smokeColor2, _unit, [], 4, "CAN_COLLIDE"];

};
*/
waituntil { sleep 1; (_dragger distance _unit < 5) or !(alive _unit) or !(alive _dragger)  };

if (!alive _dragger) exitwith {};
if (!alive _unit) exitwith {};




[ _unit ] remoteExec [ "Lar_fnc_wake", 2 ];
sleep 2;
_dragger playAction "grabDrag";
_unit switchmove "AinjPpneMrunSnonWnonDb"; 	
Sleep (0.01);
	
waitUntil { ((AnimationState _dragger) == "AmovPercMstpSlowWrflDnon_AcinPknlMwlkSlowWrflDb_2") || ((AnimationState _dragger) == "AmovPercMstpSnonWnonDnon_AcinPknlMwlkSnonWnonDb_2")}; 

_unit attachTo [_dragger, [0, 1.2, 0]]; // attach injured 
_unit setDir 180; // set injured to turn his back on dragger


_DummyClone = {
	private ["_dummy", "_dummygrp", "_dragger"];
	_dragger = _this;
	// create Dummy unit that dragger attaches to, dummy unit moves and simulates dragger moving
	_dummygrp = createGroup civilian;
	_dummy = _dummygrp createUnit ["C_man_polo_1_F", Position _dragger, [], 0, "FORM"];
	_dummy setUnitPos "up";
	_dummy hideObjectGlobal true;
	_dummy allowdammage false;
	_dummy setBehaviour "CARELESS";
	_dummy disableAI "FSM";
     _dummy forceSpeed 1.5;
	_dragger attachTo [_dummy, [0, -0.2, 0]]; 
	_dragger setDir 180;
	// return dummy object
	_dummy
};
_dummy = _dragger call _DummyClone;


	
_posFound = false;
_emptyHouse = [];
_nearesthouses = _dragger nearObjects ["House",50];
_houseList = [];
{
    for "_i" from 0 to 3 do {
        if ( [(_x buildingPos _i), [0,0,0]] call BIS_fnc_arrayCompare ) exitWith {
            if (_i > 0) then {
                _houseList set [count _houseList, [_x, _i]];
            };
        };
    };    
}forEach _nearesthouses;

if !(_houseList isEqualTo _emptyHouse) then 

{

_randomHouse = _houseList select (floor (random (count _houseList)));
_Pos = (_randomHouse select 0) buildingPos (floor (random (_randomHouse select 1)));
_posFound = true;


	} else { 
	
_dis = (30 + random 20);	
_Pos = [_dragger, _dis, random 360] call BIS_fnc_relPos;

	
	
	};
_dragger playMove "AcinPknlMwlkSrasWrflDb"; _dragger disableAI "ANIM"; _dummy doMove _Pos;



waituntil { sleep 1; ((damage _dragger) > 0.2) or (_dummy distance _Pos < 5) or !(alive _dragger) or !(alive _unit) };



if (!(alive _dragger) or ((damage _dragger) > 0.1)) then {	
detach _unit;	
detach _dragger;
detach _dummy;
_dummy stop true;
deleteVehicle _dummy;
[[_unit,""] remoteExec ["switchMove"]]; 
[_unit] remoteExec [ "Lar_fnc_setunconscious", 2 ];
if ((damage _dragger) > 0.1) then {
[[_dragger,""] remoteExec ["switchMove"]]; 	
[[_dragger,"AmovPercMrunSlowWrflDf_AmovPpneMstpSrasWrflDnon_old"] remoteExec ["switchMove"]];
_dragger forceSpeed -1;
sleep 5;
[[_dragger,""] remoteExec ["switchMove"]];
_dragger enableAI "ANIM";
_dragger setCombatMode "RED";	
_dragger setBehaviour "AWARE";	
{_dragger reveal _x; } forEach allUnits;	

};


_bCount = 0;


    _unit disableAI "TARGET";
    _unit disableAI "AUTOTARGET";
    _unit disableAI "MOVE";
    _unit disableAI "TEAMSWITCH";
    _unit disableAI "FSM";
    _unit disableAI "AIMINGERROR";
    _unit disableAI "SUPPRESSION";
    _unit disableAI "COVER";
    _unit disableAI "AUTOCOMBAT";
    _unit disableAI "PATH";
	
_animN = [
"UnconsciousReviveArms_A","UnconsciousReviveArms_B","UnconsciousReviveArms_C","UnconsciousReviveBody_A",
"UnconsciousReviveBody_B","UnconsciousReviveDefault_A","UnconsciousReviveDefault_B","UnconsciousReviveHead_A",
"UnconsciousReviveHead_B","UnconsciousReviveHead_C","UnconsciousReviveLegs_A","UnconsciousReviveLegs_B"
 ] call bis_fnc_selectRandom;
	
	
while { (alive _unit) } do {	
_unit playMove _animN;
_bCount = _bCount + 1;
if (_bCount == 20) then { _unit setDamage 1};

sleep 6;	
	
};




} else {

if !(alive _unit) then {
detach _unit;
detach _dragger;
detach _dummy;
_dummy stop true;
deleteVehicle _dummy;
[[_dragger,""] remoteExec ["switchMove"]]; 
_dragger enableAI "ANIM";
_dragger setCombatMode "RED";	
_dragger setBehaviour "AWARE";	
{ _dragger reveal _x; } forEach allUnits;
[[_unit,""] remoteExec ["switchMove"]]; 

} else {



if (_dummy distance _Pos < 10) then {
detach _unit;
detach _dragger;
detach _dummy;
_dummy stop true;
deleteVehicle _dummy;
[[_dragger,""] remoteExec ["switchMove"]]; 
[[_unit,""] remoteExec ["switchMove"]]; 
[ _unit ] remoteExec [ "Lar_fnc_setunconscious", 2 ];
[[_dragger,"MedicOther"] remoteExec ["playAction"]]; 

sleep 7;

_unit setDamage 0;
[ _unit ] remoteExec [ "Lar_fnc_wake", 2 ];
_dragger enableAI "ANIM";
_dragger setCombatMode "RED";	
_dragger setBehaviour "AWARE";	
_unit enableAI "FSM";
_unit setCombatMode "RED";	
_unit setBehaviour "COMBAT";	
{ _dragger reveal _x; } forEach allUnits;
{ _unit reveal _x; } forEach allUnits;

};

};

};

if (true) exitwith {};
	
} else {



_aCount = 0;


    _unit disableAI "TARGET";
    _unit disableAI "AUTOTARGET";
    _unit disableAI "MOVE";
    _unit disableAI "TEAMSWITCH";
    _unit disableAI "FSM";
    _unit disableAI "AIMINGERROR";
    _unit disableAI "SUPPRESSION";
    _unit disableAI "COVER";
    _unit disableAI "AUTOCOMBAT";
    _unit disableAI "PATH";
	
	
	
while { (alive _unit) } do {
		
_ls = lifeState _unit;
if (_ls != "INCAPACITATED") exitWith {};

_unit playMove _anim;

_aCount = _aCount + 1;
if (_aCount == 20) then { _unit setDamage 1};
	

sleep 6;	
	
};


};








 

Share this post


Link to post
Share on other sites

This script is a fine written i must say, but

it need some fixes.

_arr = [];


_nearestunits = _unit nearEntities ["Man", 25];
_dragger = selectRandom _nearestunits;
if (_nearestunits isEqualTo _arr) exitwith {};
_hls = lifeState _dragger;

this code with some optimized one

_arr = [];
_unitdir = getDir _unit; //later use
_nearestunits = _unit nearEntities ["CAManBase", 25]; //CAManBase here cause on map there are some invisible "agents" 
_dragger = selectRandom (_nearestunits - (playableUnits + switchableUnits + [_unit])); // Exclude Players and the unit itself
if (_dragger isEqualTo _arr) exitwith {}; 
_hls = lifeState _dragger;
Also if u want AI to drag each other in cover positions use this code 
_coverobj = nearestTerrainObjects [_unit, ["TREE", "SMALL TREE", "BUSH", "ROCK", "WALL"], 200];
_nearestcoppos = [_coverobj, _unit] call BIS_fnc_nearestPosition;
_Pos = [_nearestcoppos, 3, _unitdir + 180] call BIS_fnc_relPos;

instead of this code

_dis = (30 + random 20);    
_Pos = [_dragger, _dis, random 360] call BIS_fnc_relPos;

Share this post


Link to post
Share on other sites

Thanks for codes.

I ll use your code and change script for next update.

I used  nearestTerrainObjects  before but sometimes draggier stuck at position while drag injured unit.It was strange.I ll try again with your code.

Share this post


Link to post
Share on other sites

Hi Persian MO ! Sooner in this topic someone asked you if you plan to release this script as a mod, and you answered him that you don't know how to do but to feel free to do it. That's what I've done. Here you can find an addon version of your script. Inside the @ folder you'll find not only the classical "addons" folder containing the PBO that I made, but also an "injured_ai_addon" folder containing all your script files under the good format to build it as a PBO. Feel free to have a look on it, it's really easy to understand how it works.

 

All I did is to make your script fit the needed syntax in order to build it as a PBO, in order to 1) train myself to modding, and 2) check the behaviour of your script in various situations without the need to add it to every mission made by my team. In fact if we are satisfied of the work done by the script and if you think it's ok to build it as a mod, your work will soon become a part of our modset !

 

Note that the mod is CBA-dependant, as I don't know how to make a script auto-launchable at startup without CBA (don't know if it's even possible...). So you can do whatever you want with it, including releasing it under your own name of course. What I've done is the smallest part of the job, just a 15mn work. Please also consider the fact that, as I will soon release a signed version of all of my small mods, I'm fully able to build a signed version of your script too. Just ask me if you want. It would make the mod easier to use for admins of secured servers.

 

Thanks again for bringing us this work that make the IA much more fun to fight ! Please let mo know your thought about the (small) job I've done !

  • Like 1

Share this post


Link to post
Share on other sites

Update to ver 1.4

 

added voices , ais will talk with radio or yelling while firing
fix remove firstaid and medkit
fix some performance issues , thanks to hunter1000
added 2 new killer voices
added parameters for control script
 
How to use: 
Copy folder and files from demo mission into your mission folder. 
Check out init.sqf and injured.sqf and killer.sqf for more setting and add your own sounds. 
 
/*//parameters
_this select 0, true or false, ais war voices,ais will talk with radio or yelling while firing, (default = true)
_this select 1, true or false, drop smoke around injured ai, (default = true)
_this select 2, true or false, drag to cover, dragger will drag injured to covers like bushes or rocks, for longer distance drag set this false, (default = true)
_this select 3, unconscious and drag chance, determine chance unit unconscious if got hit, min 0%-100% max (default = 50%)
_this select 4, hit react chance, determine chance unit have react animation if got hit, min 0%-100% max (default = 20%)
*** Important Note: if you increase hit react chance, it also decrease unconscious and drag chance ***
*/
_null = [true, true, true, 70, 20] execvm "scripts\injured.sqf";

 

Hi Persian MO ! Sooner in this topic someone asked you if you plan to release this script as a mod, and you answered him that you don't know how to do but to feel free to do it. That's what I've done. Here you can find an addon version of your script. Inside the @ folder you'll find not only the classical "addons" folder containing the PBO that I made, but also an "injured_ai_addon" folder containing all your script files under the good format to build it as a PBO. Feel free to have a look on it, it's really easy to understand how it works.

 

All I did is to make your script fit the needed syntax in order to build it as a PBO, in order to 1) train myself to modding, and 2) check the behaviour of your script in various situations without the need to add it to every mission made by my team. In fact if we are satisfied of the work done by the script and if you think it's ok to build it as a mod, your work will soon become a part of our modset !

 

Note that the mod is CBA-dependant, as I don't know how to make a script auto-launchable at startup without CBA (don't know if it's even possible...). So you can do whatever you want with it, including releasing it under your own name of course. What I've done is the smallest part of the job, just a 15mn work. Please also consider the fact that, as I will soon release a signed version of all of my small mods, I'm fully able to build a signed version of your script too. Just ask me if you want. It would make the mod easier to use for admins of secured servers.

 

Thanks again for bringing us this work that make the IA much more fun to fight ! Please let mo know your thought about the (small) job I've done !

Hi Cheitan

Thank you very much :)

Nice work.Good example that i can compare with script!

anyway, i'm not going for modding but if you made it please send me a link so i can share it here too.Its ok if releasing it under your own name , just release it on public so everyone can use..

i'm just wonder how it came out with cba dependency while script itself not using any cba!

  • Like 4

Share this post


Link to post
Share on other sites

fantastic!

 

the config choices are awesome persian thank you.

  • Like 1

Share this post


Link to post
Share on other sites

You can find a link to the addon version of your script (1.3) in my previous message ;)

 

The dependency to CBA comes from the need to launch your script by an other way than the init.sqf of a mission. In order to do that, CBA provides several event handlers, including one that fires at mission startup (exactly as init.sqf does in a mission file). What I've done in the config file of the mod is to set up this event handler to call your script, nothing more :) I think there is another way to do that, because CBA can implement it. But I don't know how at all. CBA is a complex framework, very well optimized, designed in order to make some tasks easier to do for mod makers and/or mission designers. I'm not skilled enough to pretend that I understand how it works ! :) I'm only able to use it at my level.

 

Anyway, currently working to bring you the 1.4 version built as an addon, I will release it here in a few minutes I think !

  • Like 1

Share this post


Link to post
Share on other sites

Hiya Persian, thanks for the update. I run a dedicated server and I found that your script was not working fully when I ran it. No dragging or reviving was taking place.

 

so I changed 

if (!isServer) exitWith {};

in the inCap file to:

if (isServer) exitWith {};

This worked but I noticed that units being dragged has a civilian attached to them. So i added:

_dummy hideObject true;

to the dragger section of the script and this worked. For some reason hideObjectGlobal does not seem to work on dedicated servers - I don't know why.

 

 

Also I'm having a separate issue where injured units don't seem to die if they get no treatment - they just roll around and stay injured forever. Again I think this may be a dedicated server only issue.

 

Thank you once again for all your doing with this script, its awesome!

Share this post


Link to post
Share on other sites

Thanks for feedback.

 

 

to the dragger section of the script and this worked. For some reason hideObjectGlobal does not seem to work on dedicated servers - I don't know why.

hideobjectglobal must execute only on server.So when you changed inCap start to "if (isServer) exitWith {}; " ,Script executing just on clients.Thats why you saw civ.If you saw civ before change inCap so there is a problem with hideobjectglobal.

 

 

 

 

No dragging or reviving was taking place.

How many times you tried? Every time same result? It happened with zeus or placed unit in editor have such issue too?Did you tried demo mission?

 

 

Also I'm having a separate issue where injured units don't seem to die if they get no treatment - they just roll around and stay injured forever. Again I think this may be a dedicated server only issue.

 

I ll dig in more to fix this and other things you said.

 

Thanks again for feedback.

Share this post


Link to post
Share on other sites

I ll dig in more to fix this and other things you said.

 

Thanks again for feedback.

Hi.

ill help u in this.

 

ive got no new version but with old it will do too i think:

 

in "InCap.sqf"

 

 if (isNil {_unit getVariable "doomed"}) then {_unit setVariable ["doomed", 0, false];}; //checking if unit got any local variables, if it not, then add one 

 if (_unit getvariable "doomed" == 0) then {                //This will check if this unit got already spawn function. Cause we dont want to fire it twice or more...
    _doomtimer = [_unit,_anim] spawn {
    private ["_unit","_ls","_anim","_aCount"];
    _unit = _this select 0;
    _anim = _this select 1;
    _unit setVariable ["doomed", 1, false];                 //Mark the unit with this variable. then script above check for it later if something gets wrong with rescue team...
    _aCount = 0;
    while { (alive _unit) } do {_ls = lifeState _unit; if (_ls != "INCAPACITATED") exitWith {};
    _unit playMove _anim;
    _aCount = _aCount + 1;
    if (_aCount == 20) then { _unit setDamage 1};
    sleep ((random 4)+4);
};
 _unit setVariable ["doomed", 0, false]; //if unit got healed then reset variable
};
};

Above there is a same function but in spawn format, cause we want to fire death timer to wounded ai unit

 

there is more text...

 

_arr = [];
_unitdir = getDir _unit;
_nearestunits = _unit nearEntities ["CAManBase", 50];
_dragger = selectRandom (_nearestunits - (playableUnits + switchableUnits + [_unit]));
///////////////////Find dragger loop////////////////////////////////////////
while {true}                    //We want that loop if rescue team didnt make it, unit will wait for help.
do {
    //hint "searching dragger...";
    _nearestunits = _unit nearEntities ["CAManBase", 50];
    _dragger = selectRandom (_nearestunits - (playableUnits + switchableUnits + [_unit]));
    sleep 1;
    if ((alive _unit) && ((side _dragger) != civilian) && ((lifeState _dragger) != "INCAPACITATED") && (alive _dragger) && ((AnimationState _dragger) != "AcinPknlMwlkSrasWrflDb")) exitWith {};
    if (!alive _unit) exitWith {}; //exit this while loop if unit has been killed
};


if (!alive _unit) exitWith {}; //exit script when unit died...
_hls = lifeState _dragger;


//hint "dragger found"; 
waituntil { sleep 1; (_dragger distance _unit < 5) or !(alive _unit) or !(alive _dragger)  };

if (!alive _dragger) exitWith {sleep ((random 15)+15); _null = [_unit, _anim] spawn inCap;}; //Exit script to repeat it all over again, to find another dragger
if (!alive _unit) exitwith {};

if (isServer) then {
_smokeColor1 = ["SmokeShellRed", "SmokeShell", "SmokeShellGreen", "SmokeShellBlue", "SmokeShellOrange" ] call BIS_fnc_selectRandom;
_smoke1 = createVehicle [_smokeColor1, _unit, [], (random 6), "CAN_COLLIDE"];};  //add this AFTER waituntil loop to create smokes after dragger near unit, but u need to delete old code before waituntil loop...

160-180 string number:

 

_animN = [
"UnconsciousReviveArms_A","UnconsciousReviveArms_B","UnconsciousReviveArms_C","UnconsciousReviveBody_A",
"UnconsciousReviveBody_B","UnconsciousReviveDefault_A","UnconsciousReviveDefault_B","UnconsciousReviveHead_A",
"UnconsciousReviveHead_B","UnconsciousReviveHead_C","UnconsciousReviveLegs_A","UnconsciousReviveLegs_B"
 ] call bis_fnc_selectRandom;

_unit playMove _animN;

sleep ((random 15)+15); _null = [_unit, _animN] spawn inCap; //Repeat again if dragger was killed or injured in drag action. Pay attention to _animN.

in the end of script add green line

 

if (true) exitwith {};


} else {




    _unit disableAI "TARGET";
    _unit disableAI "AUTOTARGET";
    _unit disableAI "MOVE";
    _unit disableAI "TEAMSWITCH";
    _unit disableAI "FSM";
    _unit disableAI "AIMINGERROR";
    _unit disableAI "SUPPRESSION";
    _unit disableAI "COVER";
    _unit disableAI "AUTOCOMBAT";
    _unit disableAI "PATH";

    _null = [_unit, _anim] spawn inCap; //Repeat... //This line is GREEN. or used to be.


};

Thats it. Units will die after certain period of time Thanks to the spawn command, And will repeat "call" for help if something went wrong.

 

I think it should work... 

 

EDIT: I wonder why text was not colored correctly. :(  BTW: Script is working as intended on dedi server. just tested.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks hunter1000  :thumb:

 

Update to Ver 1.4.1

 

Fixed injured dead timer 

Now script run smooth and better

 

***Link at first post

Share this post


Link to post
Share on other sites

Thanks hunter1000  :thumb:

 

No problem mate. But... there is one thing to fix.

 

As far as i know u use Say3D command to make ai speak or scream. The problem is that this command is a local one and others players wont hear anything from the "source" of the sound (cause its local). :rolleyes:

U need a function to tell all players what sound and where will be.

 

ok so lets begin...

 

in init.sqf so all players and server know what is going on on mission.

 

fn_Say3D=                                     //Function itself to use later instead of Say3D
{private ["_obj","_snd"];

_obj = _this select 0;    //source or object
_snd = _this select 1;    //sound class name in soundsCfg must be in ""

NetSay3D = [_obj,_snd];
publicVariable "NetSay3D";

if (not isDedicated) then {_obj say3D _snd};
true
};


if (isNil "NetSay3D") then {NetSay3D = [objNull,0];};    //if none dont cry with error dear arma...

"NetSay3D" addPublicVariableEventHandler {
      private["_array"];
      _array = _this select 1;
     (_array select 0) say3D (_array select 1);
};

then u must replace such lines like

 

_sound = [


"fire1", "fire2", "fire3", "fire4", "fire5", "fire6", "fire7", "fire8", "fire9", "fire10",
"fire11","fire12","fire13","fire14","fire15","fire16","fire17","fire18","fire19","fire20",
"fire21","fire22","fire23","fire24","fire25","fire26","fire27","fire28","fire29","fire30",
"fire31","fire32","fire33","fire34","fire35","fire36","fire37","fire38"


] call BIS_fnc_selectRandom;

_source say3D [_sound, 100, 1]; //THIS ONE NEEDS TO REPLACE 

with new line

_nul = [_source ,_sound] call fn_Say3D;  //Correct

But where i can define range and laudness for the sound u say?

 

In class CfgSounds 

 

Example:

class pain1
{
name = "pain1"; // Display Name for editor
sound[] = {"\sounds\pain1.ogg", db+10, 1.0, 80};   //In this string u must change or add some numbers
titles[]={}; //Do not use unless you know what you are doing!
};

Details

sound[] = {
"\sounds\pain1.ogg", //Path to the file. 
 db+10,              //Volume level. db+number means louder. Db-number means u know... cant remember word in English... 
 1.0,                //Overall volume. keep it at 1.0
 80                  //Thats it! It defines distance from the sound source to the player. But keep that in mind if u make it about 1200 u wont get it "louder". 
};

I guess i wrote it right...  ^_^

  • Like 1

Share this post


Link to post
Share on other sites

Thanks.

so sound files not playing for player on dedicated?all of it? then i ll update script soon with this solution or i have remoteexec solution which i can use it too.

[[_killer,_sound] remoteExec ["say3D"]]; 

just need confirm that sounds not playing on dedicated server.

Share this post


Link to post
Share on other sites

Sorry for not responding sooner.

 

I've been playing around with the script on my dedicated server and basically zeus spawned units don't drag or revive, but they do get injured, drop flares and play sounds. Units that are placed as part of the mission (like in your example mission) do run the script fully. I've tested this multiple times.

 

However, by making the changes I mentioned above everything works for me.... changing (!isServer) to (isServer) and adding _dummy hideObject true;

 

I also run MCC on my server and if you spawn units using MCC and assign them to GAIA the script stops working on those units. I'm assuming that this is because MCC has its own scripting that overrides anything done by this script. I don't think there is much you can do about this, but I thought I would mention it. Ultimately it would be great to see this script combined with others to create more dynamic AI behaviours - like laying down suppressing fire, not laying on the ground so much, seeking cover and using buildings. MCC does much of this but there are plenty of other mods that look at this kind of stuff as well.

 

Also from observing the AI in zeus it seems that:

 

1) Revived units seem to be placed into separate groups - all on their own. This makes them act separately from the squad they were originally part of and often they do not move much beyond the spot where they were revived. Perhaps they could auto join the same group as the unit that revived them?

 

2) Often even after the fighting is done and injured units are on the ground and no one moves to drag and revive them - even when they are under no fire. Perhaps the priority of reviving units should be increased so that if a squad has a unit injured it sends another unit to drag and revive - but no more than one dragger in a squad at a time. 

 

Anyway, just some thoughts. This is a great script, so keep up the good work! :)

Share this post


Link to post
Share on other sites

 

Thanks.

so sound files not playing for player on dedicated?all of it? then i ll update script soon with this solution or i have remoteexec solution which i can use it too.

[[_killer,_sound] remoteExec ["say3D"]]; 

just need confirm that sounds not playing on dedicated server.

 

 

https://community.bistudio.com/wiki/say3D

Read the last comment if u dont trust me)))

 

Btw u can use remoteExec it will do.  

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

×