Jump to content
Tyl3r99

How to make AI Hunt a player down while he is on the move?

Recommended Posts

basically im not an experienced mission maker with all the scripts etc but i know the basics and stuff so im happy...

i mostly play LAN with my brother etc..

anyway i want to create a mission where me and my brother are on the run after we have crash landed.

how would i get the enemy to hunt me and my brother down while we are on the move?

for example the AI would always travel to a ROUGH estimated location near us obviously not on our exact position etc..

any help or tips would be appreciated!!

Share this post


Link to post
Share on other sites

make your hunting squads in the editor, place this in init of each hunter squad:

_null = this spawn {
Hunt_players_fnc = {
	_player = "";
	{
		if (isPlayer _x AND alive _x) then {_player = _x};
	} foreach (playableUnits + switchAbleUnits);
	_wp = _this addWaypoint [getPos _player, (50 + (floor(random 200)))];
	_wp setWaypointStatements ["true", "_null = (group this) spawn Hunt_players_fnc;"];
	_wp setWaypointType "SAD";
	_wp setWaypointCombatMode "RED";
	_wp setWaypointSpeed "FULL";
};

_null = (group _this) spawn Hunt_players_fnc;
};

code creates a SAD wp in a random position 250 - 50m around one of the players, they will go search and destroy and when completed create again same way.

  • Like 1

Share this post


Link to post
Share on other sites
make your hunting squads in the editor, place this in init of each hunter squad:

_null = this spawn {
Hunt_players_fnc = {
	_player = "";
	{
		if (isPlayer _x AND alive _x) then {_player = _x};
	} foreach (playableUnits + switchAbleUnits);
	_wp = _this addWaypoint [getPos _player, (50 + (floor(random 200)))];
	_wp setWaypointStatements ["true", "_null = (group this) spawn Hunt_players_fnc;"];
	_wp setWaypointType "SAD";
	_wp setWaypointCombatMode "RED";
	_wp setWaypointSpeed "FULL";
};

_null = (group _this) spawn Hunt_players_fnc;
};

code creates a SAD wp in a random position 250 - 50m around one of the players, they will go search and destroy and when completed create again same way.

this is why i have a lot of respect for the arma community....

which values can i change to widen or closen the radius of waypoint? and can i change the combat mode? i.e. normal, danger etc... im guessing combat mode red is danger?

also when you say each squad do you mean just the leader yeah?

thanks again mate just going to try this out now!!

Share this post


Link to post
Share on other sites

works like a charm... thanks a lot guys.

is there any other neat codes like this one i could have fun with??

Share this post


Link to post
Share on other sites

Well there are almost 9500 threads in this sub-forum, so I would say yes, but if you were to be a bit more specific I may be able to point you in a direction. (Code snippets such as the two in my signature usually have fun, neat things that they do)

  • Like 1

Share this post


Link to post
Share on other sites

tyl3r99 in the future for any AI related questions, problems, ideas, please review my Ai list before you post a thread as your question

and whatever else may have already been answered. see my list:

AI Compilation List of Addons/Mods/Scripts & Misc

also in my sig.

As for the question you had asked in your OP, there is a section for this specifically with about 8 threads listed there.

I will add your thread here to that list when I update the list again only because you have something specific for the AI for when they hunt you.

Share this post


Link to post
Share on other sites

The problem with this is it only sends the AI to my original position and sets a search and destroy waypoint. 

How do I make the Enemy AI constantly update to my position so they truly follow me?

 

 

Share this post


Link to post
Share on other sites

Ok great thanks, gonna mess about with that until i either pull my hair out, give up , or come back to the forums for help..

Share this post


Link to post
Share on other sites

Place an enemy soldier on the map and name him  red1

Now write a command: red1 move getPos player; red1 setCombatMode "RED"

The enemy will find you and kill you. This works with enemy soldiers, helicopters tanks and everything else.

The problem is that when you move to another location, the enemy will always go to your original location. You need the command to start over and over again. The solution:

 

Place a man on the map in an out of the way place.  Place waypoints so he runs through a trigger. Place a  cycle waypoint so he turns around and runs through the trigger again. He will now run through the trigger over and over again in a never ending loop.

 

In the Activation field of the trigger type the command:                  red1 move getPos player; red1 setCombatMode "RED"

In the Deactivation field of the trigger type the same command:   red1 move getPos player; red1 setCombatMode "RED"

 

When the trigger is activated the command is run.  When he runs out of the trigger, the trigger is deactivated, the command is run again.

 

In your testing, you need to find out just where the trigger deactivates. If the trigger does not deactivate, then this will not work.  So use the command:  hint  "trigger ON ON ON"   and hint "trigger OFF OFF OFF

 

.

 

Share this post


Link to post
Share on other sites

Take your pick, theres a large number of threads asking, and talking about how to do it in various ways

that are listed on my AI compilation list

 

AI Hunting player/group

Create group to chase player by script

https://tinyurl.com/y46msusq

Init code/script for AI to hunt the nearest player

https://tinyurl.com/ybufshl6

Hunters chasing player, problem with vehicles

https://tinyurl.com/y3lsmd86

How to make AI QRF/Hunter killer team?

https://tinyurl.com/y33bdg9e

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 while he's 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

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

Share this post


Link to post
Share on other sites

I ended up doing this

 

1)  In my players init I wrote "team1 = group this" 
2) In OPFOR squadleaders init I wrote "team2 = group this"
3) On a player activated trigger i put on activation   "_stalking = [team2,team1] spawn BIS_fnc_stalk;" 

I have multiple enemy squads dotted around each activated with a different trigger..

This worked perfectly!

  • Like 2

Share this post


Link to post
Share on other sites

Hi chrisbaker1981,

 

Sorry for not getting back to you earlier.
This was my hobby horse a year or 2 ago and as a newbie I found the same two things challenged me >> Learning Code & Placing the code <<

 

Anyway, I still have all my code and bright ideas, but having had a break and taken on some new projects (Games / Sims) I have become a little rusty.

Also my 500gb hard drive is full with Arma2 and now Arma3 downloads, and still behind building that new gaming rig  So I was thinking of temporally annexing Arma2, but I haven't.
So if you have any further questions post here or contact me directly but it looks like you've solved it !

 

 

 

 

 

 

Share this post


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

Hi chrisbaker1981,

 

Sorry for not getting back to you earlier.
This was my hobby horse a year or 2 ago and as a newbie I found the same two things challenged me >> Learning Code & Placing the code <<

 

Anyway, I still have all my code and bright ideas, but having had a break and taken on some new projects (Games / Sims) I have become a little rusty.

Also my 500gb hard drive is full with Arma2 and now Arma3 downloads, and still behind building that new gaming rig  So I was thinking of temporally annexing Arma2, but I haven't.
So if you have any further questions post here or contact me directly but it looks like you've solved it !

 

 

 

 

 

 

Thanks John yes solved this one.. Every time i make a mission it ends up being more about an obsession with one or two particular issues that i can't solve... Rather than the actual mission itself.. Quite satisfying when it works. I've never done any scripting before so learning a lot here! 

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

×