- Joined
- May 9, 2014
- Messages
- 1,820
The thread specifically addresses which object data related constants cannot be modified, work, or are problematic in some cases in the most recent patches (Not including the World Editor). This is a list in progress, so it may not yet include all the dysfunctional constants.
Legend:
elements in nonFunctional tables -> Do not work, but do not crash the game.
elements in problematic tables -> Do work, but will crash at certain values.
If you want to test things out, you can use the following script (scripting language must be in Lua):
State: WIP
- (8/17/19) - Thread post
- (8/17/19) - Added UNIT_IF_HIT_POINTS_REGENERATION_TYPE
Legend:
elements in nonFunctional tables -> Do not work, but do not crash the game.
elements in problematic tables -> Do work, but will crash at certain values.
Lua:
nonFunctional = {
ABILITY_SF_NAME
}
Lua:
problematic = {
UNIT_IF_DEFENSE_TYPE, -- Suspected that values exceeding 7 will not behave as intended
-- Values 8 - 15 are just translated up by 8 (hides the armor icon)
-- Values 16 - 23 hide information (translated up)
-- Values 24, 26 display attribute icons (don't know why that happens).
-- Values including 25 and exceeding 26 will crash the game (most likely).
UNIT_IF_INTELLIGENCE_PERMANENT,
UNIT_IF_AGILITY_PERMANENT,
UNIT_IF_STRENGTH_PERMANENT
-- They do not return the updated values when set via
-- BlzSetUnitIntegerField. (Only returns 1).
}
nonfunctional = {
UNIT_IF_INTELLIGENCE_WITH_BONUS,
UNIT_IF_AGILITY_WITH_BONUS,
UNIT_IF_STRENGTH_WITH_BONUS,
UNIT_IF_PRIMARY_ATTRIBUTE,
UNIT_IF_HIT_POINTS_REGENERATION_TYPE
-- Even if the result is successful, this does not actually change
-- the regeneration type.
}
Lua:
nonFunctional = {
UNIT_RF_TURN_RATE,
UNIT_RF_MANA,
UNIT_RF_MAXIMUM_PITCH_ANGLE_DEGREES,
UNIT_RF_MAXIMUM_ROLL_ANGLE_DEGREES,
UNIT_RF_SHADOW_IMAGE_WIDTH
UNIT_RF_FLY_HEIGHT
UNIT_RF_SHADOW_IMAGE_HEIGHT
UNIT_RF_SPEED
-- Some of these may update in game time (They do not immediately
return the assigned value from the setter, though this is mostly speculation).
}
Lua:
problematic = {
UNIT_SF_NAME -- Do not pass "" as a parameter (crashes the game)
-- Appears to modify proper name as well.
}
Lua:
nonFunctional = {
UNIT_WEAPON_IF_ATTACK_DAMAGE_NUMBER_OF_DICE
UNIT_WEAPON_IF_ATTACK_MAXIMUM_NUMBER_OF_TARGETS
UNIT_WEAPON_IF_ATTACK_ATTACK_TYPE
UNIT_WEAPON_IF_ATTACK_AREA_OF_EFFECT_TARGETS[/FONT]
UNIT_WEAPON_IF_ATTACK_DAMAGE_BASE
UNIT_WEAPON_IF_ATTACK_DAMAGE_SIDES_PER_DIE
UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED
UNIT_WEAPON_IF_ATTACK_WEAPON_SOUND
-- Virtually all fields do not work
}
Lua:
nonfunctional = {
-- Virtually all fields do not work in wc3 1.31
}
Lua:
nonfunctional = {
-- Virtually all fields do not work in 1.31
}
functional = {
UNIT_WEAPON_BF_ATTACKS_ENABLED -- Doesn't work as stated beforehand, but works on Reforged. Credit to J2Krauser for this finding.
}
Lua:
nonfunctional = {
UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART
-- Cannot be modified for melee units.
-- Does not appear to change the model even when
-- applied.
}
If you want to test things out, you can use the following script (scripting language must be in Lua):
Lua:
ObjectEditorTypes = {
-- Ability-related fields.
IF = {exclude=true},
RF = {exclude=true},
SF = {exclude=true},
BF = {exclude=true},
ILF = {exclude=true},
RLF = {exclude=true},
SLF = {exclude=true},
BLF = {exclude=true},
-- Unit-related fields.
UIF = {exclude=false},
URF = {exclude=true},
USF = {exclude=true},
UBF = {exclude=true},
UWIF = {exclude=true},
UWRF = {exclude=true},
UWSF = {exclude=true},
UWBF = {exclude=true},
}
ObjectEditorTypes.initialized = false
ObjectEditorTypes.doManipulate = true
ObjectEditorTypes.breakpoint = nil
ObjectEditorTypes.abilityIndex = 3
function OnSelect(u)
if not ObjectEditorTypes.initialized then
for k, v in pairs(_G) do
if k:sub(1, 7) == 'ABILITY' then
local j = 9
local i = j
while true do
if k:sub(j, j) == '_' then break end
j = j + 1
end
local str = k:sub(i, j-1)
if not ObjectEditorTypes[str].exclude then ObjectEditorTypes[str][k] = v end
elseif k:sub(1, 4) == 'UNIT' then
local usub = k:sub(6, 7)
if usub == 'IF' or usub == 'RF' or usub == 'BF' or usub == 'SF' then
usub = 'U' .. usub
if not ObjectEditorTypes[usub].exclude then ObjectEditorTypes[usub][k] = v end
else
usub = k:sub(6, 11)
if usub == 'WEAPON' then
usub = k:sub(13, 14)
if usub == 'IF' or usub == 'RF' or usub == 'BF' or usub == 'SF' then
usub = 'UW' .. usub
if not ObjectEditorTypes[usub].exclude then ObjectEditorTypes[usub][k] = v end
end
end
end
end
end
ObjectEditorTypes.initialized = true
end
local abil = BlzGetUnitAbilityByIndex(u, ObjectEditorTypes.abilityIndex)
if abil == nil then
print('|cffffcc00Error:|r Ability index is nil.')
return
end
local metaFactory = function(param)
local f = function(str, strname, setter, getter, ...)
if ObjectEditorTypes[str].exclude then return end
local i = 1
local params = table.pack(...)
local paramcount = #params
local lastparam = params[paramcount]
local strs = ""
table.remove(params, n)
for k1, v1 in pairs(ObjectEditorTypes[str]) do
if ObjectEditorTypes.breakpoint ~= nil and i > ObjectEditorTypes.breakpoint then break end
if k1 ~= 'exclude' then
if not ObjectEditorTypes.doManipulate then
print(strname .. ': Parameter [' .. tostring(i) .. '] ' .. tostring(k1) .. ' being read.')
else
local result = pcall(setter, param, v1, ...)
table.remove(params, paramcount)
local success, presult = pcall(getter, param, v1, table.unpack(params))
result = result and (presult == lastparam)
if not result then
print('|cffff2020' .. strname .. ':|r Parameter [' .. tostring(i) .. '] ' .. tostring(k1) .. ' cannot be modified.')
print('Expected: ' .. tostring(lastparam) .. '; Observed: ' .. tostring(presult))
else
print(strname .. ': Parameter [' .. tostring(i) .. '] ' .. tostring(k1) .. ' was successfully modified.')
end
end
else
i = i - 1
end
i = i + 1
end
end
return f
end
local abilFactory = metaFactory(abil)
local unitFactory = metaFactory(u)
abilFactory('IF', 'AbilityIntegerField', BlzSetAbilityIntegerField, BlzGetAbilityIntegerField, 0)
abilFactory('RF', 'AbilityRealField', BlzSetAbilityRealField, BlzGetAbilityRealField, 0.)
abilFactory('SF', 'AbilityStringField', BlzSetAbilityStringField, BlzGetAbilityStringField, "")
abilFactory('BF', 'AbilityBooleanField', BlzSetAbilityBooleanField, BlzGetAbilityBooleanField, false)
abilFactory('ILF', 'AbilityIntegerLevelField', BlzSetAbilityIntegerLevelField, BlzGetAbilityIntegerLevelField, 0, 0)
abilFactory('RLF', 'AbilityRealLevelField', BlzSetAbilityRealLevelField, BlzGetAbilityRealLevelField, 0, 0.)
abilFactory('SLF', 'AbilityStringLevelField', BlzSetAbilityStringLevelField, BlzGetAbilityStringLevelField, 0, "")
abilFactory('BLF', 'AbilityBooleanLevelField', BlzSetAbilityBooleanLevelField, BlzGetAbilityBooleanLevelField, 0, false)
unitFactory('UIF', 'UnitIntegerField', BlzSetUnitIntegerField, BlzGetUnitIntegerField, 6)
unitFactory('URF', 'UnitRealField', BlzSetUnitRealField, BlzGetUnitRealField, 750.)
unitFactory('USF', 'UnitStringField', BlzSetUnitStringField, BlzGetUnitStringField, "Horse")
unitFactory('UBF', 'UnitBooleanField', BlzSetUnitBooleanField, BlzGetUnitBooleanField, true)
unitFactory('UWIF', 'UnitWeaponIntegerField', BlzSetUnitWeaponIntegerField, BlzGetUnitWeaponIntegerField, 0, 500)
unitFactory('UWRF', 'UnitWeaponRealField', BlzSetUnitWeaponRealField, BlzGetUnitWeaponRealField, 0, 750.)
unitFactory('UWSF', 'UnitWeaponStringField', BlzSetUnitWeaponStringField, BlzGetUnitWeaponStringField, 0, "")
unitFactory('UWBF', 'UnitWeaponBooleanField', BlzSetUnitWeaponBooleanField, BlzGetUnitWeaponBooleanField, 0, true)
end
State: WIP
Attachments
Last edited: