Make a table like this:
Code:
Markers = {
{ getObjectFromGUID(marker1_GUID), Vector(3, 1.1, 3) }, -- use fixed coordinates for initial location in storage area. No zone necessary.
{ getObjectFromGUID(marker2_GUID), Vector(3, 1.1, 4) },
{ getObjectFromGUID(marker3_GUID), Vector(3, 1.1, 5) },
{ getObjectFromGUID(marker4_GUID), Vector(3, 1.1, 6) },
}
Now you always have a way to refer to the markers regardless of where they are. Whenever you move a marker to the board increment a separate variable, markersUsed; test that to see if it is 4 and if so, you know to
Code:
for i = 1, 4 do
Markers[i][1].setPosition(markers[i][2])
end
You can get a little fancier, and name the table entries like this:
Code:
Markers = {
{ ref = getObjectFromGUID(marker1_GUID), position = Vector(3, 1.1, 3) }, -- use fixed coordinates for initial location in storage area. No zone necessary.
{ ref = getObjectFromGUID(marker2_GUID), position = Vector(3, 1.1, 4) },
{ ref = getObjectFromGUID(marker3_GUID), position = Vector(3, 1.1, 5) },
{ ref = getObjectFromGUID(marker4_GUID), position = Vector(3, 1.1, 6) },
}
-- and
for i = 1, 4 do
Markers[i].ref.setPosition(Markers[i].position)
end
In either case, you can use markersUsed to index into the Markers table to get the next marker.
I'll be interested to look at the finished mod! I am a catan fan.