Home   Help Search Login Register  

Author Topic: question array / variables / GetDir  (Read 508 times)

0 Members and 1 Guest are viewing this topic.

kingneb

  • Guest
question array / variables / GetDir
« on: 23 Apr 2003, 01:19:29 »
Hello from kingneb

-How is it that you declare a variable in a script? How do you declare a variable in a trigger field.

- How do you exit a script when you leave a trigger area?

- ???My plan is to get 3 soldiers to face me (the player) when a trigger area is entered? To do this I will to use a mathematicial formula (Unit Azmiut Position) = (Player Azmuit Position) - 180.  How would you store (in a script) the player azmuit with the GetDir command in a variable? What command would you use to get the unit to spin to the azmiut of the returned value of this formula?  

- If I have further trouble setting up this situation, I will post another topic.

                                                                 - I thank anyone who can assist

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:question array / variables / GetDir
« Reply #1 on: 23 Apr 2003, 01:56:28 »
Hey Kingneb...

Setdir will make your guys face a certain direction, but only for a second. After you've executed the command, they will go back to watching whatever they think is the most interesting ::)

I think what you might be after is the dowatch command...
Try the line:

"_x dowatch player" foreach [ soldier1,soldier2,soldier3 ]

And see if it achieves what you are after ;)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:question array / variables / GetDir
« Reply #2 on: 23 Apr 2003, 10:46:41 »
I'm not sure what you mean by "declare" a variable, but if you want to create a variable and set it to a particular value all you have to do is this (in either trigger or waypoint or script or init field)

variable1=297
variable2=true
variable3=false

If you want a script to exit when the players leaves an area, you put this line in your script

? gone:exit

There are various ways of doing the trigger, it may be this

On deactivation: gone=true

Not that if OFP finds an uninitialised variable (ie one with no value) it regards the whole expression as false.    There are several good tutes on scripting which cover varibles, go and have a look at them (Johan Gustafsson's, Devilchaser's, I think maybe even snYpir's)

If you have further trouble on this question, post it in this thread.   Only start a new topic if its a completely new question.
Plenty of reviewed ArmA missions for you to play