-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confirm and add UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED #129
Comments
I double checked it, the list is almost complete: "NONE" is missing from table above = value 1 I've done some more testing with NONE and TERRAIN. "NONE" seems to be a legit target flag, if its ON (i've only tested it alone) then the unit will not have an attack nor an attack icon. However all UI order buttons will be present. Except when you click a target unit (frost arrow with NONE) then your unit will just "attack move" to that position (actually just move) With only "TERRAIN" enabled I think the game resets it to default from above. Everything works. I am not sure if TERRAIN is supposed to be there or do anything special. I thought they had just swapped terrain & none. Here's one old post asking about terrain not working, no further explanation: https://www.hiveworkshop.com/threads/help-can-cold-arrows-target-terrain.217982/
--[[
unitweaponintegerfield UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED
native BlzGetUnitWeaponIntegerField takes unit whichUnit, unitweaponintegerfield whichField, integer index returns integer
native BlzSetUnitWeaponIntegerField takes unit whichUnit, unitweaponintegerfield whichField, integer index, integer value returns boolean
]]
function printUnitAttacks(unitType)
local u = CreateUnit(Player(0), FourCC(unitType), -30, 0, 90)
local wpn0 = BlzGetUnitWeaponIntegerField(u, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 0)
local wpn1 = BlzGetUnitWeaponIntegerField(u, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 1)
local wpn2 = BlzGetUnitWeaponIntegerField(u, UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED, 2)
print(string.format("%4s: %14d %14d %6d", unitType, wpn0, wpn1, wpn2))
RemoveUnit(u)
end
print("unitType | idx0, idx1, idx2 (if buggy)")
unitRawcodes = {
"h000","h001",
"h002","h003",
"h004","h005",
"h006","h007",
"h008","h009",
"h00A","h00B",
"h00C","h00D",
"h00E","h00F",
}
for _, rawcode in ipairs(unitRawcodes) do
printUnitAttacks(rawcode)
end I don't know if either TERRAIN/NONE have some special behavior when used with other natives or orders. If anyone has any ideas, feel free. I will attach the map with units having one target type per attack and the tests with none/terrain. It will save you some time setting it up. |
See lep#129 for discussion
By Arxos in Hive Discord
The text was updated successfully, but these errors were encountered: