Home   Help Search Login Register  

Author Topic: Holding a specific direction  (Read 545 times)

0 Members and 1 Guest are viewing this topic.

tehhunter

  • Guest
Holding a specific direction
« on: 02 Jul 2005, 04:40:53 »
Hey everybody,
I'm relatively new to the OFPEC forums and OFP scripting, but I am experienced in scripting with higher level things.

So anyhoo, I am trying to make a speech by an officer in which many columns/rows of troops stand at attention to the speech.

My problem is that I have tried using this in the unit init:

this setDir 0; doStop this

While the unit does not move,  I find they will change their direction randomly. Some will face the way I specify (probably just randomly), and some will look off nowhere.

Is there any way to make sure they do not change direction once they have been created?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Holding a specific direction
« Reply #1 on: 02 Jul 2005, 07:28:31 »
This is real pain.  Here is a script I have written to keep them facing in a specific direction.  It is still not perfect, I am looking at doing something similar to stop them turning their heads.  I know what to do I just haven't got round to it yet.  Basically just make them watch a point that is a long way away.

Code: [Select]
;KeepFacing.sqs
;This script keeps a unit facing in a specified direction for a specified length of time
;called by:  [unit,direction,time] exec "KeepFacing.sqs"

_unit = _this select 0
_dir = _this select 1
_duration = _this select 2


#loop
~0.01
_unit setDir _dir
if (_time < _duration) then {goto"loop"}
exit


Offline Morglor9

  • Members
  • *
Re:Holding a specific direction
« Reply #2 on: 02 Jul 2005, 09:06:43 »
if u don't need the guys to move later (like in a cutscene) use:

Code: [Select]
dude setdir (whatever you want)
dude disableAI "MOVE"
« Last Edit: 02 Jul 2005, 09:07:01 by Morglor9 »
Cymbaline

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Holding a specific direction
« Reply #3 on: 02 Jul 2005, 12:47:28 »
The problem comes from doStop which is completely bug ridden (= BISd ::) )...
Usually it forces the unit to watch at 0 (north) but it seems that sometimes some another direction is 'selected'... Probably when the unit is already facing 0 ::)

I've always used a bit similar method like THobson's script above does...
« Last Edit: 02 Jul 2005, 12:48:06 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.