bane_
Howardianism High-Priest
- Joined
- Nov 27, 2013
- Messages
- 1,559
So, I created a table:
And populated it as such:
When I try to access this table, something incredible happens: every 0 turns into a 1.
If I look at the DebugDatabase.db, it is all normal. Funny, though, that when I used TEXT instead of BOOLEAN, it was still being change from 'Weakness' to 'Resistance'.
Here is the Lua snippet used to gather the information:
This is the log:
Database:
It never finds a weakness because the table is being changed by something inside the game itself (I have nothing in my files changing that value).
Ideas?
Code:
CREATE TABLE UnitResistances (
--ID INT PRIMARY KEY NOT NULL
TYPE TEXT NOT NULL,
Resistance BOOLEAN DEFAULT 0,
DamageType TEXT,
Value INT DEFAULT 0
);
And populated it as such:
Code:
INSERT INTO UnitResistances (Type, DamageType, Resistance, Value) VALUES
('UNIT_WBC_CENTAUR', 'Cold', 1, 10),
('UNIT_WBC_CENTAUR', 'Crushing', [COLOR="Red"][B]0[/B][/COLOR], 20),
('UNIT_WBC_CONJURER', 'Fire', 1, 15),
('UNIT_WBC_CONJURER', 'Piercing', [COLOR="red"][B]0[/B][/COLOR], 35);
When I try to access this table, something incredible happens: every 0 turns into a 1.
If I look at the DebugDatabase.db, it is all normal. Funny, though, that when I used TEXT instead of BOOLEAN, it was still being change from 'Weakness' to 'Resistance'.
Here is the Lua snippet used to gather the information:
Code:
local eResDamageType
local iValue
print("[GetDamageInfo] Started...")
if bResistance then
print("[GetDamageInfo] Getting resistance.")
for eUnitRes in GameInfo.UnitResistances("Value > 0") do
iUnitType = GameInfoTypes[eUnitRes.Type]
print("[GetDamageInfo] Iterating resistance.")
print(eUnitRes.Resistance)
if iUnitType == eUnit and eUnitRes.Resistance == 1 then
print("[GetDamageInfo] Found Unit's resistance.")
eResDamageType = eUnitRes.DamageType
iValue = "+" ..eUnitRes.Value
break
end
end
else
print("[GetDamageInfo] Getting weakness.")
for eUnitRes in GameInfo.UnitResistances("Value > 0") do
iUnitType = GameInfoTypes[eUnitRes.Type]
print("[GetDamageInfo] Iterating weakness.")
[COLOR="red"][B]print(eUnitRes.Resistance)[/B][/COLOR]
if iUnitType == eUnit and [COLOR="red"][B]eUnitRes.Resistance == 0 then[/B][/COLOR]
print("[GetDamageInfo] Found unit's weaknes..")
eResDamageType = eUnitRes.DamageType
iValue = "-" ..eUnitRes.Value
break
end
end
end
This is the log:
Code:
[22377.251] UnitPanel: [GetDamageInfo] Started...
[22377.251] UnitPanel: [GetDamageInfo] Getting resistance.
[22377.251] UnitPanel: [GetDamageInfo] Iterating resistance.
[22377.251] UnitPanel: 1
[22377.251] UnitPanel: [GetDamageInfo] Iterating resistance.
[COLOR="Red"][B][22377.251] UnitPanel: 1[/B][/COLOR]
[22377.251] UnitPanel: [GetDamageInfo] Iterating resistance.
[22377.251] UnitPanel: 1
[22377.251] UnitPanel: [GetDamageInfo] Found Unit's resistance.
[22377.251] UnitPanel: [GetDamageInfo] Started...
[22377.251] UnitPanel: [GetDamageInfo] Getting weakness.
[22377.251] UnitPanel: [GetDamageInfo] Iterating weakness.
[22377.251] UnitPanel: 1
[22377.251] UnitPanel: [GetDamageInfo] Iterating weakness.
[COLOR="red"][B][22377.251] UnitPanel: 1[/B][/COLOR]
[22377.251] UnitPanel: [GetDamageInfo] Iterating weakness.
[22377.251] UnitPanel: 1
[22377.251] UnitPanel: [GetDamageInfo] Iterating weakness.
[COLOR="red"][B][22377.251] UnitPanel: 1[/B][/COLOR]
Database:
Spoiler :
It never finds a weakness because the table is being changed by something inside the game itself (I have nothing in my files changing that value).
Ideas?