createLocation: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|seealso= *\[\[([^ ]+)\]\], \[\[([^ ]+)\]\]" to "|seealso= $1 $2")
(Add alternative syntax)
 
(8 intermediate revisions by the same user not shown)
Line 21: Line 21:


|descr= Creates a location of the specified class and dimensions at the specified position.
|descr= Creates a location of the specified class and dimensions at the specified position.
Classes are defined in {{hl|CfgLocationTypes}}; for possible location types see [[Location#Location Types|Location Types]].
Classes are defined in {{hl|CfgLocationTypes}}; for possible location types see [[Location#Location Types|Location Types]].<br>
The alternative syntax allows to convert a non-editable (built-in) terrain location into an editable one, with the following restrictions:
* it cannot be deleted (but can be [[setType]] to "Invisible" to hide it)
* it cannot be moved


|s1= [[createLocation]] [className, position, sizeX, sizeY]
|s1= [[createLocation]] [className, position, sizeX, sizeY]
Line 35: Line 38:
|r1= [[Location]]
|r1= [[Location]]


|x1= <code>_location = [[createLocation]] [<nowiki/>[[Location#Location Types|"NameVillage"]] , [4035,2151,10], 100, 100];</code>
|s2= [[createLocation]] [location]


|x2= <code>_location = [[createLocation]] [<nowiki/>[[Location#Location Types|"NameVillage"]] , [4035,2151,10], 30, 30];
|s2since= arma3 2.10
_location [[setText]] "Player town";</code>


|seealso= [[setText]] [[nearestLocation]] [[nearestLocations]] [[locationPosition]] [[nearestLocationWithDubbing]], [[setRectangular]], [[rectangular]], [[size]]
|p21= location: [[Location]] - a terrain's location. If a scripted location is provided, it is simply returned
 
|r2= [[Location]] - a script-editable location
 
|x1= <sqf>_location = createLocation ["NameVillage", [4035,2151,10], 100, 100];</sqf>
 
|x2= <sqf>
_location = createLocation ["NameVillage", [4035,2151,10], 30, 30];
_location setText "Player town";
</sqf>
 
|x3= <sqf>
private _terrainLocation = nearestLocation [player, "nameCity"]; // assuming it returns a built-in location
_terrainLocation setType "Invisible"; // does not do anything
private _editableLocation = createLocation [_terrainLocation]; // does the conversion
_editableLocation setType "Invisible"; // hides the location
</sqf>
 
|seealso= [[setText]] [[nearestLocation]] [[nearestLocations]] [[locationPosition]] [[nearestLocationWithDubbing]] [[setRectangular]] [[rectangular]] [[size]]
}}
}}

Latest revision as of 14:56, 23 June 2022

Hover & click on the images for description

Description

Description:
Creates a location of the specified class and dimensions at the specified position. Classes are defined in CfgLocationTypes; for possible location types see Location Types.
The alternative syntax allows to convert a non-editable (built-in) terrain location into an editable one, with the following restrictions:
  • it cannot be deleted (but can be setType to "Invisible" to hide it)
  • it cannot be moved
Groups:
Locations

Syntax

Syntax:
createLocation [className, position, sizeX, sizeY]
Parameters:
className: String
position: Position2D, Position3D or Object
sizeX: Number - in meters
sizeY: Number - in meters
Return Value:
Location

Alternative Syntax

Syntax:
createLocation [location]
Parameters:
location: Location - a terrain's location. If a scripted location is provided, it is simply returned
Return Value:
Location - a script-editable location

Examples

Example 1:
_location = createLocation ["NameVillage", [4035,2151,10], 100, 100];
Example 2:
_location = createLocation ["NameVillage", [4035,2151,10], 30, 30]; _location setText "Player town";
Example 3:
private _terrainLocation = nearestLocation [player, "nameCity"]; // assuming it returns a built-in location _terrainLocation setType "Invisible"; // does not do anything private _editableLocation = createLocation [_terrainLocation]; // does the conversion _editableLocation setType "Invisible"; // hides the location

Additional Information

See also:
setText nearestLocation nearestLocations locationPosition nearestLocationWithDubbing setRectangular rectangular size

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note