FAQ: Objects Index
How to place objects
The position of an object on the map is expressed as an array consisting of 3 numbers representing longitude, latitude and height. Thus a position of [0,0,0] would be a point at the extreme bottom left corner of the map, at 0 metres above the ground. The default height is 0 (probably due to gravity) and so a position can also be described with just longitude and latitude - the object will still be on the ground.
To find out the numerical position of an object
To find out the longitude (West/East) position of an object
To find out the latitude (North/South) position of an object
To instantly move an object to another position
new_position is the positional array at which you wish an object to appear, however not many mission editors write the positional array as three numbers in brackets i.e. [10,263,0]. A much more useful method is to place an empty marker on the map and use its positional array instead, like this
To instantly move an object relative to its current position
The example above will place the object 10 metres East of its current location.
You can also move an object relative to some other object:
That example will place object_name 1 metre West and 2 metres North of the object sandbags.
You may wish to move an object relative to the direction the object is facing rather than North/South/East/West. This is a little more complex, requiring sin and cos, and the getdir command.
That will place the object sandbags 10 metres directly in front of the object object_name, regardless of which direction object_name is facing. For a more detailed explanation of how this works, click here.
To instantly place an object higher up (for example on the first floor of a building)
That will place object_name 5 metres in the air at his current position. When placing objects within buildings, height values need to be experimented with.
How to light a fire
In the init box of the fire's properties dialog, type
How to open/close doors
First of all, the building must have doors capable of opening and shutting, as there are many enterable buildings which have static doors, such as barns, and these cannot be animated. Nogova is the only default island with houses in which doors can be opened and closed. They are open by default, probably because Nogova has a very trusting population.
Take Victor Troska's house in Dolina as an example. The front door can be opened and closed. The command to close the door is
(object 137404) is the object ID of Troska's house. The animate command takes two parameters, the name of the animation to activate - in this case "Dvere1" - and the animation phase, or which state the animation is in. For doors there are two states; phase 0 indicates open, phase 1 indicates closed. More complicated animations are possible, with many phases.
See this demomission for examples of how to use this command.
You can also use the animationphase command to check which state the object is in.
How to switch on/off lights
The switchlight command is used to control the status of streetlights. The lightison command can be used to check if the light is on or not.
See this demomission for an example of how to use this command.
How to put a flag on a flagpole
All manner of flags are stored in the surprisingly named Flags.pbo addon. The command to assign a flag to a flagpole is setflagtexture. To put the Stars and Stripes on a flagpole use the following code:
How to make a flock of seagulls
See this demomission.
