diff --git a/scripts/zones/Southern_San_dOria/npcs/Varchet.lua b/scripts/zones/Southern_San_dOria/npcs/Varchet.lua index 45097d07338..2ce0d1500aa 100644 --- a/scripts/zones/Southern_San_dOria/npcs/Varchet.lua +++ b/scripts/zones/Southern_San_dOria/npcs/Varchet.lua @@ -23,13 +23,14 @@ function onTrade(player, npc, trade) local pdie2 = math.random(1, 6) local ptotal = pdie1 + pdie2 + local result = GAME_LOST if ptotal > vtotal then - player:startEvent(519, vdie1, vdie2, vtotal, pdie1, pdie2, ptotal, GAME_WON) - elseif vtotal > ptotal then - player:startEvent(519, vdie1, vdie2, vtotal, pdie1, pdie2, ptotal, GAME_LOST) + result = GAME_WON elseif ptotal == vtotal then - player:startEvent(519, vdie1, vdie2, vtotal, pdie1, pdie2, ptotal, GAME_TIE) + result = GAME_TIE end + player:setLocalVar('VarchetGame', result) + player:startEvent(519, vdie1, vdie2, vtotal, pdie1, pdie2, ptotal, result) else player:startEvent(608) end @@ -48,7 +49,8 @@ end function onEventFinish(player, csid, option) if csid == 519 then - if option == GAME_WON then + local result = player:getLocalVar('VarchetGame') + if result == GAME_WON then local gilPayout = 10 player:addGil(gilPayout) player:messageSpecial(ID.text.GIL_OBTAINED, gilPayout) @@ -57,12 +59,13 @@ function onEventFinish(player, csid, option) player:setCharVar("exitTheGamblerStat", 1) player:showText(player:getEventTarget(), ID.text.VARCHET_KEEP_PROMISE) end - elseif option == GAME_TIE then + elseif result == GAME_TIE then local gilPayout = 5 player:addGil(gilPayout) player:messageSpecial(ID.text.GIL_OBTAINED, gilPayout) else player:messageSpecial(ID.text.VARCHET_BET_LOST) end + player:setLocalVar('VarchetGame', 0) end end