Jump to content
Sign in to follow this  
clock_x

Script errors with findBody script

Recommended Posts

Hey,

 

one of my scripts troubles me alot with a handful of script errors.

I did it a while ago and I only remember that it was a hustle to get it to working with my limited expertise.

I bet that it's not really that optimised, I think someone already helped me clean it up a little but I am not sure!

 

It's called via an killed EH set up to all EAST units within a trigger area (pretty much whole AO).

{_x addEventHandler ["killed",{_this execVM "scripts\alarm\FindBody.sqf";}]} forEach EHlist;

 

Here is the script (errors already highlighted):

Spoiler

/*/////////////////////////////////////////////////////////////////////////
OPFOR, once
condition: this
name : EHlist
EHlist = thislist;
{_x addEventHandler ["killed",{_this execVM "FindBody.sqf"}]} forEach EHlist;
also note use of -- {_x addEventHandler ["fired",{alarm = true}]} forEach EHlist;
//////////////////////////////////////////////////////////////////////////////*/

_deadguy = _this select 0;
_killer = _this select 1;
_numsidedeadguy = getNumber (configFile >> "CfgVehicles" >> typeOf _deadguy  >> "side");
finder = [];
_finders = [];

_deadguyside = [EAST,WEST,RESISTANCE,CIVILIAN] select _numsidedeadguy;
_killerside = side _killer;

_LoopCount = 0;


_MaxCount = 69; 

sleep 5;

while { ((_deadguyside != _killerside) AND !(alive _deadguy) AND !(preAlarm) AND !(alarm) AND !(isNull _deadguy) AND (side _killer == west) AND (_deadguyside == east)) } do
{

sleep 5;

if (!isNull _deadguy) then {
_finders = nearestObjects [vehicle _deadguy, ["Man"], 200]; // Error 0 elements provided, 3 expected //50 to 300
							};
					   
					   
					   _LoopCount = _LoopCount + 1;
					   
					   if (mein_debug>0) then {  
                player globalChat format ["FindBody.sqf - deadguy:%1 killer:%2 deadguyside:%3 killerside:%4", _deadguy, _killer, _deadguyside, _killerside];
                player globalChat format ["FindBody.sqf - finders:%1 loopcount:%2", _finders, _LoopCount]; //Error Undefined variable in expression: _finders //added !isNull - removed again for testing // still error?
                       };
					   
					   if (_LoopCount > _MaxCount) exitWith {player globalChat format ["FindBody.sqf - END - LoopCount:%1", _LoopCount];}; //exits current scope? (while loop)
					   
					   					   if ((_LoopCount > 19) && (_LoopCount < 21) && !(isNull _deadguy)) then {
										   
										   _Body_Vultures = [_deadguy] execVM "scripts\crows\BodyVultures.sqf";
										   
										   
																	  };


   if (count _finders > 1) then		//Error Undefined variable in expression: _finders
   {
      {
         if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x) AND (_x distance _deadguy < 50)) then //added distance (for 300range change)
         {


            if ((_x knowsAbout vehicle _deadguy > 0.4) AND (_x knowsAbout _killer > 0.9)) then
            {
               _x move getpos _deadguy; 
			   finder = _x;
			   
            } else {

            if ((_x knowsAbout vehicle _deadguy > 0.4)) then
            {
              sleep (10 + (random 30));   			  
              _x move getpos _deadguy; 
              finder = _x; 
            };


                  };




         };
      } forEach _finders;
         

  };

sleep 5;

if (mein_debug>0) then { player globalChat format ["FindBody.sqf - finder:%1", finder]; };

                       
if ((!isNull _deadguy) AND (finder distance _deadguy < 10)) then { 			//  Error 0 elements provided, 3 expected / Error position: <distance _deadguy < 10)) then { find>
finder setunitpos "middle";
finder disableAI "MOVE";
preAlarm = true;

sleep 5;

_shout1 = [leader (group finder), _killer] execVM "scripts\ShoutSound.sqf"; 	//  Error group: Type Array, expected Object /   Error position: <group finder), _killer] execVM "scripts\>

//[_killer, _deadguy, finder] execVM "scripts\alarm\preAlarm.sqf";
if (mein_debug>0) then {  
                player globalChat "FindBody.sqf - (1) AI detected body";
                       };

                                                            } else {
															
if ((_LoopCount > 14) && (_LoopCount < 16) && !(isNull _deadguy) AND (finder distance _deadguy < 20)) then {

finder setunitpos "middle";
finder disableAI "MOVE";
preAlarm = true;

sleep 5;

_shout1 = [leader (group finder), _killer] execVM "scripts\ShoutSound.sqf";

//[_killer, _deadguy, finder] execVM "scripts\alarm\preAlarm.sqf";
if (mein_debug>0) then {  
                player globalChat "FindBody.sqf - (2) AI detected body";
                       };

                                                            };};

};


if (!isNull finder && alive finder) then {finder setunitpos "UP";finder enableAI "MOVE";};	 //Error isnull: Type Array, expected Object,Group,Display (dialog),Control,Task,Location / Error position: <isNull finder && alive finder) then {fin>



if (preAlarm) then {

     _spotters = nearestObjects [vehicle _deadguy, ["Man"], 50];
     preAlarm = false;


    if (finder in (list EHlistBerg_T)) then 
    {

	
// --------------------------------NEU/18---------------------------------------------------------	
	if (finder in (list Nighttime7_1)) then {
   
	if ( !(genOff) ) then { sleep 30; } else { sleep 140; };
	
									};
// -------------------------------------------------------------------------------------------- 
					
         if (!(radioObj)) then {sleep (30 + (random 30));} else {sleep (90 + (random 120));};

    } else {if (finder in (list AllOpfor)) then {detected = true; detected_T = true; if (mein_debug>0) then {player globalChat format ["FindBody.sqf - deadguy:%1 in FB.", _deadguy];};};}; //Error list: Type Array, expected Object /   Error position: <list AllOpfor)) then {detected = true; d>

			


           {
              if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x) AND (side _x == EAST)) then
              {
                 detected = true; 
				 _x setBehaviour "COMBAT"; //NEW
				 
				 if (_x distance player < 120 && _x hasWeapon "ItemRadio") then {
				 if (50 > random 100) then {_x say3d "s0";} else {_x say3d "s01";};

																								};
				 East_casualties  = East_casualties + 1;
				 
				 									if (mein_debug>0) then { 
  player globalChat format ["FindBody.sqf - Casualties:%1", East_casualties];
												};
if !(action) then {
		KRON_UPS_reinforcement3 = true;
		KRON_UPS_reinforcement3_pos = getPos _deadguy;
					};
		
									if (mein_debug>0) then { 
  player globalChat format ["FindBody.sqf - KRON_UPS_reinforcement3_pos - deadguy:%1", _deadguy];
												};

         if (radioObj) then {

		KRON_UPS_reinforcement0 = true; 
		KRON_UPS_reinforcement0_pos = getPos _deadguy;

							if (mein_debug>0) then { 
  player globalChat format ["FindBody.sqf - KRON_UPS_reinforcement0_pos - deadguy:%1", _deadguy];
												};
			     };


		sleep 60;
                       

		if !(isNull _deadguy) then {

				deleteVehicle _deadguy;
				
				                if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after detected";};
				
									};

              };
           } forEach _spotters;
		   
                   } else {
				   
				   sleep 60; 
				   
				   if (!isNull _deadguy) then { 
				   
				   deleteVehicle _deadguy; 
				   
				   if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after !preAlarm";};
				   
												};
				   
							};				   				   				   
				   						   
/* NOT NESCESSARY?!
preAlarm = false;					   
sleep 300;

		if !(isNull _deadguy) then {
		
				deleteVehicle _deadguy;
				
				if (mein_debug>0) then {  
                player globalChat "FindBody.sqf - Deleting Body";
                       };
				
									};																		
 */
                if (mein_debug>0) then {player globalChat "FindBody.sqf - END";};         

 

 

Small fix attempts often kill the whole thing for me....

The main problem seems to be 'finder'.

It returns one guy as it should, because that's the guy finding the body and making the call, but I get array errors from it.

So I guess the game expects more than one guy, altough I only want one guy! So it basically works correctly but spams a whole lot.

If I get this done I can play the mission with -showScriptErrors enabled without having the box on the screen all the time, since I already got all the other spammers fixed!

Help would be much appreciated.

I really want to release this damn mission already, in development for the 5th year now .. 🤔

 

Here are all the errors listed:

Error in expression <};if ((!isNull _deadguy) AND (finder distance _deadguy < 10)) then { find>
  Error position: <distance _deadguy < 10)) then { find>
  Error 0 elements provided, 3 expected
File D:\Eigene Dateien\Documents\ArmA 2\missions\OP%20GECKOHUNT%20v3%2e0%2e5%20Final.Takistan\scripts\alarm\FindBody.sqf, line 91

Error in expression 
<m = true;sleep 5;_shout1 = [leader (group finder), _killer] execVM "scripts\>
  Error position: <group finder), _killer] execVM "scripts\>
  Error group: Type Array, expected Object
File D:\Eigene Dateien\Documents\ArmA 2\missions\OP%20GECKOHUNT%20v3%2e0%2e5%20Final.Takistan\scripts\alarm\FindBody.sqf, line 98

Error in expression 
< AI detected body";};};};};if (!isNull finder && alive finder) then {fin>
  Error position: <isNull finder && alive finder) then {fin>
  Error isnull: Type Array, expected Object,Group,Display (dialog),Control,Task,Location
File D:\Eigene Dateien\Documents\ArmA 2\missions\OP%20GECKOHUNT%20v3%2e0%2e5%20Final.Takistan\scripts\alarm\FindBody.sqf, line 127

Error in expression 
<e {sleep 140;};} else {if (finder in (list AllOpfor)) then {detected = true; d>
  Error position: <list AllOpfor)) then {detected = true; d>
  Error list: Type Array, expected Object
File D:\Eigene Dateien\Documents\ArmA 2\missions\OP%20GECKOHUNT%20v3%2e0%2e4%20Final.Takistan\scripts\alarm\FindBody.sqf, line 151

 

Hope somebody has an Idea.

 

Cheers

Share this post


Link to post
Share on other sites

Only got a few seconds right now but quick look shows your checking distance against an array (finders)

you will need to select the element from the array

if ((_LoopCount > 14) && (_LoopCount < 16) && !(isNull _deadguy) AND ((finder select 0) distance _deadguy < 20)) then {

However it's not gong to help as the whole script is a mess a mixture of arrays being used as simple variable.

 

here is another,  finder is an array but your trying address it as a group but finder may be several units in different groups.

_shout1 = [leader (group finder), _killer] execVM "scripts\ShoutSound.sqf"; // Error group: Type Array, expected

 

Are you sure you need to make arrays it looks like the code was mostly for a single unit, changing nearestobjects to the nearestobjet command may work better as it would return the nearest unit. and remove all the finder and _finders arrays and keep them simple variables containing the nearest unit.

 

I'm not sure why this fails, memory isn't what it used to be.

_finders = nearestObjects [vehicle _deadguy, ["Man"], 200]; // Error 0 elements provided, 3 expected //50 to 300

the three elements it's looking for are xyz of the deadguy, may be this

 _finders = nearestObjects [getpos (vehicle _deadguy), ["Man"], 200]; // Error 0 elements provided, 3 expected //50 to 300

but again it's returning an array, do you need to find all the units or just the nearest?

 

Good luck.

Share this post


Link to post
Share on other sites

Sounds like I got  some work to do.

 

Definitely gonna try nearestObject instead.

 

Finding only the nearest unit would work, as long as it finds the next one if the first one dies or wanders off because it doesn't know about the deadguy.

 

What happens right now is, units come up to the dead guy, change their behaviour, wait a bit depending on different things and then 'detected' is triggered which is basically my main thing to know if the player has been detected in a stealth scenario.

Other things like bdetect(nearby bullet hits), a simple fired EH and a system that detects flares trigger 'detected' aswell.

What happens next is reinforcments come in and if the mission is close to end it fails because the target escapes.

If the unit who finds the corpse dies, or doesn't exist anymore because it got hidden, it shouldn't execute.

 

Other stuff that is happening in the script, is crows/flies are triggered to help the player find the dead guys after some time and my AI talk script gets triggered to inform the player that something is happening.

Corpse deletion is a thing to, so I don't have to use extra stuff for that.

 

The strange thing is everything works pretty good except the error spam.

Only sometimes, if too many units are around or something the script gets kinda stuck or it takes way too long to detect the dead guy but it's pretty rare.

I don't know if it's just UPSMON but I have the  suspicion that sometimes patrols/reinforcements get stuck because of the findBody script.

 

if ((_LoopCount > 14) && (_LoopCount < 16) && !(isNull _deadguy) AND ((finder select 0) distance _deadguy < 20)) then {

This line is pretty much only a backup for this line:

if ((!isNull _deadguy) AND (finder distance _deadguy < 10)) then {

Did this yesterday because ... I guess because the script is a mess. 😀

Sometimes the AI is close to the deadguy and looking pretty aware and running around but nothing happens.

The loopcount is mainly to delete the bodies after some time and end the script.

 

I think it's strange that 'finder' always returns only one AI and _finders all of them.

That's why I thought what I did is correct.

 

By the way my script is based on this one:

Spoiler

/*/////////////////////////////////////////////////////////////////////////
OPFOR, once
condition: this
name : EHlist
EHlist = thislist;
{_x addEventHandler ["killed",{_this execVM "FindBody.sqf"}]} forEach EHlist;
also note use of -- {_x addEventHandler ["fired",{alarm = true}]} forEach EHlist;
//////////////////////////////////////////////////////////////////////////////*/

_deadguy = _this select 0;
_killer = _this select 1;
_numsidedeadguy = getNumber (configFile >> "CfgVehicles" >> typeOf _deadguy  >> "side");

_deadguyside = [EAST,WEST,RESISTANCE,CIVILIAN] select _numsidedeadguy;
_killerside = side _killer;

sleep 5;

while { ((_deadguyside != _killerside) AND !(alive _deadguy) AND !(alarm)) } do
{
_finders = nearestObjects [vehicle _deadguy, ["AllVehicles"], 20];
   if (count _finders > 1) then
   {
      {
         if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x)) then
         {
            if (_x knowsAbout vehicle _deadguy > 0.5) then
            {
               _x move getpos _deadguy; finder = _x; 
            };
         };
      } forEach _finders;

   };
sleep 5;

if ((alive finder) AND (finder distance _deadguy < 1)) then {
finder setunitpos "middle"; 
finder disableAI "MOVE";
alarm = true;
Player groupRadio "found";};

};


finder setunitpos "UP";
finder enableAI "MOVE";
[finder] exec "suspicion.sqs";



 

 

Share this post


Link to post
Share on other sites

Looking at the last script I would start again using the above as the start, make sure it's working 100% first.

 

However looking at original code above finder shouldn't  be array,  but in your script it's defined as an array finder=[]; remove it and see if it helps.

that should also fix this line

_shout1 = [leader (group finder), _killer] execVM "scripts\ShoutSound.sqf";

 

I just loaded the code in my editor and something seems off.


 

I think it should be  as follows other wise the game will try and run it.

 

/*/////////////////////////////////////////////////////////////////////////
OPFOR, once
condition: this
name : EHlist
EHlist = thislist;
{_x addEventHandler ["killed",{_this execVM "FindBody.sqf"}]} forEach EHlist;
also note use of -- {_x addEventHandler ["fired",{alarm = true}]} forEach EHlist;
//////////////////////////////////////////////////////////////////////////////*/

try this

/*
OPFOR, once
condition: this
name : EHlist
EHlist = thislist;
{_x addEventHandler ["killed",{_this execVM "FindBody.sqf"}]} forEach EHlist;
also note use of -- {_x addEventHandler ["fired",{alarm = true}]} forEach EHlist;
*/

 

 

Share this post


Link to post
Share on other sites

To start with the original script was a really good idea!

I did this before so I didn't really think about it.

But then I didn't know how to use isNil and was just starting to script stuff.

 

I tested it step by step in a different mission and it worked without errors!

After implementing it and optimising it a bit it worked in my main mission too.

Here is what I did with the original:

I basically just added if (!isNil "finder") then {}; at the right positions.

/*
OPFOR, once
condition: this
name : EHlist
EHlist = thislist;
{_x addEventHandler ["killed",{_this execVM "FindBody.sqf"}]} forEach EHlist;
also note use of -- {_x addEventHandler ["fired",{alarm = true}]} forEach EHlist;
*/

_deadguy = _this select 0;
_killer = _this select 1;
_numsidedeadguy = getNumber (configFile >> "CfgVehicles" >> typeOf _deadguy  >> "side");

_deadguyside = [EAST,WEST,RESISTANCE,CIVILIAN] select _numsidedeadguy;
_killerside = side _killer;

player globalChat format ["FindBody.sqf - deadguy:%1 killer:%2 deadguyside:%3 killerside:%4", _deadguy, _killer, _deadguyside, _killerside];

sleep 5;

while { ((_deadguyside != _killerside) AND !(alive _deadguy) AND !(alarm)) } do
{
_finders = nearestObjects [vehicle _deadguy, ["AllVehicles"], 20];

   if (count _finders > 1) then
   {
      {
         if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x)) then
         {
		 player globalChat format ["FindBody.sqf - finders:%1", _finders];
            if (_x knowsAbout vehicle _deadguy > 0.5) then
            {
               _x move getpos _deadguy; finder = _x; 
            };
         };
      } forEach _finders;

   };
   
sleep 5;

if (!isNil "finder") then {

player globalChat format ["FindBody.sqf - finder:%1", finder]; 

if ((alive finder) AND (finder distance _deadguy < 5)) then {
finder setunitpos "middle"; 
finder disableAI "MOVE";
alarm = true;
sleep (floor(random 5));
Player groupChat "found";};

};

};


finder setunitpos "UP";
finder enableAI "MOVE";
 player globalChat format ["end of script"];



And here is my final script so far:

Spoiler

/*
OPFOR, once
condition: this
name : EHlist
EHlist = thislist;
{_x addEventHandler ["killed",{_this execVM "FindBody.sqf"}]} forEach EHlist;
also note use of -- {_x addEventHandler ["fired",{alarm = true}]} forEach EHlist;
*/

_deadguy = _this select 0;
_killer = _this select 1;
_numsidedeadguy = getNumber (configFile >> "CfgVehicles" >> typeOf _deadguy  >> "side");
_finders = [];

_deadguyside = [EAST,WEST,RESISTANCE,CIVILIAN] select _numsidedeadguy;
_killerside = side _killer;

_LoopCount = 0;


_MaxCount = 69; 

					   if (mein_debug>0) then {  
                player globalChat format ["FindBody.sqf - deadguy:%1 killer:%2 deadguyside:%3 killerside:%4", _deadguy, _killer, _deadguyside, _killerside];
                       };
					   
	sleep 5;				   

while { ((_deadguyside != _killerside) AND !(alive _deadguy) AND !(preAlarm) AND !(alarm) AND !(isNull _deadguy) AND (side _killer == west) AND (_deadguyside == east)) } do
{

_finders = nearestObjects [vehicle _deadguy, ["Man"], 100]; // OLD? - Error 0 elements provided, 3 expected //50 to 300 to 200 to 50 to 80

					   
					   
					   _LoopCount = _LoopCount + 1;
					   
	if (_LoopCount > _MaxCount) exitWith {player globalChat format ["FindBody.sqf - END - LoopCount:%1", _LoopCount];};
					   
		 if ((_LoopCount > 19) && (_LoopCount < 21) && !(isNull _deadguy)) then {
										   
			_Body_Vultures = [_deadguy] execVM "scripts\crows\BodyVultures.sqf";
										   
										   
																	            };
   if (count _finders > 1) then		//OLD? Error Undefined variable in expression: _finders
   {
      {
         if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x)) then //added distance //removed distance again
         {
			if (mein_debug>0) then {player globalChat format ["FindBody.sqf - finders:%1 loopcount:%2", _x, _LoopCount];};

            if ((_x knowsAbout vehicle _deadguy > 0.5)) then
            {
               _x move getpos _deadguy; 
			   finder = _x;
			   
            };

         };
      } forEach _finders;
         

  };

sleep 5;
if (!isNil "finder") then {

if (mein_debug>0) then { player globalChat format ["FindBody.sqf - finder:%1", finder]; };
                      
if ((!isNull _deadguy) AND (alive finder) AND (finder distance _deadguy < 5)) then { 			//  OLD? - Error 0 elements provided, 3 expected / Error position: <distance _deadguy < 10)) then { find>

finder setunitpos "middle";
finder disableAI "MOVE";
finder reveal [player, 1]; //NEW WIP
preAlarm = true;
sleep (floor(random 5));

if (!detected) then {
_shout1 = [leader (group finder), _killer] execVM "scripts\ShoutSound.sqf"; 	// OLD? - Error group: Type Array, expected Object /   Error position: <group finder), _killer] execVM "scripts\> 
};
if (mein_debug>0) then {player globalChat "FindBody.sqf - AI detected body";};
                       
																				};

};
}; //end of loop

if (!isNil "finder") then {

if (!isNull finder && alive finder) then {finder setunitpos "UP";finder enableAI "MOVE";};	 // OLD? - Error isnull: Type Array, expected Object,Group,Display (dialog),Control,Task,Location / Error position: <isNull finder && alive finder) then {fin>
						


if (preAlarm) then {

     _spotters = nearestObjects [vehicle _deadguy, ["Man"], 50];
     preAlarm = false;


    if (finder in (list EHlistBerg_T)) then 
    {

	
// --------------------------------AA_CAMP---------------------------------------------------------	
	if (finder in (list Nighttime7_1)) then {
   
	if (genOff) then { sleep 30; };
	
									};
// -------------------------------------------------------------------------------------------- 
					
         if (!(radioObj)) then {sleep (30 + (random 30));} else {sleep (90 + (random 120));};

    } else {if (finder in (list AllOpfor)) then {detected = true; detected_T = true; if (mein_debug>0) then {player globalChat format ["FindBody.sqf - deadguy:%1 in FeruzAbad.", _deadguy];};};}; // OLD ? - Error list: Type Array, expected Object /   Error position: <list AllOpfor)) then {detected = true; d>

			


           {
              if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x) AND (side _x == EAST)) then
              {
                 detected = true; 
				 _x setBehaviour "COMBAT"; //NEW
				 
				 if (_x distance player < 120 && _x hasWeapon "ItemRadio") then {
				 if (50 > random 100) then {_x say3d "s0";} else {_x say3d "s01";};
				 if (!isNil "_shout1") then {terminate _shout1;};

																								};
				 East_casualties  = East_casualties + 1;
				 
				 		if (mein_debug>0) then { 
  player globalChat format ["East Casualties:%1", East_casualties];
												};
if (!action) then {
		KRON_UPS_reinforcement3 = true;
		KRON_UPS_reinforcement3_pos = getPos _deadguy;
					};
		
									if (mein_debug>0) then { 
  player globalChat format ["FindBody.sqf - KRON_UPS_reinforcement3_pos - deadguy:%1", _deadguy];
												};

         if (radioObj) then {

		KRON_UPS_reinforcement0 = true; 
		KRON_UPS_reinforcement0_pos = getPos _deadguy;

							if (mein_debug>0) then { 
  player globalChat format ["FindBody.sqf - KRON_UPS_reinforcement0_pos - deadguy:%1", _deadguy];
												};
			     };


		sleep 60;
                       

		if !(isNull _deadguy) then {

				deleteVehicle _deadguy;
				
				                if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after detected";};
				
									};

              };
           } forEach _spotters;
		   
                   } else {
				   
				   sleep 60; 
				   
				   if (!isNull _deadguy) then { 
				   
				   deleteVehicle _deadguy; 				   
				   if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after !preAlarm";};
				   
											};
				   
							};		
} else {

				   sleep 60;
				   
				   if (!isNull _deadguy) then { 
				   
				   deleteVehicle _deadguy; 				   
				   if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after !preAlarm";};
				   
											};
											
		};					
				if (!isNil "_shout1") then {terminate _shout1;};
                if (mein_debug>0) then {player globalChat "FindBody.sqf - END of script";};
                       
									

 

I just tested it briefly but I'm pretty confident about it.

 

The only thing that can be annoying is like you said, it's executing for everyone.

I guess I'm still gonna look into nearestObject or something like leader group finder.

 

//EDIT1:

I ran into the first problem. I did this:

_finder = nearestObject [_deadguy, "MAN"]; //default 50m

And I got :  Error count: Type Object, expected Array,Config entry

The first problem I see is that it returns the dead guy first.

I only found this thread:

And he basically tells him to use nearestObjects instead.🙄

 

//Edit2:

Replacing

_x move getpos _deadguy; finder =  _x;

with

leader group _x move getpos _deadguy; finder = leader group _x;

Seems to work.

But then again, if the leader gets killed the whole script could stop working.

Makes it complicated again.

//Edit3:

Actually it works in the original version I changed.

The leader gets assigned new and does the same thing.

If you have any thoughts about the group leader thing, please share them with me. 🤗

The problem I see is that in the original everything happens inside the loop.

But in my final version there is a whole lot of other stuff going on after...

If he dies then it should be a problem.

Maybe I can just ask for the group lead again and it returns the leader of the dead old leader, if he is not deleted via hide body yet.

//Edit4:

Tested it only in the while loop for now, w/o killing the leader.

One thing that is still happening is, that the script gets executed for every unit in the area.

But I get only 1 finder in return, which is ok I guess, except that if different groups are in the area I get only the finder of one group.

Here an example picture of my debug lines:

Debug lines picture

N3 is the closer group, the group in which the deadguy was and N2 is a group in the closest camp.

In my test group N3 was close to the dead guy but did nothing except staying there, and another group(N2) leader from further away ran all the way to trigger the alarm.

All those problems might be the reason the original script is the way it is.

Share this post


Link to post
Share on other sites

I would leave it as is and then look to see what _finders contains, you can then decide how to filter out what you don't want

_finders = nearestObjects [vehicle _deadguy, ["Man"], 100];//  may return something like [deadunit,unit a,unit b, ect];

 

if deadguy is always returned first and you want the closest then it would be element number 2 which is 1 or 0 if no deadguy in array.

_finders = [_finders select 1];// now _finders will be an array of one unit I think., if not it may need some  names changing.

 

 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Sadly it doesn't work. No matter if I put it before or inside:

 if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x)) then
         {};

Or if I leave _finders and finder as they are or change all finder to _finders too.

I tried finders = [_finders select 0-3]; and _finders = [_finders select 0-3]; and _finders = [_x select 3];/finders = [_x select 3]; I even tested _x = [_x select 1];

It always displays myself too(plus another unit or two together), even if I'm the wrong side. And if it displays a unit from the group nothing happens.

And each time I get Error select: Type Object, expected Array,Config entry from it.

Im gonna try the group leader _x version for a bit and if it doesn't work out (triggering only by one specific leader) I use the  original version.

In my test map it actually works good, the script triggers for all group leaders in the area and the one who gets close enough triggers it.

Not sure why it didn't work in my map.

 

Thanks again for your help, really did me good!

Hope you try my map when I release it, got voice acting and everything! 😛 Gonna need ace2 though.

 

//EDIT: Yeah...leader thing won't work, gonna go with the original one. Since all the leaders go there I get crowds of 2-3 groups stacking on the dead guy, doesn't look good.

Share this post


Link to post
Share on other sites

Sadly I don't use ACE or mods but never mind.

I have had chance to knock up a test script that may help

Just place some units around a deadguy  on fresh map an in his init put null=[this] execvm "finders_test.sqf"

 

then save this bit of code as finders_test.sqf

_deadguy = _this select 0;

sleep 2;

_finders = nearestObjects [vehicle _deadguy, ["Man"], 100];
player globalChat format ["all units found  - %1", _finders];// retruns all units found dead or aliave

sleep 2;

_finders = nearestObjects [vehicle _deadguy, ["Man"], 100] - [player,_deadguy];
player globalChat format ["without player and deadguy  - %1" ,_finders];// retruns all units - deadguy and player


sleep 2;// the following code is used in test for finders 

_finders = (nearestObjects [vehicle _deadguy, ["Man"], 100] select 1);
player globalChat format ["Find nearest unit  - %1" ,_finders];// returns nearest unit to deadguy
_finders = [_finders]; // turns out if only one item found it doesn't return as an array this does restore it as an array

sleep 2;


// test for _finders

_numsidedeadguy = getNumber(configFile >> "CfgVehicles" >> typeOf _deadguy >> "side");// works
_deadguyside = [EAST,WEST,RESISTANCE,CIVILIAN] select _numsidedeadguy;// works

hint format ["original deadguyside is %1",_deadguyside];//displays deadguys original side

{
 if ((alive _x) AND (_deadguyside == side _x)) then
         {player globalChat "working"} else {player globalChat "notworking"};
 } forEach _finders;// if _finder and _deadguyside are the same it reports working.


If deadguy was WEST and _X is WEST it should say Working ect.

 

 

 

 

Share this post


Link to post
Share on other sites

Wow this is awesome.

I end up using it like this for testing:

 

Spoiler

//null=[this,switchUnit1] execvm "finders_test.sqf" 
_deadguy = _this select 0;
_killer = _this select 1;
_numsidedeadguy = getNumber(configFile >> "CfgVehicles" >> typeOf _deadguy >> "side");// works
_deadguyside = [EAST,WEST,RESISTANCE,CIVILIAN] select _numsidedeadguy;// works
_killerside = side _killer;

while { ((_deadguyside != _killerside) AND !(alive _deadguy)) } do
{
sleep 3;// the following code is used in test for finders 

_finders = (nearestObjects [vehicle _deadguy, ["Man"], 100] - [switchUnit1, switchUnit2] select 1);
player globalChat format ["Find nearest unit  - %1" ,_finders];// returns nearest unit to deadguy
_finders = [_finders]; // turns out if only one item found it doesn't return as an array this does restore it as an array

sleep 3;

// test for _finders

hint format ["original deadguyside is %1",_deadguyside];//displays deadguys original side

{
 if ((alive _x) AND (_deadguyside == side _x)) then
         {player globalChat "working"} else {player globalChat "notworking"};
 } forEach _finders;// if _finder and _deadguyside are the same it reports working.
 

 };

 

 

Using this line:

_finders = (nearestObjects [vehicle _deadguy, ["Man"], 100] - [switchUnit1, switchUnit2] select 1);

And it works like a charm in the test, it returns the closest unit, but not the two switchable player units nor the deadguy.

I'm going to test in in my map soon and see if it works out.

 

One more reason for me to work on a vanilla version! 😀

 

Edit:

There is one problem with

_finders = (nearestObjects [vehicle _deadguy, ["Man"], 100] - select 1);

It returns the second deadguy, thus noone else really triggers it if they are close next to each other.

 

This one should work better:

_finders = nearestObjects [vehicle _deadguy, ["Man"], 100] - [player,_deadguy];

 

Share this post


Link to post
Share on other sites

If there are more than one dead unit it may mess things up but if your method works for you that's fine. But what if there's more than two dead units.

You could find those first and build an array of them then remove that array form finders.

 

The next bit is untested as I'm not a main PC.


 

_remove = [];// make an array

{

if (!alive  _x or _x == player) then { _remove = _remove + [_x] };// fliter out unwanted stuff and place in an array

}  foreach ( nearestObjects [vehicle _deadguy, ["Man"], 100]);//this is the array were looking through (_finders)

// then later you can remove it from finders

_finders = nearestObjects [vehicle _deadguy, ["Man"], 100] - remove;// should remove all deadunits however many and player

 

 

 

so basically create an array of all the stuff you don't  want then remove it from _finders leaving just the good bits.

 

 

 

Share this post


Link to post
Share on other sites

That works ! Did a minor adjustment:

if (!alive _x) then { _remove = _remove + [_x, Eagle1, Eagle2] };

}  foreach ( nearestObjects [vehicle _deadguy, ["Man"], 100]);

It's better to use both switchable unit names instead of player in my case.

It only returns enemy AI that is alive and if no AI is close only [].

Perfect!

 

I tried it with this version too:

Got undefined script error that's why I added !isNull - after a few tries I got it anyways.

_finders = (nearestObjects [vehicle _deadguy, ["Man"], 100] - _remove select 0);
if (!isNull _finders) then {_finders = [_finders];};

It returns 'Agent 0x56B4008' in this test, if no other AI was close and i get script errors like 'Error Undefined variable in expression: _finders' for the second line and other stuff.

Don't know what's up with those agents but I've come across them a few times. 😀

But that's ok, I think the version were all close units are triggered is better anyway.

Makes more sense if multiple units run up to the deadguy. The situation were it was heavily crowded only really occured when only the leaders(+their group) went to the dead guy, I think.

Gonna need more tests for that and I still want to try to get the select version too working so I still have the choice to use both.

 

Here's the whole thing so far:

Spoiler

/*
OPFOR, once
condition: this
name : EHlist
EHlist = thislist;
{_x addEventHandler ["killed",{_this execVM "FindBody.sqf"}]} forEach EHlist;
also note use of -- {_x addEventHandler ["fired",{alarm = true}]} forEach EHlist;
*/

_deadguy = _this select 0;
_killer = _this select 1;
_numsidedeadguy = getNumber (configFile >> "CfgVehicles" >> typeOf _deadguy  >> "side");
_finders = [];
_remove = [];

_deadguyside = [EAST,WEST,RESISTANCE,CIVILIAN] select _numsidedeadguy;
_killerside = side _killer;

_LoopCount = 0;


_MaxCount = 69; 

					   if (mein_debug>0) then {  
                player globalChat format ["FindBody.sqf - deadguy:%1 killer:%2 deadguyside:%3 killerside:%4", _deadguy, _killer, _deadguyside, _killerside];
                       };
					  
					   
	sleep 5;				   

while { ((_deadguyside != _killerside) AND !(alive _deadguy) AND !(preAlarm) AND !(alarm) AND !(isNull _deadguy) AND (side _killer == west) AND (_deadguyside == east)) } do
{

_LoopCount = _LoopCount + 1;

					   {

if (!alive _x) then { _remove = _remove + [_x, Eagle1, Eagle2] };// fliter out unwanted stuff and place in an array

}  foreach ( nearestObjects [vehicle _deadguy, ["Man"], 100]);//this is the array were looking through (_finders)

_finders = nearestObjects [vehicle _deadguy, ["Man"], 100] - _remove;// should remove all deadunits however many and player

//_finders = (nearestObjects [vehicle _deadguy, ["Man"], 100] - _remove select 0); // returns nearest unit to deadguy // WIP
//if (!isNull _finders) then {_finders = [_finders];}; // turns out if only one item found it doesn't return as an array this does restore it as an array // WIP

player globalChat format ["Findbody.sqf - deadguy:%1 finders:%2 loopcount:%3" ,_deadguy, _finders, _LoopCount];// retruns all units - deadguy and player
					   
	if (_LoopCount > _MaxCount) exitWith {player globalChat format ["FindBody.sqf - END - LoopCount:%1", _LoopCount];};
					   
		 if ((_LoopCount > 29) && (_LoopCount < 31) && !(isNull _deadguy)) then {
										   
			_Body_Vultures = [_deadguy] execVM "scripts\crows\BodyVultures.sqf";
										   									 
																	            };
   
   if (count _finders > 0) then		//OLD? Error Undefined variable in expression: _finders
   {
      {
         if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x)) then //added distance //removed distance again
         {
            if ((_x knowsAbout vehicle _deadguy > 0.4)) then
            {
				
               _x move getpos _deadguy; 
			   finder = _x;
			   
            };

         };
      } forEach _finders;
         

  };

sleep 5;
if (!isNil "finder") then {
                      
if ((!isNull _deadguy) AND (alive finder) AND (finder distance _deadguy < 3)) then { 

if (mein_debug>0) then { player globalChat format ["FindBody.sqf - deadguy:%1 finder:%2", _deadguy, finder]; };
finder setunitpos "middle";
finder disableAI "MOVE";
finder reveal [player, 1]; //NEW WIP
preAlarm = true;
sleep (floor(random 5));

if (!detected) then {
_shout1 = [leader (group finder), _killer] execVM "scripts\ShoutSound.sqf";
};
if (mein_debug>0) then {player globalChat "FindBody.sqf - AI detected body";};
                       
																				};

};
}; //end of loop

if (!isNil "finder") then {

if (!isNull finder && alive finder) then {finder setunitpos "UP";finder enableAI "MOVE";};	
						


if (preAlarm) then {

{

if (!alive _x) then { _remove = _remove + [_x, Eagle1, Eagle2] };

}  foreach ( nearestObjects [vehicle _deadguy, ["Man"], 50]);

_spotters = nearestObjects [vehicle _deadguy, ["Man"], 50] - _remove;

	 if (mein_debug>0) then { player globalChat format ["FindBody.sqf - deadguy:%1 spotters:%2", _deadguy, _spotters]; };
     preAlarm = false;


    if (finder in (list EHlistBerg_T)) then 
    {

	
// --------------------------------AA_CAMP---------------------------------------------------------	
	if (finder in (list Nighttime7_1)) then {
   
	if (genOff) then { sleep 30; };
	
									};
// -------------------------------------------------------------------------------------------- 
					
         if (!(radioObj)) then {sleep (30 + (random 30));} else {sleep (90 + (random 120));};

    } else {if (finder in (list AllOpfor)) then {detected = true; detected_T = true; if (mein_debug>0) then {player globalChat format ["FindBody.sqf - deadguy:%1 in FeruzAbad.", _deadguy];};};}; // OLD ? - Error list: Type Array, expected Object /   Error position: <list AllOpfor)) then {detected = true; d>

			


           {
              if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x) AND (side _x == EAST)) then
              {
                 detected = true; 
				 _x setBehaviour "COMBAT"; //NEW
				 
				 if (_x distance player < 120 && _x hasWeapon "ItemRadio") then {
				 if (50 > random 100) then {_x say3d "s0";} else {_x say3d "s01";};
				 if (!isNil "_shout1") then {terminate _shout1;};

																								};
				 East_casualties  = East_casualties + 1;
				 
				 		if (mein_debug>0) then { 
  player globalChat format ["East Casualties:%1", East_casualties];
												};
if (!action) then {
		KRON_UPS_reinforcement3 = true;
		KRON_UPS_reinforcement3_pos = getPos _deadguy;
					};
		
									
  if (mein_debug>0) then { player globalChat format ["FindBody.sqf - KRON_UPS_reinforcement3_pos - deadguy:%1", _deadguy];};
												

         if (radioObj) then {

		KRON_UPS_reinforcement0 = true; 
		KRON_UPS_reinforcement0_pos = getPos _deadguy;

							if (mein_debug>0) then { 
  player globalChat format ["FindBody.sqf - KRON_UPS_reinforcement0_pos - deadguy:%1", _deadguy];
												};
			     };


		sleep 60;
                       

		if !(isNull _deadguy) then {

				deleteVehicle _deadguy;
				
				                if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after detected";};
				
									};

              } else {if (mein_debug>0) then {player globalChat format ["FindBody.sqf - deadguy:%1 - all spotters:%2 dead", _deadguy, _spotters];};};
           } forEach _spotters;
		   
                   } else {
				   
				   sleep 60; 
				   
				   if (!isNull _deadguy) then { 
				   
				   deleteVehicle _deadguy; 				   
				   if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after !preAlarm";};
				   
											};
				   
							};		
} else {

				   sleep 60;
				   
				   if (!isNull _deadguy) then { 
				   
				   deleteVehicle _deadguy; 				   
				   if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after !preAlarm";};
				   
											};
											
		};					
				if (!isNil "_shout1") then {terminate _shout1;};
                if (mein_debug>0) then {player globalChat "FindBody.sqf - END of script";};
                       
									

 

 

Here are the two script errors I got for the select version so far:

Not the first time I got the first one, don't really understand it, 'AllOpfor' ist not really all opfor just the center of the AO.

I want to check if finder is in the list AllOpfor: (finder in (list AllOpfor)). I don't get the error for the other two lists right before this one.

Error in expression

<random 120));};} else {if (finder in (list AllOpfor)) then {detected = true; d>
  Error position: <list AllOpfor)) then {detected = true; d>
  Error list: Type Array, expected Object
File D:\Eigene Dateien\Documents\ArmA 2\missions\OP%20GECKOHUNT%20v3%2e0%2e7%20Final.Takistan\scripts\alarm\FindBody.sqf, line 133

 

Maybe I need to add !isNil too? Don't know why _finders is undefined.
Error in expression

<, 100] - _remove select 0);if (!isNull _finders) then {_finders = [_finders];};>
  Error position: <_finders) then {_finders = [_finders];};>
  Error Undefined variable in expression: _finders
File D:\Eigene Dateien\Documents\ArmA 2\missions\OP%20GECKOHUNT%20v3%2e0%2e7%20Final.Takistan\scripts\alarm\FindBody.sqf, line 44

 

 

Share this post


Link to post
Share on other sites

I'm not 100% sure - _remove select 0)  is correct, I'll look at that as soon as I fire up pc later. It may be removing an element from _remove it's self.

Agent can be a trigger and maybe (flies ect) not sure it's been a while.

 

I'll also look at the error as it's better to know why it's failing than work around it so it can be avoided in future.

 

Looking at the whole script I find it very confusing, what is the maxloop stuff?

 

also while talking about arrays you can remove or add anywhere

example

} forEach _finders - [player]; // ect as long as it's an array

 

I've always found Stealth mission a real pain in Arma as you have so little control of AI behaviour.

They either know too much or not enough, at least in A3 you can wipe their target memory (make them forget)

 

 

 

Share this post


Link to post
Share on other sites
Quote

Agent can be a trigger and maybe (flies ect) not sure it's been a while. 

I'll figured that, I have another script with a debug line where I get like 5 agents every time.

Quote

Looking at the whole script I find it very confusing, what is the maxloop stuff?

That's my way of adding crows/flies after x time (loop 30) and ending the whole script after x time (loop 70), if noone detects the corpse.

To make it easier for the player, when he gets detected from an old dead guy right before the target arrives the mission is over. And for CPU usage I guess.

Also a way to see how long the guy has been dead in debug.

 

I guess the main reason why it looks so confusing is all the different areas and variables I got that matter in some way.

And the preAlarm thing. I did that  to end the loop for the AI to detect in the next steps.

I was a total noob when I did all this. But it works. 😛
 

Quote

 

also while talking about arrays you can remove or add anywhere

example

} forEach _finders - [player]; // ect as long as it's an array

 

That's really neat!

Share this post


Link to post
Share on other sites

just thinking about the crows and the loop wouldn't it be better to spawn them with a delay as soon as _deadguy dies before the while loop

then you can just terminate it when you want later  

 

_deadguy spawn { sleep 30; _Body_Vultures = [this] execVM "scripts\crows\BodyVultures.sqf" };// this being the variable _deadguy passed from main script;

 

removing the need for loopcount  and maxcount stuff and as it can only ever run once.

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Okay makes sense, but how do I end the loop after ~5-10 min. if noone detects the deadguy without the count?

Can I do the same thing?

 

_deadguy spawn { sleep 300; exitWith {deleteVehicle _deadguy }; };

Don't have time to test anything now, will be back for it later tonight.

Share this post


Link to post
Share on other sites

not quite _deadguy would be _this

 

_deadguy spawn { sleep 300; exitWith {deleteVehicle _this }; };// exitwith not needed, if it was a loop then that would work.

 

or

_deadguy spawn {_deadguy = _this; sleep 300; deleteVehicle _deadguy; };

 

you can't pass local variables directly,  that spawned code exits on it's own  and after 300 secs it will exit. It's the same as loading and running an .sqf file but it's in memory and it won't return to main code that will  carry on as before.

 

also I don't think exitwith will work  but this will remove deadguy we will probably need to set avariable treu/false at that point  unless BodyVultures.sqf terminates once _deadguy is removed .

 

_deadguy spawn { sleep 300; deleteVehicle _this };

 

how did you end up terminating BodyVultures.sqf script before?

 

 

Share this post


Link to post
Share on other sites

Looks like it, so

_deadguy spawn { sleep 300; deleteVehicle _this }; 

 should be enough

 

may be just one line

_deadguy spawn { sleep 30; _Body_Vultures = [_this] execVM "scripts\crows\BodyVultures.sqf";sleep 300;deleteVehicle _this  };

Share this post


Link to post
Share on other sites

That works really good, just tested it!

It's nice to get rid of so many lines for just one.

Share this post


Link to post
Share on other sites

can you post what you have, I did something and messed it up.

for some reason I changed sides and started getting undefind variable in bodyvulters and that was working fine.

 

very strange.

Share this post


Link to post
Share on other sites

Sure..

Here is the code:

 

Spoiler

/*
OPFOR, once
condition: this
name : EHlist
EHlist = thislist;
{_x addEventHandler ["killed",{_this execVM "FindBody.sqf"}]} forEach EHlist;
also note use of -- {_x addEventHandler ["fired",{alarm = true}]} forEach EHlist;
*/

_deadguy = _this select 0;
_killer = _this select 1;
_numsidedeadguy = getNumber (configFile >> "CfgVehicles" >> typeOf _deadguy  >> "side");
_finders = [];
_remove = [];

_deadguyside = [EAST,WEST,RESISTANCE,CIVILIAN] select _numsidedeadguy;
_killerside = side _killer;

_deadguy spawn { sleep 60; _Body_Vultures = [_this] execVM "scripts\crows\BodyVultures.sqf";sleep 300;deleteVehicle _this };

					   if (mein_debug>0) then {  
                player globalChat format ["FindBody.sqf - deadguy:%1 killer:%2 deadguyside:%3 killerside:%4", _deadguy, _killer, _deadguyside, _killerside];
                       };
					  
					   
	sleep 5;				   

while { ((_deadguyside != _killerside) AND !(alive _deadguy) AND !(preAlarm) AND !(alarm) AND !(isNull _deadguy) AND (side _killer == west) AND (_deadguyside == east)) } do
{

					   {

if (!alive _x) then { _remove = _remove + [_x, Eagle1, Eagle2] };// fliter out unwanted stuff and place in an array

}  foreach ( nearestObjects [vehicle _deadguy, ["Man"], 100]);//this is the array were looking through (_finders)

_finders = nearestObjects [vehicle _deadguy, ["Man"], 100] - _remove;// should remove all deadunits however many and player

player globalChat format ["Findbody.sqf - deadguy:%1 finders:%2" ,_deadguy, _finders];// retruns all units - deadguy and player
 
   
   if (count _finders > 0) then
   {
      {
         if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x)) then
         {
            if ((_x knowsAbout vehicle _deadguy > 0.4)) then
            {
				
               _x move getpos _deadguy; 
			   finder = _x;
			   
            };

         };
      } forEach _finders;
         

  };

sleep 5;
if (!isNil "finder") then {
                      
if ((!isNull _deadguy) AND (alive finder) AND (finder distance _deadguy < 4)) then { 

if (mein_debug>0) then { player globalChat format ["FindBody.sqf - deadguy:%1 finder:%2", _deadguy, finder]; };
finder setunitpos "middle";
finder disableAI "MOVE";
finder reveal [player, 1]; //NEW WIP
preAlarm = true;
sleep (floor(random 5));

if (!detected) then {
_shout1 = [leader (group finder), _killer] execVM "scripts\ShoutSound.sqf";
};
if (mein_debug>0) then {player globalChat "FindBody.sqf - AI detected body";};
                       
																				};

};
}; //end of loop

if (!isNil "finder") then {

if (!isNull finder && alive finder) then {finder setunitpos "UP";finder enableAI "MOVE";};	
						


if (preAlarm) then {

{

if (!alive _x) then { _remove = _remove + [_x, Eagle1, Eagle2] };

}  foreach ( nearestObjects [vehicle _deadguy, ["Man"], 50]);

_spotters = nearestObjects [vehicle _deadguy, ["Man"], 50] - _remove;

	 if (mein_debug>0) then { player globalChat format ["FindBody.sqf - deadguy:%1 spotters:%2", _deadguy, _spotters]; };
     preAlarm = false;


    if (finder in (list EHlistBerg_T)) then 
    {

	
// --------------------------------AA_CAMP---------------------------------------------------------	
	if (finder in (list Nighttime7_1)) then {
   
	if (genOff) then { sleep 30; };
	
									};
// -------------------------------------------------------------------------------------------- 
					
         if (!(radioObj)) then {sleep (30 + (random 30));} else {sleep (90 + (random 120));};

    } else {if (finder in (list AllOpfor)) then {detected = true; detected_T = true; if (mein_debug>0) then {player globalChat format ["FindBody.sqf - deadguy:%1 in FeruzAbad.", _deadguy];};};};

			


           {
              if ((_x != vehicle _deadguy) AND (alive _x) AND (_deadguyside == side _x) AND (side _x == EAST)) then
              {
                 detected = true; 
				 _x setBehaviour "COMBAT"; //NEW
				 
				 if (_x distance player < 120 && _x hasWeapon "ItemRadio") then {
				 if (50 > random 100) then {_x say3d "s0";} else {_x say3d "s01";};
				 if (!isNil "_shout1") then {terminate _shout1;};

																								};

				 
if (!action) then {
		KRON_UPS_reinforcement3 = true;
		KRON_UPS_reinforcement3_pos = getPos _deadguy;
					};
		
									
  if (mein_debug>0) then { player globalChat format ["FindBody.sqf - KRON_UPS_reinforcement3_pos - deadguy:%1", _deadguy];};
												

         if (radioObj) then {

		KRON_UPS_reinforcement0 = true; 
		KRON_UPS_reinforcement0_pos = getPos _deadguy;

							if (mein_debug>0) then { 
  player globalChat format ["FindBody.sqf - KRON_UPS_reinforcement0_pos - deadguy:%1", _deadguy];
												};
			     };


		sleep 60;
                       

		if !(isNull _deadguy) then {

				deleteVehicle _deadguy;
				
				                if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after detected";};
				
									};

              } else {if (mein_debug>0) then {player globalChat format ["FindBody.sqf - deadguy:%1 - all spotters:%2 dead", _deadguy, _spotters];};};
           } forEach _spotters;
		   
                   } else {
				   
				   sleep 60; 
				   
				   if (!isNull _deadguy) then { 
				   
				   deleteVehicle _deadguy; 				   
				   if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after !preAlarm";};
				   
											};
				   
							};		
} else {

				   sleep 60;
				   
				   if (!isNull _deadguy) then { 
				   
				   deleteVehicle _deadguy; 				   
				   if (mein_debug>0) then {player globalChat "FindBody.sqf - Deleting Body after isNil finder";};
				   
											};
											
		};					
				if (!isNil "_shout1") then {terminate _shout1;};
                if (mein_debug>0) then {player globalChat "FindBody.sqf - END of script";};
                       
									

 

 

Share this post


Link to post
Share on other sites

It must be the way I have it set up as it's still giving me errors in _Body_Vultures all I did was change units on the map.

Share this post


Link to post
Share on other sites

Strange,  everything works for me.

Here is my vulture script:

 

//nul = [_victim] execVM "scripts\crows\DeleteVultures.sqf";

_victim = _this select 0;
_bis_flies_victim = [];
_bis_crows_victim = []; 


								   if (mein_debug>0) then {  
                player globalChat format ["BodyVultures.sqf - victim:%1 - spawning vultures", _victim];
														  };
					if (!alarm) then {									  
			_bis_crows_victim = [_victim,15,1,(20 + (random 20))] CALL FUNKTIO_CROW;
							  };

			_bis_flies_victim = [position _victim,0.05,0.2] call bis_fnc_flies;

waitUntil {sleep 30; isNull _victim};
							     
if (mein_debug>0) then {player globalChat format ["BodyVultures.sqf - deleting vultures %1 and %2", _bis_flies_victim, _bis_crows_victim];}; //RETURNS FLIES
														  
{if (!isNull _x) then { deletevehicle _x; }; } foreach _bis_flies_victim;
																							  												  														  
{if (!isNull _x) then { deletevehicle _x; }; } foreach _bis_crows_victim;								

									
									
								

 

Share this post


Link to post
Share on other sites

I'm a dumb ass I accidentally deleted    mein_debug=1;  must have had it set in a units init box

 

any way glad it works so far.

 

 

 

 

 

Share this post


Link to post
Share on other sites

Totally didn't see that:

21 hours ago, f2k sel said:

I've always found Stealth mission a real pain in Arma as you have so little control of AI behaviour.

They either know too much or not enough, at least in A3 you can wipe their target memory (make them forget)

 

Yes it's a real pain, I got so many stuff going on to simulate the AI reacting to the player, but I think I did a nice job so far.

That forget feature sounds awesome.

Can't wait to dig into arma3, but I want to finish this map first. I checked again since when I'm working on it, started it in 2012. 😑

Did have a lot of breaks though.

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
Sign in to follow this  

×