Page 1 of 1
[b43] Armour training glitch gives permanent stats.
Posted: Mon Nov 26, 2012 5:25 pm
by Tyren
Step 1: Level Armour Training up to 4 so you can unlearn it. Have some unassigned points left. Accept changes.
Step 2: Wear heavy armor.
Step 3: Unlearn Armour Training, the armor piece falls off. Close the level-up screen. Don't accept changes. (Click No).
Unequip the armor. You now have permanent armor stats.
Looks like it's the same bug here
http://forums.te4.org/viewtopic.php?f=4 ... e#p137963.
Re: [b43] Armour training glitch gives permanent stats.
Posted: Tue Nov 27, 2012 5:45 am
by aardvark
It's because the temporary value ID is stored in the item's object rather than the actor's. When equipping items, the Object's wielder field's bonuses are applied to the Player using the addTemporaryValue() function and the temporary value info is stored in the Object's object.
Later, when entering the levelup dialog, a recursive copy of the Player object's table is made excepting the subtables that are also T-Engine classes. Changes on the levelup dialog are applied to the live Player as they're made. When declining the changes, the live Player is discarded and the copy is substituted.
So, the problem: when removing points from Armour Training, it removes the armor from the player. That removes the temporary values from the Player object and the values stored in the uncopied armor. When we cancel the levelup, the Player copy that still has the temporary values applied is substituted but the uncopied, de-temporaried armor is still what it has in its inventory slot. Subsequent removal of the armor doesn't remove the temporary values from Player because it already has, in another life.
It's the Golemancy bug all over again. The only real fix is to change the levelup dialog to defer the changes to Player until the player finalizes them. It shouldn't be that hard to mock up the changes and apply them wholesale when they're confirmed. It would have the extra benefit of removing a bunch of memory copying and should make the dialog more responsive.
Re: [b43] Armour training glitch gives permanent stats.
Posted: Thu Dec 06, 2012 12:10 pm
by darkgod
fixed
Re: [b43] Armour training glitch gives permanent stats.
Posted: Sun Dec 09, 2012 11:45 pm
by aardvark
Here's a patch that fixes the temporary values bug while allowing players to unlearn
Armour Training:
Code: Select all
Index: game/modules/tome/dialogs/LevelupDialog.lua
===================================================================
--- game/modules/tome/dialogs/LevelupDialog.lua (revision 6027)
+++ game/modules/tome/dialogs/LevelupDialog.lua (working copy)
@@ -34,6 +34,15 @@
local function backup(original)
local bak = original:clone()
bak.uid = original.uid -- Yes ...
+ -- Copy worn items as well
+ for id, inven in pairs(bak.inven) do
+ if inven.worn then
+ for i, item in ipairs(inven) do
+ inven[i] = item:clone()
+ inven[i].uid = item.uid
+ end
+ end
+ end
return bak
end
Index: game/modules/tome/data/talents/techniques/combat-training.lua
===================================================================
--- game/modules/tome/data/talents/techniques/combat-training.lua (revision 6027)
+++ game/modules/tome/data/talents/techniques/combat-training.lua (working copy)
@@ -41,7 +41,6 @@
name = "Armour Training",
type = {"technique/combat-training", 1},
mode = "passive",
- no_unlearn_last = true,
points = 5,
require = {stat = {str = function(level) return 16 + (level + 2) * (level - 1) end}},
on_unlearn = function(self, t)
Since it's the Golemancy bug, the Golemancy fix does the trick!