LOCATIONS = { { name = "Northside", guids = { "86faac", "8aa8fd" }, position = Vector({-17.12, 1.62, 7.57}) }, { name = "Downtown", guids = { "1aa7cb", "08e13b" }, position = Vector({-17.12, 1.62, -0.03}) }, { name = "Easttown", guids = { "e9bb0a", "88245c" }, position = Vector({-17.12, 1.62, -7.70}) }, { name = "Miskatonic University", guids = { "cedb0a", "e0962c" }, position = Vector({-23.68, 1.68, 7.57}) }, { name = "Rivertown", guids = { "da0b77", "86b480" }, position = Vector({-23.68, 1.63, -0.03}) }, { name = "Southside", guids = { "076b61", "377b20" }, position = Vector({-30.22, 1.64, -0.03}) } } ACOLYTE_SPAWNS = { {-33.72, 1.64, -0.02}, {-13.78, 1.61, 0.01}, {-23.79, 1.63, -10.13} } AGENDAS_GUID = "b99f05" AGENDA_POSITION = {-2.72, 1.62, 0.37} CHEST_GUID = "e4821e" CULTISTS_GUID = "69032d" CULTISTS_POSITION = {-4.81, 1.65, 14.70} ENCOUNTER_DECK_GUID = "28e161" SET_ASIDE = { position = Vector({-5.75, 1.54, 19.25}), rotation = { x=0, y=270, z=0 } } function onLoad() self.createButton({ label="Set Up", click_function="setup", function_owner=self, position={0,0.1,-00}, height=120, width=500, scale={x=1.75, y=1.75, z=1.75}, font_size=80 }) COUNTER = getObjectFromGUID('f182ee') math.randomseed(os.time()) end function setup(_obj, _color, alt_click) if SETUP_DONE then return end SETUP_DONE = true for i,loc in ipairs(LOCATIONS) do local chosen = math.random(2) local guid = loc.guids[chosen] local card = getObjectFromGUID(loc.guids[3 - chosen]) card.setPosition(SET_ASIDE.position) card.setRotation({0, 270, 0}) card = getObjectFromGUID(guid) card.setPosition(loc.position) card.setRotation({0, 270, 0}) end chest = getObjectFromGUID(CHEST_GUID) chest.takeObject({ guid = CULTISTS_GUID, position = CULTISTS_POSITION, rotation = {0, 270, 180}, smooth = false }) local numPlayers = COUNTER.getVar('val') if numPlayers > 1 then local deck = getObjectFromGUID(ENCOUNTER_DECK_GUID) local objs = deck.getObjects() local acolyteGuids = {} for i,card in ipairs(objs) do if card.name == "Disciple of the Devourer" then table.insert(acolyteGuids, card.guid) end end for i=1,numPlayers-1 do deck.takeObject({ guid = acolyteGuids[i], position = ACOLYTE_SPAWNS[i], rotation = {0, 270, 0}, smooth = false }) Global.call("spawnToken", { Vector(ACOLYTE_SPAWNS[i]) + Vector({ 0, 1, 0}), "doom" }) end end Wait.time(setup_2, 1) end function setup_2() local cultists = getObjectFromGUID(CULTISTS_GUID) cultists.shuffle() for i=1,3 do cultists.takeObject({ position = SET_ASIDE.position, rotation = {0, 270, 180}, smooth = false }) end bag = getObjectFromGUID(AGENDAS_GUID) bag.setPosition(SET_ASIDE.position + Vector({0,1,0})) Wait.time(setup_3, 1) end function setup_3() local objs = bag.getObjects() if #objs ~= 2 then return end bag.shuffle() bag.takeObject({ position = AGENDA_POSITION, rotation = {0, 180, 0}, smooth = false }) end