Results 1 to 3 of 3

Thread: Placing markers on board

  1. #1

    Placing markers on board

    I'm working on Catan Histories: Struggle for Rome. I've already set up the code for the chits to highlight when their number is rolled (this is very useful as there are up to six chits of the same number on the board). The way this game works is that the player rolls the dice four times, everytime the dice are rolled the players get resources for the number rolled (or the robber moves) and a marker gets placed on a track on the board to mark that number has been rolled in order to avoid duplicated rolls. I have the location of where the four markers have to go. I have the GUIDs for the four markers, and I have a markerZone so that the code looks at that area to pick the next marker if available. That's where I hit a wall: I got the function placeMarkers( dieSum ), where the code is supposed to get the next available marker from the markerZone and place them on the corresponding number on the track. And, if there are no markers available, it is supposed to reset the markers to their original zone, and pick and one. This last bit should be easy. My problem is getting the right code for getting the marker and placing it on the board. Any suggestions on ways of doing this would be greatly appreciated.

  2. #2
    Join Date
    Sep 2017
    Posts
    397
    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.

  3. #3
    Cheers for that. In the end we went with:

    _rollMarkerGUIDs = {
    [1] = 'de084a',
    [2] = 'f9216b',
    [3] = 'd7ae24',
    [4] = '143b5a'
    }

    for the four markers, then

    -- Board locations for moving tokens around
    _rollMarkerStarts = {
    [1] = {-19.42, 2.63, 14.75},
    [2] = {-18.47, 2.63, 13.77},
    [3] = {-19.42, 2.63, 12.78},
    [4] = {-20.33, 2.63, 13.78}
    }
    _rollMarkerLocations = {
    [2] = {-17.72, 2.63, 16.68},
    [3] = {-16.51, 2.63, 15.45},
    [4] = {-16.06, 2.63, 13.79},
    [5] = {-16.52, 2.63, 12.13},
    [6] = {-17.73, 2.63, 10.86},
    [7] = {-19.46, 2.63, 10.46},
    [8] = {-21.12, 2.63, 10.88},
    [9] = {-22.37, 2.63, 12.12},
    [10] = {-22.82, 2.63, 13.80},
    [11] = {-22.36, 2.63, 15.47},
    [12] = {-21.09, 2.63, 16.69}
    }

    and so on, we got it sorted in the end. Now it places the makers in the corresponding places, puts a message on screen if a duplicate has been rolled to tell the player to roll again, replaces the markers to the middle if all markers have been placed... Now we are working on automating the set-up further.

Similar Threads

  1. Placing Custom UI in relation to TTS UI
    By Unreal_Ed in forum Suggestions
    Replies: 0
    Last Post: 07-11-2018, 10:42 PM
  2. [SOLVED] Dealing (or placing on game board) the last card in a deck
    By Creative Guy in forum Scripting
    Replies: 2
    Last Post: 06-04-2017, 07:41 AM
  3. Problems with placing objects....
    By Tragic in forum Scripting
    Replies: 7
    Last Post: 02-14-2017, 08:00 PM
  4. [ADDED] [v5.5] Number Markers
    By Ribonizer in forum Suggestions
    Replies: 8
    Last Post: 08-29-2015, 01:07 AM
  5. Drawing/Markers
    By eelikay in forum General Discussion
    Replies: 3
    Last Post: 04-19-2014, 02:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •