ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Wed Aug 05, 2020 7:19 am

All times are UTC

Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Nov 12, 2018 10:58 pm 

Joined: Mon Nov 12, 2018 10:51 pm
Posts: 1
I already did send this through the game but the sticky topic says post it here, too.

Basically what happened is I was going through the old forest as a rogue, and uncovered a trap. I used the Disarm Trap spell, and it was successful. After that, trying to rest (or autoexplore) gave the message "Trap has been disarmed". I quit the game, and upon returning, trying to rest (or autoexplore) tosses out this dump:

[LOG] Resting starts...
Lua Error: /mod/class/Trap.lua:202: attempt to compare nil with number
At [C]:-1 __le
At /mod/class/Trap.lua:202 restCheck
At /engine/interface/PlayerRest.lua:47 restInit
At /mod/class/Game.lua:2142
At /engine/KeyBind.lua:236

One other thing I noticed (I went back to the Old Forest looking for more traps, maybe to reset it? I dunno) was that enemies being in range didn't seem to stop the character from entering stealth mode.

PostPosted: Thu Dec 20, 2018 9:17 pm 

Joined: Wed Jun 06, 2018 10:53 am
Posts: 62
I encountered this issue as well, no error though. That character was also a rogue (I don't remember what race). I tried to disarm a trap in a vault with no luck. Then it disappeared (disarmed?) and that character lost his ability to rest and auto-explore.

PostPosted: Thu Jan 16, 2020 3:33 pm 
Low Yeek

Joined: Sat May 30, 2015 3:01 am
Posts: 5
Met something similar in 1.6.6 and already reported it in game.
I step on a trap when fighting boss. It ask me if I want to disarm and learn the trap, so I pressed ESC and then cannot REST anymore.
By source code, it seems like restCheck is not set right when use ESC to quit disarm procedure.

And I want to know is there any method I can rest again without using developer mode(because the cheat will be true)?

Game version: tome-1.6.6
Addons: ashes-urhrok-1.6.0[O], items-vault-1.6.0[O], possessors-1.6.6[O], orcs-1.6.0[O], cults-1.6.0[O]

Game version (character creation): tome-1.6.6
Lua Error: /mod/class/Trap.lua:202: attempt to compare nil with number
At [C]:-1 __le
At /mod/class/Trap.lua:202 restCheck
At /engine/interface/PlayerRest.lua:47 restInit
At /mod/class/Game.lua:2142
At /engine/KeyBind.lua:231

English isn't my native language +1

PostPosted: Thu Jan 16, 2020 4:45 pm 

Joined: Thu Jun 21, 2012 9:37 am
Posts: 83
The game does the following:
1 - Copies player.restCheck to oldrestCheck
2 - Replaces player.restCheck with a function to disarm the trap
3 - Copies oldrestCheck to player.restCheck

Step 3 broke somehow, so now your player.restcheck has disarm trap code that shouldn't be there.

From trap.lua
function _M:onDisarm(x, y, who)
   self:check("disarmed", x, y, who)
   --table.set(game, "debug", "last_trap_disarmed", self) -- debugging
   -- The player may unlock a trap talent when disarming a (similar) trap (uses Trap Mastery)
   if self.unlock_talent_on_disarm and who.player and who:knowTalent(who.T_TRAP_MASTERY) and core.fov.distance(x, y, who.x, who.y) <= 1 and not game.state:unlockTalentCheck(self.unlock_talent_on_disarm.tid, who) then
      local hit, chance = who:checkHit(who:callTalent(who.T_TRAP_MASTERY, "getPower") + who:callTalent(who.T_DEVICE_MASTERY, "trapDisarm")*.25, self.disarm_power)
      local t = who:getTalentFromId(self.unlock_talent_on_disarm.tid)
      if t and hit and chance > 20 and (not self.unlock_talent_on_disarm.chance or rng.percent(self.unlock_talent_on_disarm.chance)) and next(who:spotHostiles()) == nil then
         local diff_level = (t.trap_mastery_level or 5)
         local success, consec, msg = false, 0
         local oldrestCheck = rawget(who, "restCheck") -- hack restCheck to perform action each turn
         who.restCheck = function(player)
            if not player.resting then player.restCheck = oldrestCheck return false, "not resting" end
            if player.resting.cnt >= diff_level then -- start making checks at diff_level turns
               if rng.percent(chance) then
                  consec = consec + 1
               else -- reset success count
                  consec = 0
                  if rng.percent(10) then -- oops! 10% chance to set it off
                     game:onTickEnd(function() self:triggered(player.x, player.y, player) end)
                     msg = "You set off the trap!"
                     return false, msg
            if consec >= diff_level then -- success after diff_level consecutive checks
               msg = "You successfully dismantled the trap."
               success = true return false, msg
            local continue, reason = mod.class.Player.restCheck(player)
            if not continue then msg = "You were interrupted." end
            return continue, reason

         local turns = math.ceil(diff_level*(1 + rng.float(1, 6*(1-chance/200)))) -- random turns to dismantle
         local dismantle = coroutine.create(function(self, who)
            local wait = function()
               local co = coroutine.running()
               who:restInit(turns, "Dismantling", "dismantled", function(cnt, max)
                  -- "resting" finished, undo the restCheck hack and check results
                  who.restCheck = oldrestCheck
                  if not success then
                     if cnt >= max then -- too difficult
                        msg = "Your level of skill was not enough to understand the workings of this trap."
                     else -- interrupted
                        msg = msg or "You quit dismantling the trap."
               game.logPlayer(who, "#LIGHT_BLUE#%s: %s#LAST#", success and "Success" or "Failure", msg)
               return success
            if not wait() then
            game.state:unlockTalent(self.unlock_talent_on_disarm.tid, who)
         local desc = util.getval(self.desc, self)
         desc = desc and "\n#LIGHT_BLUE#Trap Description:#WHITE#\n"..desc or ""
         require "engine.ui.Dialog":yesnoLongPopup(("Disarming a trap: %s"):format(self:getName()),
   ([[As you begin disarming the trap, you think you may be able to learn how it works by carefully dismantling it.  You estimate this will take up to #YELLOW#%d#LAST# uninterrupted turns.
   What do you want to do?
]]):format(turns, desc), math.min(800, game.w*.75),
            if quit == true then
               game:playSoundNear(who, "ambient/town/town_large2")
               coroutine.resume(dismantle, self, who)
         "Dismantle Carefully", "Disarm Normally")

PostPosted: Thu Feb 13, 2020 10:35 pm 

Joined: Thu Feb 13, 2020 10:30 pm
Posts: 2
I ran into this issue yesterday and can't rest or auto explore anymore. How do I resolve this so I can rest or auto explore?

Lua Error: /mod/class/Trap.lua:202: attempt to compare nil with number
At [C]:-1 __le
At /mod/class/Trap.lua:202 restCheck
At /engine/interface/PlayerRest.lua:47 restInit
At /mod/class/Game.lua:2214
At /engine/KeyBind.lua:237

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 7 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group