Tabletop Simulator

Tabletop Simulator

Burgle Bros - Scripted Setup
Submitted Modification
I made a small modification to your mod that I thought I would share in case you (or anyone else) found it useful.

I would have sent it to you (Framistan) privately, except Steam doesn't seem to allow that unless you're Friends.



Purpose:

Set the guard die's initial value when each guard has their very first destination set.


Scripts Changed: Global


============================================
Excerpt from: "local allTheVars = {"


Original:

-- Has the guard for a floor already been placed in its initial location?
-- Set by the Patrol Control's placeGuard() script.
guardPlaced = {},


New:

-- Has the guard for a floor already been placed in its initial location?
-- Set by the Patrol Control's placeGuard() script.
guardPlaced = {},

-- Has the guard had its first destination set yet?
-- Set by newDestination().
guardInitialDestination = {},



============================================
Excerpt from: onLoad()


Original:

for thisFloor = 1, 3 do
allTheVars.guardPlaced[ thisFloor ] = false
allTheVars.patrolLeftovers[ thisFloor ] = nil
end


New:

for thisFloor = 1, 3 do
allTheVars.guardPlaced[ thisFloor ] = false
allTheVars.guardInitialDestination[ thisFloor ] = false
allTheVars.patrolLeftovers[ thisFloor ] = nil
end



============================================
Excerpt from: newDestination()

Original:

-- Get local pointers to the game variables.
local gameStarted = Global.getVar( "gameStarted" )
local guardPlaced = Global.getVar( "guardPlaced" )
local patrolLeftovers = Global.getVar( "patrolLeftovers" )


New:

-- Get local pointers to the game variables.
local gameStarted = Global.getVar( "gameStarted" )
local guardPlaced = Global.getVar( "guardPlaced" )
local guardInitialDestination = Global.getVar( "guardInitialDestination" )
local patrolLeftovers = Global.getVar( "patrolLeftovers" )



============================================
Excerpt from: newDestination()

Original:

-- Move the guard die.
local theGuardDie = Global.call( "getObjectFromName",
{ "Guard" .. theFloor .. " Die" } )
theGuardDie.setPositionSmooth( newDestLoc )


New:

-- If this is the initial placement of the guard, set the initial guard die value.
local theGuardDie = Global.call( "getObjectFromName",
{ "Guard" .. theFloor .. " Die" } )

if guardInitialDestination[ theFloor ] == false then
local guardDieValue = theFloor + 1
theGuardDie.setValue(guardDieValue)

-- Remember that the guard has had its initial destination set.
guardInitialDestination[ theFloor ] = true
Global.setVar( "guardInitialDestination", guardInitialDestination )

end

-- Move the guard die.
theGuardDie.setPositionSmooth( newDestLoc )


============================================
============================================


It's a small change, but I made it because it seemed to be the one thing missing from the otherwise very thorough scripted setup.

Hopefully, someone finds this useful.