Jump to content
TURCO_AR

Hunters chasing player, problem with vehicles

Recommended Posts

Greetings to all.

I usually use this script to spawn (on trigger position) hunters to hunt the players (on foot) in my multiplayer mission (dedi) and its works perfect.

But updating the mission and adding vehicles for the players I realized that when a player is inside a vehicle and activates the trigger and then gets off the vehicle and continues on foot, the hunters reach the position of the abandoned vehicle and stop there, do not continue chasing the player on foot.

Any help or advice is welcome.

Thank You!

 

Trigger size: 390 x 390

Activation: Any Player

ActType: Present

Server Only: yes

Cond: this

OnAct:

null = [thistrigger,thislist] execvm "4hunters.sqf";

4hunters.sqf

_PosTrigger = _this select 0;
_objetives = _this select 1;
_objetive = _objetives select 0;

if (isserver) then {

private ["_hunters", "_leaderhunters"];

_CountEnemies = {alive _x && side _x == independent} count allUnits;

//Spawn hunters if less than 100 enemies on the map
if (_CountEnemies < 100) then {
		_SpawnPos = position _PosTrigger ;
		_hunters = createGroup independent;
		_hunters = [_SpawnPos, independent, ["I_C_Soldier_Para_2_F","I_C_Soldier_Para_1_F","I_C_Soldier_Para_2_F","I_C_Soldier_Para_1_F"],[],[],[],[],[],260] call BIS_fnc_SpawnGroup;
				
//Move to player position
_leaderhunters = leader _hunters; 
_leaderhunters move (position _objetive);
_hunters setCombatMode "RED"; 
_hunters setBehaviour "AWARE";
_hunters allowFleeing 0;

0 = [_hunters,_objetive] spawn { while {true} do {
	
	params ["_hunters","_objetive"];

	sleep 3;
	
//If the player who activates the trigger moves more than 400 meters away, the hunters are deleted
	if ((_objetive distance (leader _hunters)) > 400) exitWith {

	{deleteVehicle _x} forEach units _hunters; }; }; };

//When the hunters reach the position where the trigger is activated (and the player is not there) wait 3 sec and update the player's new position.	
while {true} do { 														//
   _leaderhunters = leader _hunters; 
   if ((unitReady _leaderhunters) && {(alive _leaderhunters)}) then { 
       sleep 3; 
       if (({ alive _x} count (units _hunters)) != 0) then { 
			_leaderhunters = leader _hunters; 
			_leaderhunters move (position _objetive); 
			_hunters setCombatMode "RED"; 
			_hunters setBehaviour "AWARE";
			_hunters allowFleeing 0;};};};		
	};
};

 

Share this post


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

But updating the mission and adding vehicles for the players I realized that when a player is inside a vehicle and activates the trigger and then gets off the vehicle and continues on foot, the hunters reach the position of the abandoned vehicle and stop there, do not continue chasing the player on foot.

 

Give the following a try:

_objetive = vehicle (_objetives select 0);

 

Share this post


Link to post
Share on other sites

Thanks for answering Maff.
It still doesn't work. The AI's remain in the position of the abandoned vehicle and do not update the location of the player on foot, as seen in the image below:

Spoiler

E8mVCbW.jpg

 

Share this post


Link to post
Share on other sites

@TURCO_AR Did you sort out your issue here?

 

If not i have on my AI compilation list (linked in my signature) a whole section of threads dedicated to this subject,

maybe one of these threads has the answer you seek, check them out:

 

AI Hunting player/group

Make enemy know where player is

http://tinyurl.com/y24hs8nv

Script enemy chases player

https://tinyurl.com/y8j6p9go

How to make AI Hunt a player down while he is on the move?
http://tinyurl.com/lp9h88u

How to make AI KNOW where player is?
http://tinyurl.com/mhej5mj

AI to stalk player group
http://tinyurl.com/ojevr9a

Sneaky Hunter AI
http://tinyurl.com/k7mfpr2

Group chasing/hunting the player
http://tinyurl.com/oh8f74r

Enemies follow players?
http://tinyurl.com/nd3hmea

Trying do make enemy hunt player script.
http://tinyurl.com/mubku5g

All remaining enemy Chase player/team
http://tinyurl.com/lkhn6d2

Making enemy units chase player
http://tinyurl.com/lr8ku6m

AI hunting player
http://tinyurl.com/phm3e5w

============

Hope that helps!

Share this post


Link to post
Share on other sites
On 9/7/2019 at 2:08 PM, TURCO_AR said:

The AI's remain in the position of the abandoned vehicle and do not update the location of the player on foot,,,,

 

 

To update the location of the player:

 

Name the friendly unit   blue1     name the enemy unit  red1.  Place a third man on the map, on a flat road, in an out of the way place. Name him   green1

 

Set up some waypoints including a cycle waypoint so that   green1   runs up the road 50 meters, turns around and runs back again 50 meters, turns around and runs up again 50 meters for ever and ever in a never ending loop.

 

Set up a trigger in the middle of his route.  When he enters the trigger, it activates. When he leaves the trigger it deactivates.

 

You now type some script in two fields of the trigger, the activation field and the deactivation field;

 

red1 move getPos blue1;  red1 setCombatMode "RED";

 

====================================================

 

The result is that whenever  blue1  moves,  red1  will always know his location and will constantly come looking for him.

.

 

 

 

 

 

 

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

×