Home   Help Search Login Register  

Author Topic: Can you check if an action has been called?  (Read 540 times)

0 Members and 1 Guest are viewing this topic.

aurek

  • Guest
Can you check if an action has been called?
« on: 09 Apr 2003, 16:27:17 »
Ok I want my mission to end after the player opens a door.

The door is on an addon building. when you go up to it the action open door appears. I want to be able to call a script when the player opens the door.

Also how do you force a mission end (to outro) from a script?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Can you check if an action has been called?
« Reply #1 on: 09 Apr 2003, 17:27:02 »


To end a mission from a script, write this in the script:-

end1=true

Now create a trigger.

Type:  End#1
Condition:    end1

You can always force a mission to end using the command forceEnd

Plenty of reviewed ArmA missions for you to play

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:Can you check if an action has been called?
« Reply #2 on: 11 Apr 2003, 01:07:08 »
To check if a door is opened or closed you need to use the animationPhase scripting command. From the command reference:

object animationPhase animation
Operand types:
    object: Object
    animation: String
Compatibility:
    Version 1.75 required.
Type of returned value:
    Number
Description:
    Return animation phase of animation on object.

Example:
    house animationPhase "doors1"


What you need to use that command are two things: a reference to the building with the door(s) ("house" in the above) and the name of the "door animation" of that building ("doors1" in the cmd ref example). Now, houses on Nogova (havent tried them all, so...) have animations called "dvere1" and "dvere2" (and perhaps "dvere3", not sure there) for the doors.

Then how do we get a reference to a certain house? In two ways: if you have a building addon and have that placed on the map, you just use whatever name you assigned to it in the editor. For static buildings you have to get the object Id by clicking on the "Show IDs" button and you'll see the whole map get filled with a lot of numbers. Find the building/house you're interested in and jot down the 6-digit number - the id. Then, a reference to that building is obtained by

    myhouse = object id


Finally, here's the magic you've been waiting for: the "first" door of a Nogovan house is open when the condition

Code: [Select]
  myhouse animationPhase "dvere1" >= 0.5
is true. (Ok, granted, the door is *really* open when the animationPhase of "dvere1" is 1)

In conclusion: find out what the door animations are called in the building you want to check and use something like
the above to trigger your "door opened"-script. Try with "dvere1" and so on, or ask the author of the
building addon.

Best of luck!

*EDIT*: better English and punctuation...


« Last Edit: 11 Apr 2003, 12:56:57 by Killswitch »

aurek

  • Guest
Re:Can you check if an action has been called?
« Reply #3 on: 11 Apr 2003, 10:28:38 »
Great, thanks! :)