Jump to content
Sign in to follow this  
CaptainBravo

HELP: What is wrong with this hunt script?

Recommended Posts

Hi everyone,

I have searched and found a hunt script where a group of AI will hunt a player.

For some reason it is not working.

hunter = _this select 0

_target = _this select 1

_hunter setBehaviour "AWARE"

_hunter setCombatMode "RED"

_hunter setSpeedMode "Full"

_hunter setFormation "DELTA"

_hunter doTarget _target

_hunter doFire _target

#Loop

?_target distance _hunter >= 10 : {_x doMove getPos _target} foreach units _hunter

~15

? (count units _hunter) <= 1 : exit

?(!(alive _target)) : exit

goto "Loop"

I put line below in trig and activate with radio and nothing happens.

Hunter is group chasing and hunted is player being chased.

[Hunter, hunted] exec "scripts\hunter.sqs";

Any tips on how to get it to work are highly appreciated!

Share this post


Link to post
Share on other sites
[color="Red"]_[/color]hunter = _this select 0

Share this post


Link to post
Share on other sites

"Hunter" must be the name of the groupleader and not the groupname. ;)

Share this post


Link to post
Share on other sites

Thanks IndeedPete. I must have misread Mr Murray editing section :confused:

The only issue is if hunter who is the group leader gets killed group stops!

Anyway to make the group continue the chase after leader killed?

Share this post


Link to post
Share on other sites

Hm, i think you have to give each unit a name and use this instead:

?_target distance _hunter >= 10 : {_x doMove getPos _target} foreach [unit1,unit2,unit3];

Edit: Or maybe "doFollow" works as well:

_hunter = _this select 0
_target = _this select 1
_hunter setBehaviour "AWARE"
_hunter setCombatMode "RED"
_hunter setSpeedMode "Full"
_hunter setFormation "DELTA"
_hunter doTarget _target
_hunter doFire _target

{_x doFollow _target} foreach units _hunter

exit

But i'm not sure about that.^^

Edited by IndeedPete

Share this post


Link to post
Share on other sites

Ok, i tested your mission and modified a little your script, it works, the group will follow the target but will not attack it cause this target is civillian.

Just replace :

?_target distance _hunter >= 10 : {_x doMove getPos _target} foreach units _hunter

by

?_target distance leader _hunter >= 10 : _hunter Move getPos _target

Edited by ProfTournesol
typo

Share this post


Link to post
Share on other sites

thank you very much IndeedPete! It works great now.

On related question: is it possible to have hunter group follow leader of hunted group so if leader of hunted gets killed chase still goes on?

As for firing I thought _hunter doFire _target command would have them fire on anyone?

Edited by CaptainBravo

Share this post


Link to post
Share on other sites

The script works perfect for group hunting one individual. I ahve tried line below to get a group hunt another group (group leader) but did not work.

?_target distance leader _hunter >= 10 : _hunter Move getPos leader_target

Any idea why not working?

Edited by CaptainBravo

Share this post


Link to post
Share on other sites

No space between "leader" and "_target"?

should surely be (for better readability):

?_target distance (leader _hunter) >= 10 : _hunter Move (getPos (leader _target))

FYI I tried this script and it does work, except it crashes Arma 2 after about 2-5 mins for some reason (not sure why!) when I have two groups using it. Anyone else had that?

Edited by disobey

Share this post


Link to post
Share on other sites
The script works perfect for group hunting one individual. I ahve tried line below to get a group hunt another group (group leader) but did not work.

?_target distance leader _hunter >= 10 : _hunter Move getPos leader_target

Any idea why not working?

You must separate the two words : leader and _target

otherwise the engine interprets it as a variable name "leader_target"

So it must be

: _hunter Move getPos leader _target

Share this post


Link to post
Share on other sites

?_target distance leader _hunter >= 10 : _hunter Move getPos leader _target

Is _target a group or a man ?

- If it's a man, it'll work untill this man is dead. After its death, "leader _target" won't mean anything anymore.

- If it's a group, then "_target distance leader _hunter" will not work. You'll have to write :"leader _target distance leader _hunter" to make it work.

Share this post


Link to post
Share on other sites

Thanks ProfTournesol, I finally got it working.Target was a group.

Just for my own learning experience: should we not also add

"leader _hunter Move getPos leader _target:

?leader _target distance leader _hunter >= 10 : leader _hunter Move getPos leader _target ?

Thank you all for your help and knowledge.

Share this post


Link to post
Share on other sites

Hi CaptainBravo

Do you think you could post a copy of the final code please?

Share this post


Link to post
Share on other sites

My applogies for the delayed post.

This goes in activating trig or init field:

[Hunter1, Hunted1] exec "scripts\hunter1.sqs";

Hunter1= name of hunting group

Hunted1 = nameof roup being hunted

hunter1.sqs :

_hunter = _this select 0

_target = _this select 1

_hunter setBehaviour "AWARE"

_hunter setCombatMode "RED"

_hunter setSpeedMode "Full"

_hunter setFormation "DELTA"

_hunter doTarget _target

_hunter doFire _target

#Loop

?_target distance leader _hunter >= 10 : _hunter Move getPos _target

~10

? (count units _hunter) <= 1 : exit

?(!(alive _target)) : exit

goto "Loop"

I will post link to my next mission that will have hunters with dogs and working flash lights!

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  

×