ToME: the Tales of Maj'Eyal
http://forums.te4.org/

[ToME 1.5.10] Wrong enemy units during ambush.
http://forums.te4.org/viewtopic.php?f=42&t=49575
Page 1 of 1

Author:  BugReporter [ Mon Jun 03, 2019 6:34 pm ]
Post subject:  [ToME 1.5.10] Wrong enemy units during ambush.

Short description.
World map patrols may spawn ambushes with enemies from a different patrol.

Actual result.
Ambush map generates with wrong enemy units.

Expected result.
Ambush map generates with correct enemy units.

Steps to reproduce.
A. Human patrols, normal play (see comment).
1. Create a magic character.
2. Find adventurers party and attack them to start ambush.
3. Exit to the World map.
4. Find ziguranth patrol and attack them to start ambush.

B. Human and orc patrols, normal play (see comment)
1. Get to the point where you have portals to travel East->West and West->East.
2. West. Find and attack human (adventurers, ziguranth) patrol. Exit to the World map.
3. Go to Last Hope and use the portal to travel East.
4. East. Find and attack orcs patrol.

C. Human and orc patrols, debug mode (see comment)
1. Create a magic character.
2. Find and attack human patrol. Exit to the World map.
3. Use Ctrl+LMB to get to Far East.
4. Find and attack orcs patrol.

Game version.
1.5.10 for windows from ToME site.

Comment.
I believe A, B and C are the same issue.
Terrain also seems to be affected. Example: sand tiles instead of grass.
This issue disappears after save and load. It also seems to go away after doing several dungeons (needs more testing).
It appears to be related to persistent zones. Changes: file engine/Zone.lua, function _M:init(short_name, dynamic), excluded ambush with 'if' condition. Seems wrong to do this in engine, but I couldn't figure out how to do that in mod.
Code:
function _M:init(short_name, dynamic)
   __zone_store[self] = true

   if _M.persist_last_zones and _M.persist_last_zones[short_name] then
        -- TEST: Exclude ambush to prevent reusing possibly inappropriate
        -- persisted version that may differ from the required version.
        if short_name ~= 'ambush' then
            local zone = _M.persist_last_zones[short_name]
            forceprint("[ZONE] loading from last persistent", short_name, zone)
            _M:removeLastPersistZone(short_name)
            self:replaceWith(zone)
            _M:addLastPersistZone(self)
            return
        end
   end

Maybe it is possible to check what parts of persisted ambush data can be reused and what parts need to be loaded to update the persisted data.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/