OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Terox on 15 Apr 2003, 18:48:21
-
In the init.sqs i want to setmarkertype empty for an array of markers
my array is
markerarray = [marker1, marker2, marker3]
the elemnts of the array being the names ogf the markers
i have tried the following lines
setmarkertype "empty" foreach markerarray
"setmarkertype "empty"" foreach markerarray
{setmarkertype "empty"} foreach markerarray
i just keep getting an error based on the "empty" command
this is so easy and i have gone completely blank, please help :'(
please dont respond with
Why dont you use "marker1" setmarkertype "empty"
as i need to run it on an array who's elements change due to a prior selection
Thx in advance
-
In the Comref it says:
"_x setdammage 1" forEach units group player
so i guess in your case it's:
{_x setmarkertype "empty"} forEach markerarray
???
-
Are marker1, marker2, and marker3 markers or variables that contain names of markers? If they are markers, your array needs to look like this:
markerarray = ["marker1", "marker2", "marker3"]
And then you run this on it:
{_x setMarkerType "EMPTY"} forEach markerarray
You simply can not do anything with forEach without _x in the code string. If the element _x points to is a string, it will use the string for _x. If it points to a variable containing a string, it will use the string for _x.
-
You simply can not do anything with forEach without _x in the code string.
Minor point... that's not quite correct ;)
You can use the line:
"unit addmagazine ""m16""" foreach [1, 2, 3, 4]
To give unit 4 M-16 magazines... there's no _x in that code line.
However, for the situation in question, Tactician has hit the nail right on the head :)
Also, when working with markers, remember that their names should always be in quotes...
-
ah thanks folks, i was missing the quotation marks surrounding the array elements
i had tried the _x initially and with all the other bits n bats, just couldnt understand why my markers werent disappearing