Jump to content

Recommended Posts

Hello.

I am very new to coding.

I need a code/script to make enemies know where all the player location are and follow them (they do it automatically anyway?)

Basically i need to make the AI know the location of all player and hunt them down, even if they where spawned in via script or already ingame. 

preferably in a loop maybe? so they get updated, i donno every 30 seconds? or more.

Im very new and bad at coding, i tried reading up on it. but i failed. i tried google it, but to be real, i dont really know what to look for.

Thanks.

This is the last part of my mission to get it fully functional.

Share this post


Link to post
Share on other sites

Execute this script in your initServer.sqf :

 

while {true} do {

	_allPlayers = allPlayers;

	{
	  if ((side _x) == east) then // put the right ennemy side
	  {
	     for "_i" from 0 to count _allplayers -1 do {

	     _x reveal [(_allplayers) select _i, 4];

	     };
	  };
	} forEach allUnits;

	sleep 30; // every 30 seconds
};

 

Share this post


Link to post
Share on other sites

These are all the collected threads for the AI to hunt, or chase the player from my AI Compilation list

linked in my sig, hope these can further help you if you need it.

 

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

  • Like 2

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

×