Home   Help Search Login Register  

Author Topic: Now how do I get a Civ bike to chase me?  (Read 752 times)

0 Members and 1 Guest are viewing this topic.

Riker13

  • Guest
Now how do I get a Civ bike to chase me?
« on: 18 Jan 2005, 13:33:37 »
From my previous post I have a Civillian able to fire at me but when I run off he just stays where he is, I need him to get on his bike and chase me as he is a cop.

How do I do that?

Many Regards

Lean Bear

  • Guest
Re:Now how do I get a Civ bike to chase me?
« Reply #1 on: 18 Jan 2005, 15:57:11 »
If you have it set so that the Civ hates the player (whichever side he is on) then he should chanse after you.

Getting on his bike is another thing altogether. He won't automatically get on his bike, so you'll have to scipt that bit.

Use something like (syntax not 100% acc.):

_civ = this select 0
_veh = this select 1

#Start
!(player distance _civ < 50) : goto "Mount"

goto "Start"

#Mount
_civ getInDriver  _veh

#Chase
_pos = getPos player

[_civ, 0] setWPPos _pos
~0.001

goto "Chase"

exit


Then, in the mission editor make a trigger with the following:

x=0,y=0

Condition: this

OnActivation: ["NameOfCivillianUnit", "NameOfBike"] exec "ScriptName.sqs"  

Riker13

  • Guest
Re:Now how do I get a Civ bike to chase me?
« Reply #2 on: 18 Jan 2005, 16:18:48 »
Many thanks for that.  ;)

redgun

  • Guest
Re:Now how do I get a Civ bike to chase me?
« Reply #3 on: 18 Jan 2005, 17:27:31 »
you could do it like that, in order to make it more ralistic:


_civ = this select 0
_veh = this select 1

#aLoop
!(player distance _civ < 50) : goto "run"

goto "aLoop"


#run
_civ doMove getpos  _veh

#bLoop
!(_civ distance _veh < 2) : goto "Mount"

goto "bLoop"

#Mount
player action ["get in",_veh]


#Chase
_pos = getPos player

_civ doMove getPos player
?(_civ distance player) > 100 : goTo "abort"
~0.001

goto "Chase"

"Abort"

?(_civ distance player) < 50 : goTo "chase"
goTo "abort"
exit



the trigger is the same but this script will actually cause the civ to run to the vehicle, get in and follow you, if the distance between the civ and you gains a higher value than 100, the civ will stop moving. if player moves within 50m to civ, civ will restart the chase.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Now how do I get a Civ bike to chase me?
« Reply #4 on: 19 Jan 2005, 00:45:39 »
I think

#bLoop
!(_civ distance _veh < 2) : goto "Mount"

goto "bLoop"


Could be replaced by

@!(_civ distance _veh < 2)


Should:
player action ["get in",_veh]

not be:
_civ action ["get in",_veh]

and
"Abort"

be:
#abort



I would also suggest a longer delay than ~0.001 in the Chase loop

What is the civi supposed to do when he gets near the player?


Lean Bear

  • Guest
Re:Now how do I get a Civ bike to chase me?
« Reply #5 on: 19 Jan 2005, 09:01:14 »
Quote
I would also suggest a longer delay than ~0.001 in the Chase loop

Yeah, I think you're right if you're refering to redgun's version. The civ would constantly be stoping and turning to wards the player.

If you use the WP version then it would be much more continuous.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Now how do I get a Civ bike to chase me?
« Reply #6 on: 19 Jan 2005, 12:45:41 »
I haven't studied the script but I would have thought a delay of ~5 would be better.

~0.001 is I think the fastest loop you can have, which is very CPU intensive and completely unneccessary here.     Also, if you issue too many orders too quickly, it can confuse the unit.
Plenty of reviewed ArmA missions for you to play

Lean Bear

  • Guest
Re:Now how do I get a Civ bike to chase me?
« Reply #7 on: 19 Jan 2005, 12:49:06 »
meh, I suppose that's true.

It is a fact that ~0.001 causes a lot of CTDs. :P

redgun

  • Guest
Re:Now how do I get a Civ bike to chase me?
« Reply #8 on: 19 Jan 2005, 19:40:42 »
oh yeah, thanks a lot guys.

made some mistakes sorry for that.

maybe something like ~5 to ~10 should to the best job.

generally I try to avoid wp-commands in scripts, because with using Move or doMove you can still make the unit follow its wp, intepended from tghe script.

of course it can be done otherwise too, at least i think so.