Page 1 of 1

Golem in wilderness, with possilbe fix

Posted: Tue Dec 07, 2010 4:26 am
by hops
I think this have been reported on the forum: the golem will go to fight in the wilderness, and die.

The following fix assume that the golem is not allowed in the wilderness, as is any actor in game.persistant_actors .

This fix has a draw-back that the golem hitpoint will not regen during wilderness travel.

Code: Select all

diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua
index b29b2ec..6478605 100644
--- a/game/modules/tome/class/Game.lua
+++ b/game/modules/tome/class/Game.lua
@@ -364,7 +364,7 @@ function _M:getStore(def)
 end
 
 function _M:leaveLevel(level, lev, old_lev)
-       self.to_re_add_actors = {}
+       self.to_re_add_actors = self.to_re_add_actors or {}
        if level:hasEntity(self.player) then
                level.exited = level.exited or {}
                if lev > old_lev then
@@ -469,17 +469,19 @@ function _M:changeLevel(lev, zone, keep_old_lev, force_down)
                self.player:move(x, y, true)
        end
        self.player.changed = true
-       if self.to_re_add_actors then for act, _ in pairs(self.to_re_add_actors) do
+       if self.to_re_add_actors and not self.zone.wilderness then for act, _ in pairs(self.to_re_add_actors) do
                local x, y = util.findFreeGrid(self.player.x, self.player.y, 20, true, {[Map.ACTOR]=true})
                if x then act:move(x, y, true) end
        end end
 
        -- Re add entities
        self.level:addEntity(self.player)
-       if self.to_re_add_actors then for act, _ in pairs(self.to_re_add_actors) do
+       if self.to_re_add_actors and not self.zone.wilderness then for act, _ in pairs(self.to_re_add_actors) do
                self.level:addEntity(act)
                act:setTarget(nil)
-       end end
+               end 
+               self.to_re_add_actors = {}
+       end
 
        if self.zone.on_enter then
                self.zone.on_enter(lev, old_lev, zone)

Re: Golem in wilderness, with possilbe fix

Posted: Tue Dec 14, 2010 12:10 am
by darkgod
fixed thanks