buildingPos: Difference between revisions
No edit summary |
No edit summary |
||
Line 44: | Line 44: | ||
this [[setPos]] [[getPos]] ('''buildingPos''' [ [[nearestBuilding]] this, 1]) | this [[setPos]] [[getPos]] ('''buildingPos''' [ [[nearestBuilding]] this, 1]) | ||
The location returned by '''buildingPos''' is not reliable after the player has exited and then resumed the mission. For code that is executed immediately the mission starts there is no problem. If '''buildingPos''' locations are to be accessed during the mission when the player may have exited and then resumed, save the locations you require at the start of the mission and use these saved locations in your subsequent scripts. |
Revision as of 21:41, 1 May 2006
building buildingPos index
Operand types:
building: Object
index: Number
Type of returned value:
Description:
Returns given indexed position in building, returned value is in format Position.
Examples:
buildingPos [building2, 1] unit setPos ((object 21222) buildingPos 1)
Comments:
These examples will move a unit to the 1st position specified in a buildings model, in the second example - bunker1.
this move (building buildingPos 1)
this move (bunker1 buildingPos 1)
In the default game buildings, the buildingPos is usually right behind a window.
This can make it easy to place units in the windows of buildings, by putting the unit near a building and putting this in its init field:
this setPos getPos (buildingPos [ nearestBuilding this, 1])
The location returned by buildingPos is not reliable after the player has exited and then resumed the mission. For code that is executed immediately the mission starts there is no problem. If buildingPos locations are to be accessed during the mission when the player may have exited and then resumed, save the locations you require at the start of the mission and use these saved locations in your subsequent scripts.