Golem in wilderness, with possilbe fix

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
hops
Halfling
Posts: 111
Joined: Tue Sep 21, 2010 9:05 am

Golem in wilderness, with possilbe fix

#1 Post 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)

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Golem in wilderness, with possilbe fix

#2 Post by darkgod »

fixed thanks
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply