Jump to content
Sign in to follow this  
cjust89

Making enemy units chase player

Recommended Posts

So I've made a mission where you HALO jump and capture an enemy colonel and toward the end of this mission i want a trigger that makes some of the random patrolling enemy units (which use upsmon patrol script at the beginning of the mission) to chase me the player. How would i achieve this?

So it's as if after we capture the colonel they realize he's missing and begin coming after me.

In the trigger thus far i've made it so when they will chase me im set to friendly so they wont try and kill me but are running after me, but it will simulate a chase. I just cant get them to actually follow me.

Thanks in advance.

Share this post


Link to post
Share on other sites
while {true} do {
  (leader groupname) domove (getPos playerUnitname);
  sleep 5;
};

Share this post


Link to post
Share on other sites

Okay so i pasted your code into the trigger

while {true} do {

(leader groupname) domove (getPos playerUnitname);

sleep 5;

};

changing "groupname" to that of the enemy units name (the one doing the chasing)

and" playerunitname" to my players name (person being chased)

while {true} do {

(leader chaser) domove (getPos chasee);

sleep 5;

};

and nothing happens

Share this post


Link to post
Share on other sites

groupname must be name of group not name of unit, so you should have placed

chaser = group this in leader of chaser group init.

I used groupname incase you had a group of people chasing and maybe some got killed by player, so then rest would keep following.

try this as well after doing above:

in trigger on act:

_null = [] spawn {
  while {true} do {
     (leader chaser) domove (getPos chasee);
     sleep 5;
  };
};

Share this post


Link to post
Share on other sites

awesome!!! Thanks the new script you posted worked perfectly.

just curious though what does the "sleep 5;" do, my understanding was its a sort of pause timer of some kind?

One final question during the chase part I've set myself to friendly so they obviously wouldn't kill me, but i still want that sense of being shot at, any suggestions of existing scripts out there?

Even if it were just an audio script with lots of pings and sounds of bullets flying by etc that would be okay with me.

Share this post


Link to post
Share on other sites

Take a look HERE. You will find some awesome stuff how to use Scripting commands...

:rolleyes:

Share this post


Link to post
Share on other sites

The link Buliwyf posted have almost everything a new scripter needs, i strongly recomend the top one in his link, mr murrays editing guide deluxe.

It is a new scripters bible even if its old and using .sqs syntax instead of .sqf.

Also here is all official scripting commands in arma2.

just curious though what does the "sleep 5;" do, my understanding was its a sort of pause timer of some kind?

yes it basically sleeps/waits 5 seconds and then start from beginning again.

Reason why i made it 5 is that if given to often, AI might stand still trying to calculate way to go, and then get new doMove command and recalculate before moving.

One final question during the chase part I've set myself to friendly so they obviously wouldn't kill me, but i still want that sense of being shot at, any suggestions of existing scripts out there?

Even if it were just an audio script with lots of pings and sounds of bullets flying by etc that would be okay with me.

well you can add your own audio/music files to arma by converting them to .ogg files, more info here:

also you could try and setPos a hidden and invincible object just above the head of the player(y axis to be 2 or 3), and use doTarget to aim and doFire to fire, but then AI would stop, aim, fire, so pursuit may be slowed.

think your best bet is to go with "fake" sounds.

Share this post


Link to post
Share on other sites
you can do while loops and sleep inside trigger activation??

yeah, if you use spawn, paste directly in trigger, then you use spawn as any other normal script, highly recomend typing script out in your editor of choise, and then paste in trigger on act field.

I use Arma edit.

NOTE: comment fields will error out like this, so dont use them.

// this comment will cause error when used in spawn in trigger.

paste me in trigger on act and i work:

_null = unit1 spawn {
  _unit = _this;
  waitUntil {alive _unit};
  while {alive _unit} do {
     hint format["health of unit is %1",getDammage _unit];
     sleep 10;
  };
};

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  

×