Jump to content
Persian MO

[Release] Injured Ai script/Mod

Recommended Posts

Ok figured as much, just seemed to be popping up a bit.

Thanks for your help and the great script  

Share this post


Link to post
Share on other sites

Thanks for a great mod. Is there any way to only have the wounded animation on the ground (without the draging, smoke, sounds) I can try do it myself but not really god with scripting so I don´t delete anything importent. I using tha addon version.

Share this post


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

Thanks for a great mod. Is there any way to only have the wounded animation on the ground (without the draging, smoke, sounds) I can try do it myself but not really god with scripting so I don´t delete anything importent. I using tha addon version.

 
 
 

 

init.sqf

fnc_injured = { 
	_unit = _this select 0;
    _unit removeAllMPEventHandlers "MPHit";
[ _unit ] remoteExec [ "TAG_fnc_setunconscious", 2 ];

	sleep 3;


_anim = [
"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,_anim],"animation.sqf"],"BIS_fnc_execVM",true,false] call BIS_fnc_MP;

	};

initserver.sqf

TAG_fnc_setunconscious = {
	params[ "_unit" ];
[ _unit, true ] remoteExec [ "setUnconscious", _unit ];
	
};

_null = [] execvm "injured.sqf";

injured.sqf

sleep 5;

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

animation.sqf

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

    _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 {true} do {
		
_ls = lifeState _unit;
if (_ls != "INCAPACITATED") exitWith {};


_unit playMove _anim;
	

sleep 5;	
	
};

 

change side in injured.sqf by changing WEST to any side you want.

Change chance of injured ai also is a number in the same script.Look for _rand < 35, the higher number means more chance.

Share this post


Link to post
Share on other sites
10 hours ago, Persian MO said:

change side in injured.sqf by changing WEST to any side you want.

Change chance of injured ai also is a number in the same script.Look for _rand < 35, the higher number means more chance.

 

Thanks for the info. I am new in scripting only do 3d works before. 

I take it that i will create 4 sqf-files and name them (init.sqf, initserver.sqf, injured.sqf and animation.sqf). Then copy paste the code into the different files? I tried do that and make that into a addon file (.pbo) but didn´t work so i think i miss something.
Is´t even a way to make it effect all the AI instead of use either East/west?

Sorry for stupid questions from a noob :P
 

Share this post


Link to post
Share on other sites
7 hours ago, Blackscorpioz said:

 

Thanks for the info. I am new in scripting only do 3d works before. 

I take it that i will create 4 sqf-files and name them (init.sqf, initserver.sqf, injured.sqf and animation.sqf). Then copy paste the code into the different files? I tried do that and make that into a addon file (.pbo) but didn´t work so i think i miss something.
Is´t even a way to make it effect all the AI instead of use either East/west?

Sorry for stupid questions from a noob :P
 

 
 

injured.sqf

sleep 5;

_units = [];

while { (true) } do {

{



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

            if ((_uls != "INCAPACITATED") &&
			   !(_x getVariable ["dam_ready",false])) then 
			   {
				_units pushBack _x; 
				_x removeItems "FirstAidKit";
                _x removeItem "Medikit";
				
				_x removeAllMPEventHandlers "MPHit";
				_x setVariable ["dam_ready",true];

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

sleep 10;

};

I don't know how to mod but you first try the script version, make sure it working then go for modding

Share this post


Link to post
Share on other sites

Hello !

I want to ask if its possible adding a way for a player to drag spawned AI dead body ?

 

Thank you

 

Share this post


Link to post
Share on other sites

@ Persian MO  are you still supporting and working on this. If so when you update your files there is no way of telling what  version  you have in your mission you never stated within your files  ver 1.0, ver 1.1 ect I know your last  ver  was 1.41. I hope you are this basic function should be in the game already.

Share this post


Link to post
Share on other sites

Neat script, and good idea using the invisible dummy to get the dragger "seemingly" moving. I'd like to get the AI to move in the dragging stances itself, but...

 

After Christmas I finally decided to move from ARMA2 to ARMA3 and I felt some functionality missing, and not yet officially ported to A3. One of them - of  course - is Solus' SLX Wounded/Findcover modules, that I consider a key mod since the caring and rescuing of wounded by AI adds so much to the atmosphere. I found posts that this was not done for reasons related to the physx ragdoll death feature. So I gave it a try. I found a way to make wound and dead entities attachable and dragable, without loosing the ragdoll or death animations. Fine, I thought that would be the difficult part.

 

Attaching works perfectly. But moving only for players: the last weeks I tried desperately to get AI moving in wounded-carry and -dragging stances, i.e. the ones along the lines AcinPercMstpSnonWnonDnon and AcinPknlMstpSnonWnonDnon (all: Wnon, Wpst, Wrfl). I tried all I could think of now, and even transfered the corresponding SLX dragging animations and actions classes (and rtm) from A2. But to no avail. Sometimes, but rarely, AI would move in these stances (after put in it by switchmove). Mostly it showed to be ordered to "move", turned towards the right direction, but remained immobile.

 

 

Does anyone know what changes to the corresponding actions and animations classes need to be made in order to get AI moving in the dragging/carrying stances (from the 1.71 cfg for e.g)? Or where the trouble arises from?

 

Any help would be much appreciated!

Share this post


Link to post
Share on other sites

Cool script's, just my personal taste doesn't like the killer's speech, takes away from immersionz... can that be turned of without giving error, i tried removing all the array's from killer.sqf but if think it's not optimal, that and throwing smoke, also im just being very picky but i noticed they will drag towards the 'Killer'... sometimes dragging a long distance towards me as in a few meters as opposed to away from me into cover?

Share this post


Link to post
Share on other sites

There's a version back in the thread somewhere that has all the speech disabled 

  • Like 1

Share this post


Link to post
Share on other sites

Does the few script files published above, with only the "anim" part effective, will apply to dynamically spawned units, or only to mission startup units ?

 

EDIT : nevermind, it's not, but I've found how to make it consistent.

Share this post


Link to post
Share on other sites

Hey dude, I know it's be a long time but how can you do that, please?

On 30/07/2017 at 3:26 PM, Cheitan said:

Does the few script files published above, with only the "anim" part effective, will apply to dynamically spawned units, or only to mission startup units ?

 

EDIT : nevermind, it's not, but I've found how to make it consistent.

Share this post


Link to post
Share on other sites
On 06/11/2017 at 3:04 PM, ricoarma said:

Hey dude, I know it's be a long time but how can you do that, please?

 

I nearly blown up the whole code, so it's a bit hard to say it in a few words ! Really, the whole thing is upside down :hehe: I digged into this script and various things around it, finally designing a from-scratch version of it, way more simple than the one of @Persian MO, which is indeed very good and well aimed, but not fitting my goals.

Share this post


Link to post
Share on other sites

Hi there I really like this script and was wondering if it can be changed up a bit for a ravage scenario that I have been working on my only problem is that the zombies are civilian class and they react as the other AI would by dropping smoke and dragging each other would it be possible just to have blufor, opfor, and independent factions to utilize this script any help would be awesome thanks.

Share this post


Link to post
Share on other sites
On 14/11/2017 at 6:31 AM, Cheitan said:

 

I nearly blown up the whole code, so it's a bit hard to say it in a few words ! Really, the whole thing is upside down :hehe: I digged into this script and various things around it, finally designing a from-scratch version of it, way more simple than the one of @Persian MO, which is indeed very good and well aimed, but not fitting my goals.

Any chance you would share yours and is it still working after latest hotfix?

Share this post


Link to post
Share on other sites

What's the problem with the last hotfix ? Didn't see anything wrong.

 

Anyway, yes I can share it, no problem. I don't have it on my computer right now, but let me a few hours and I will pack it up and share it here. However, keep in mind that I don't want to steal @Persian MO's work, so only the anim part is still existing in my code. Other effects such as smokes, AI healing, etc etc, are not part of my script anymore, as we are playing with ACE and ASR. And the vanilla healing is hardly compatible with them. If I have some time during the first quarter of 2018, I may design a more complete and compatible script, but right now it's only for ambient purposes.

Share this post


Link to post
Share on other sites

Hey @Rockapes, here is the downloadable zip with the code inside. You have to integrate it to your own mission to test it, it's not a standalone package. Have a look to the readme.txt to learn how to use it. It's very simple.

 

Note that I've not checked if it's still working as expected, but we are using it in various missions, and it still seems to work fine.

 

MEGA + Key

Edited by Cheitan
link broken

Share this post


Link to post
Share on other sites
3 hours ago, 4-325Ranger said:

Hey Cheitan,

 

Check your link, it's looping back to this page, not getting out to Mega. Thanks.

Oh, my bad. Fixed, thanks.

Share this post


Link to post
Share on other sites
6 hours ago, Cheitan said:

Hey @Rockapes, here is the downloadable zip with the code inside. You have to integrate it to your own mission to test it, it's not a standalone package. Have a look to the readme.txt to learn how to use it. It's very simple.

 

Note that I've not checked if it's still working as expected, but we are using it in various missions, and it still seems to work fine.

 

MEGA + Key

Thanks @Cheitan greatly appreciated. Will give it a go.

Share this post


Link to post
Share on other sites

hi , nice job would like to know how to add the fnc to  unit spawned  by script? 

{

_null = [_x] execVM "VzR_SRIPTS\SPAWNS\SP_gearingEAST.sqf";
_x setskill ["aimingAccuracy",0.24] ;
_x setskill ["courage",0.75] ;
_x addEventHandler ["killed", killedEHandler];
_x addEventHandler ["killed",{_this execVM "VzR_SRIPTS\SP_killCountEast.sqf"}];

} forEach units spawnedEastInf ;

 

or the script is already effectiv on each units by loop?

Share this post


Link to post
Share on other sites

Hi, if your question is about my "reduced" version of Persian's script, you just have to add one line in your forEach block, calling LM_fnc_addInjurableUnit.

 

You can also call LM_fnc_addInjurableGroup right after the forEach, out of the block, but if you open the script file defining this function you will see that the only thing done in it is to loop over the units of the group and calling the first function on each one. Here your code is already looping through a group, so let's call directly LM_fnc_addInjurableUnit from it, no need to do another loop after.

Share this post


Link to post
Share on other sites

Mod Version

 

Here is a mod version of injured ai.The mod can run only on the server but if you want to hear injured ais pain and hit sounds, clients must have the mod too.

also, check out the first post for more info

 

Download Injured Ai Mod

  • Thanks 1

Share this post


Link to post
Share on other sites

Hi)
Why did you remove the smoke in the addon version?



I made myself to apply only white smoke. And it was used in 30% of cases of medical evacuation.

I do not know if it's right or not, but it works)

_randomSmoke = selectRandom [1,2,3];

If (_randomSmoke == 2) then {
createVehicle ["SmokeShell", _unit, [], (random 6), "CAN_COLLIDE"];
};

 

Share this post


Link to post
Share on other sites

Love this script, but it really makes the Arsenal painfully slow to load up for the first time. 

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

×