Tabletop Simulator

Tabletop Simulator

Kingdom Death: Monster v1.5 + CE 2.0 (by KarateSnoopy)
Marky Mark  [developer] 29 Mar, 2020 @ 12:14am
End Round does not flip / refresh survival actions; to hit on knocked down
Comparing code for this and Arbie's mod, I found a quick fix for this by adding the following to the 'GameSim' mod:

**Add at start of script:

tokens = {
p1SurvivalActiaonAGUID = 'd6c354',
p1SurvivalActionBGUID = 'b43546',
p1SurvivalActionCGUID = '65a521',
p1SurvivalActionDGUID = 'd9b05b',
p1SurvivalActionEGUID = 'f16e21',
p2SurvivalActionAGUID = 'b7a730',
p2SurvivalActionBGUID = 'b56c16',
p2SurvivalActionCGUID = '4a0bff',
p2SurvivalActionDGUID = '4850fc',
p2SurvivalActionEGUID = '7213d2',
p3SurvivalActionAGUID = '790a2c',
p3SurvivalActionBGUID = 'ab66c0',
p3SurvivalActionCGUID = 'e380d6',
p3SurvivalActionDGUID = '9bb0fc',
p3SurvivalActionEGUID = 'dbe6f5',
p4SurvivalActionAGUID = '87a2b4',
p4SurvivalActionBGUID = '68fcc5',
p4SurvivalActionCGUID = '551fee',
p4SurvivalActionDGUID = '7d67bf',
p4SurvivalActionEGUID = '13e3c5',
p5SurvivalActionAGUID = '3d527d',
p5SurvivalActionBGUID = '5e571d',
p5SurvivalActionCGUID = '25b999',
p5SurvivalActionDGUID = '262d9d',
p5SurvivalActionEGUID = '81f172',
p6SurvivalActionAGUID = 'd02c0b',
p6SurvivalActionBGUID = '5ddc52',
p6SurvivalActionCGUID = 'f2d051',
p6SurvivalActionDGUID = '3963c4',
p6SurvivalActionEGUID = 'def834',
}

**Add to 'function end_round()' (note - some of this code is probably redundant, but left it all there for now):

local token = {}
for k, v in pairs(tokens) do
token = getObjectFromGUID(v)
token.setRotationSmooth({0,180,0})
end
if string.find(self.getDescription(), 'true') then
local gear = {}
local sheet = {}
local sheetGUID = {}
local buttonTable = {}
for k, v in pairs(gears) do
gear = getObjectFromGUID(v)
sheetGUID = gear.getVar('FullCharSheetGUID')
sheet = getObjectFromGUID(sheetGUID)
if sheet then
buttonTable = sheet.getTable('buttons')
buttonTable.counts.t_dodge = 0
buttonTable.counts.t_surge = 0
buttonTable.counts.t_dash = 0
if buttonTable.counts.t_encourage then
buttonTable.counts.t_encourage = 0
end
if buttonTable.counts.t_embolden then
buttonTable.counts.t_embolden = 0
end
if buttonTable.counts.t_overcharge then
buttonTable.counts.t_overcharge = 0
end
sheet.setTable('buttons', buttonTable)
sheet.call('updateFromOutside', {false})
end
end
end
Last edited by Marky Mark; 29 Mar, 2020 @ 6:32am
< >
Showing 1-8 of 8 comments
Kitaru 29 Mar, 2020 @ 2:57am 
Got it to work using this. Thanks for that.
KarateSnoopy  [developer] 29 Mar, 2020 @ 3:02am 
Updated board
Marky Mark  [developer] 29 Mar, 2020 @ 4:14am 
Thanks KarateSnoopy - glad I could help. I was going to mention that you could also delete the 'Next Round' button at the bottom of the table, and delete the 'Round Tool' script and (if they have not already been deleted) the 4 x 'Turn Marker' scripts
Marky Mark  [developer] 29 Mar, 2020 @ 6:36am 
Looked into the issue with 'to hit' on knocked down targets not being 3, and found a fix for that as well (I did learn something). Insert these bits of script (replacing the old script):

**TO HIT CALC
local playerWeapon = gamesim_players[playerIndex].selected_weapon_stats
local numDice = playerWeapon.speed + gamesim_players[playerIndex].speed
local diceRollReq = get_monster_ai_acc() + gamesim_players[playerIndex].evasion
local neededRoll = ''
if gamesim_state.monster_is_knocked_down then
neededRoll = 3
else
neededRoll = playerWeapon.acc + gamesim_monster.evasion - gamesim_players[playerIndex].accuracy
end

local blindString = ''
if isBlind then
if not gamesim_state.monster_is_knocked_down then
neededRoll = neededRoll - 1
blindString = '+1'
end
end

**KNOCKDOWN SCRIPT
--playerLookAt(playerColorClicked, monster.getPosition(), 30)
gamesim_state.monster_is_knocked_down = not gamesim_state.monster_is_knocked_down
refresh_stats()
KarateSnoopy  [developer] 30 Mar, 2020 @ 12:04am 
updated board
Marky Mark  [developer] 1 Apr, 2020 @ 4:29am 
Another minor improvement relating to knocked down monsters - knocked down monsters should automatically stand up on 'end of turn' - this modification to the end_round function in GameSim will do that:

function end_round()
player_reset_turn(1)
player_reset_turn(2)
player_reset_turn(3)
player_reset_turn(4)
player_hide_wound_buttons()
monster_reset_turn()

if gamesim_state.monster_is_knocked_down then
monster_knockdown()
end
end
KarateSnoopy  [developer] 1 Apr, 2020 @ 12:21pm 
Marky Mark, I made you a contributor so update the board as you see fit. When you have a save you want to upload, in TTS use the top button Modding | Workshop Upload, click on the "Update Workshop" tab, and enter 1652286924 and click upload.
Kitaru 2 Apr, 2020 @ 12:17am 
Can we get the monster to stand up in the same direction it was standing in before it went down?
< >
Showing 1-8 of 8 comments
Per page: 1530 50