Tabletop Simulator

Tabletop Simulator

Mephisto: The Card Game
Cawolf Kreo 8. dec. 2020 kl. 10:15
"locking" the counter values
The favor counters are not value-locked

Hello I've been using this mod to play mephisto with my friends. I previously played this game outside of tabletop simulator and I greatly enjoyed how this mod sets up the game for 2 players. However, I feel like sliding the favour counter is a bit odd in tabletop simulator and I'm glad that we can use the counter to keep track of the amount of favor each player has. My friends and I assume those counters are there to keep track of favor and not to keep track of soul points, if they are we are sorry for misunderstanding the mod Since the counters can have any value outside of the "favor" range I decided to create a simple Lua script to force "fixing" the values of the counters to stay between 0 and 10.

This is the code I created:
--[[ Lua code. See documentation: http://berserk-games.com/knowledgebase/scripting/ --]] local counters function onload() --The GUIDs for the counter objects counters = { "7137a5", "5a253e" } for key, value in ipairs( counters ) do local obj = getObjectFromGUID(value) counters[key] = obj end end function update () for key, counter in ipairs( counters ) do checkCounter( counter ) end end --[[ Receives a counter object and checks if it's value is between 0 and 10. If it's not, set it's value to 0 if it's a negative number and 10 if it's grater than 10. --]] function checkCounter( counter ) counterVal = counter.getValue() if( counterVal < 0 ) then counter.setValue(0) elseif (counterVal > 10 ) then counter.setValue(10) end end

What I would like to ask is if you could add this global script to the mod in order to help limit the favour a player has on it's counter Again, assuming those counters are for favor and not for soul points