Home   Help Search Login Register  

Author Topic: How to make unit stop looking in a specific direction?  (Read 649 times)

0 Members and 1 Guest are viewing this topic.

Offline Doffen74

  • Members
  • *
  • BUGGERS!!!
    • MarnarNett
I have made a script that lets me order some units to watch a position no matter where they are. Ideal for guarding a gate or giving me cover fire.
The problem is that when I don't want it to look there anymore, and just act as normal in formation, I can't find any way of cancelling the previous. I think the same applies for when you order it by radio to look in a certain direction or scan horizon.

How do you make them stop doing that?

Also - How can I give the order to scan horizon in a script?

Doffen74
« Last Edit: 29 Jul 2005, 19:16:50 by Doffen74 »

klavan

  • Guest
Re:How to make unit stop looking in a specific direction?
« Reply #1 on: 29 Jul 2005, 19:26:39 »
For a single unit:
unitname dowatch objnull

For an entire group:
{_x dowatch objnull} foreach units groupname

AFAIK there's no "scan horizon" comand available to be putted in a script.

Klavan


Offline Doffen74

  • Members
  • *
  • BUGGERS!!!
    • MarnarNett
Re:How to make unit stop looking in a specific direction?
« Reply #2 on: 29 Jul 2005, 19:31:40 »
Just as I thought (almost...)! Thanks for a quick and simple answer! Next problem comming soon...

Doffen74 ::)

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:How to make unit stop looking in a specific direction?
« Reply #3 on: 29 Jul 2005, 20:33:03 »
here's a simple 'scan horizon' script.

call using [unit_name, time_to_watch] exec "scan_horiz.sqs"

Code: [Select]
;scan horizon script

scan_horiz = true
_who = _this select 0
_x = getpos _who select 0
_y = getpos _who select 1
_dir = getdir _who
_dur = _this select 1
_ang = 30

#loop
?not (scan_horiz) : exit

_who setdir (_dir+_ang)
_who dowatch [_x + (100*sin(_dir+_ang)), _y + (100*cos(_dir+_ang))]

~_dur

_dir = _dir + _ang

goto "loop"

you need to define the variable 'scan_horiz' in the init file. when you want the unit to stop scanning the horizon, set 'scan_horiz' to false.
« Last Edit: 29 Jul 2005, 20:35:05 by bedges »