PTR 1.33 - Broken BlzSetXXXField natives

It could be the cause of the random disconnects/crashes that happen in all gamemodes, no way to know unless the devs look into it

There’s a semi-working native system used to directly edit parameter(s) of various things, the problem with it is that:

  1. some work perfectly
  2. some require using workarounds to work
  3. some crash the game (right after being used)
  4. most do nothing (some of these end up crashing the game but not instantly after being used)
  5. some can do any of the above depending on the circumstances

Here’s the natives in question (i replaced the types by XXXX cause there’s too many):

BlzSetAbilityXXXXXField
BlzSetAbilityXXXXXLevelField
BlzSetUnitXXXXXField
BlzSetUnitWeaponXXXXXField
BlzSetItemXXXXXField

I’ll only talk about the ones that don’t work perfectly, the whole system is unstable and unfinished so be extra careful when messing with these.

////////////////////////////////////////////////////////////////////////////////////////////////
Nothing happen when using the natives below
////////////////////////////////////////////////////////////////////////////////////////////////

    • Change a unit’s primary attribute into Strength(0)/Agility(1)/Intelligence(2) (for exemple: change an intelligence hero into a strength hero) (trying to change the unit’s primary attribute (main stat) into intelligence)
    • call BlzSetUnitIntegerField( unit,UNIT_IF_PRIMARY_ATTRIBUTE,2)

    • changes ability’s missile sfx (how the spell’s bullet looks) (trying to change Storm Bolt’s missile sfx into the Death Coil’s missile sfx)

    • call BlzSetAbilityStringLevelField( BlzGetUnitAbility(unit,'ANsb '), ‘amat’, 0, “Abilities\Spells\Undead\DeathCoil\DeathCoilMissile.mdl” )

    • changes ability’s target sfx (this sfx appears on the target when it gets hit by the ability) (trying to change Storm Bolt’s target sfx to the Death Coil’s target sfx)

    • call BlzSetAbilityStringLevelField( BlzGetUnitAbility(unit,‘ANsb’), ‘asat’, 0, “Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl” )

    • changes ability’s caster sfx (the special effect on caster when using the ability) (trying to change Storm Bolt’s caster sfx to the Death Pact’s caster sfx)

    • call BlzSetAbilityStringLevelField( BlzGetUnitAbility(unit,‘ANsb’), ‘acat’, 0, “Abilities\Spells\Undead\DeathPact\DeathPactCaster.mdl” )

    • changes ability’s attachement sfx (trying to change Endurance Aura’s sfx into the Vampiric Aura sfx)

    • call BlzSetAbilityStringLevelField( BlzGetUnitAbility(unit,‘AOae’), ‘atat’, 0, “Abilities\Spells\Undead\VampiricAura\VampiricAura.mdl” )

    • changes the “Call to Arms” ability’s transformation (trying to change it to a footman so that peasants turn into footmen instead of miltia when using the ability near a townhall)

    • call BlzSetAbilityStringLevelFieldBJ( BlzGetUnitAbility(u2u, ‘Amil’), ABILITY_SLF_ALTERNATE_FORM_UNIT_MIL2, 0, “hfoo” )

    • set unit’s list of buildable buildings

    • call BlzSetUnitStringField(unit,ConvertUnitStringField(‘ubui’),“htow,hhou,hbar,hbla,hwtw,halt,harm,hars,hlum,hgra,hvlt”)

    • change autoattack type (trying to change it to “bounce” that way it can take the “bounce amount” & “bounce/splash aoe” parameters into account)

    • call BlzSetUnitWeaponIntegerField(unit,UNIT_WEAPON_IF_ATTACK_MAXIMUM_NUMBER_OF_TARGETS,2,5)

    • call BlzSetUnitWeaponIntegerField(unit,ConvertUnitWeaponIntegerField(‘ua1w’),0,6)

    • call BlzSetUnitWeaponIntegerField(unit,ConvertUnitWeaponIntegerField(‘ua1w’),1,6)

    • call BlzSetUnitWeaponIntegerField(unit,ConvertUnitWeaponIntegerField(‘ua1w’),2,6)

    • call BlzSetUnitWeaponStringField(unit,ConvertUnitWeaponStringField(‘ua1w’),0,“mbounce”)

    • call BlzSetUnitWeaponStringField(unit,ConvertUnitWeaponStringField(‘ua1w’),1,“mbounce”)

    • call BlzSetUnitWeaponStringField(unit,ConvertUnitWeaponStringField(‘ua1w’),2,“mbounce”)

    • Change unit’s move type (here we’re trying to set it to fly which would allow a walking unit like a footman to fly over terrain)
    • call BlzSetUnitMovementType( unit,2 )

    • call BlzSetUnitIntegerField( unit,ConvertUnitIntegerField(‘umvt’), 2 )

    • call BlzSetUnitIntegerField( unit,UNIT_IF_MOVE_TYPE, 2 )

    • call BlzSetUnitStringField( unit,ConvertUnitStringField(‘umvt’), “fly” )

    • change attack type (can change it to bounce (like huntress), to instant (like riflemen) etc
    • call BlzSetUnitWeaponIntegerField(unit,UNIT_WEAPON_IF_ATTACK_ATTACK_TYPE, 0, 3 )

    • call BlzSetUnitWeaponIntegerField(unit,UNIT_WEAPON_IF_ATTACK_ATTACK_TYPE, 1, 3 )

    • call BlzSetUnitWeaponIntegerField(unit,UNIT_WEAPON_IF_ATTACK_ATTACK_TYPE, 2, 3 )

    • change allowed targets affected by autoattack’s bounce/splash effect (either nothing happens when using it on a unit with the right autoattack type or crashes if the unit’s autoattack type doesn’t support this (it has to be splash or bounce)
    • call BlzSetUnitWeaponIntegerField(unit,UNIT_WEAPON_IF_ATTACK_AREA_OF_EFFECT_TARGETS, 0, 1000 )

    • call BlzSetUnitWeaponIntegerField(unit,UNIT_WEAPON_IF_ATTACK_AREA_OF_EFFECT_TARGETS, 1, 1000 )

    • call BlzSetUnitWeaponIntegerField(unit,UNIT_WEAPON_IF_ATTACK_AREA_OF_EFFECT_TARGETS, 2, 1000 )

    • change unit’s ranged autoattack projectile’s sfx (here we’re trying to give it invisible projectile)
    • call BlzSetUnitWeaponStringField(unit,UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, 0,“” )

    • call BlzSetUnitWeaponStringField(unit,UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, 1,“” )

    • call BlzSetUnitWeaponStringField(unit,UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART, 2,“” )

    • Hide/Show a unit’s tiny dot on the minimap

    • supposed to hide (remove) the unit’s tiny dot from minimap (like phantom assassin’s passive in dota 1, set it to false to show it)

    • call BlzSetUnitBooleanFieldBJ( unit,UNIT_BF_HIDE_MINIMAP_DISPLAY, true )

    • the native below is similar to the one above and works perfectly, i’ll leave it here for reference (it only affects heroes’ big dot on the minimap, removing it leaves them with a tiny dot which can only be removed by the non-working native above)

    • call BlzSetUnitBooleanFieldBJ( unit,UNIT_BF_HERO_HIDE_HERO_MINIMAP_DISPLAY, true )

    • changes the AIf2 (orb of fire) ability’s dmg bonus (trying to set it to 0)

    • call BlzSetAbilityRealLevelFieldBJ( BlzGetUnitAbility(unit,‘AIf2’), ABILITY_RLF_DAMAGE_BONUS_IDAM, 0, 0 )

    • changes the AIf2 (orb of fire) ability’s orb sfx (special effect) (trying to disable it)

    • call BlzSetAbilityIntegerLevelFieldBJ( BlzGetUnitAbility(unit,‘AIf2’), ABILITY_ILF_ENABLED_ATTACK_INDEX_IOB5, 0, 0 )

////////////////////////////////////////////////////////////////////////////////////////////////
Using the natives below requires additional steps to apply their effects otherwise it won’t have any effect
////////////////////////////////////////////////////////////////////////////////////////////////

    • change a building’s surrounding area’s texture (changes dont take effect until the unit uses root/uproot, that’s the treants’ ability that allows them to detach/plant themselves to the ground)

    • (here we’re trying to remove the texture by setting it to blank)

    • call BlzSetUnitStringField(unit,UNIT_SF_GROUND_TEXTURE, “” )

    • changes unit’s shadow (here we’re trying to remove the shadow by setting it to blank)

    • call BlzSetUnitStringField(unit,UNIT_SF_SHADOW_IMAGE_unit,“” )

  • one of the following steps are required in order to apply the changes made by this native:
    • -casting polymorph or hex on the unit
    • -the unit uses any kind of metamorphosis ability (demon hunter ult, bear & crow transformation…
    • -the unit turns into militia by using the peasant’s Call to Arms
    • -die and revive or get resurrected by paladin
    • Change a unit’s casting delay before using a spell and maybe IRC it also affects all of the unit’s animations speed
    • call BlzSetUnitRealField(unit,UNIT_RF_CAST_POINT,0)

    • call BlzSetUnitRealField(unit,UNIT_RF_CAST_BACK_SWING,0)

    • for changes made by these natives to take effect you must spend your FIRST starting skillpoint ever AFTER using this native because if you spend your 1st skillpoint then make use the native it wont have any effect

////////////////////////////////////////////////////////////////////////////////////////////////
Crashes the game when used under certain condition
////////////////////////////////////////////////////////////////////////////////////////////////

    • Changes the unit’s inventory ability’s “can unit use items?” parameter (there’s multiple inventory abilities but AInv is the main one)

    • //unit can use items
      call BlzSetAbilityIntegerLevelField( BlzGetUnitAbility(unit,‘AInv’), ConvertAbilityIntegerLevelField(‘inv3’), 0, 1)

    • //unit can’t use items
      call BlzSetAbilityIntegerLevelField( BlzGetUnitAbility(unit,‘AInv’), ConvertAbilityIntegerLevelField(‘inv3’), 0, 0)

    • the natives below are supposed to be the standard way to do this but using them crashes the game, the method used above is a workaround.

    • //unit can use items
      call BlzSetAbilityBooleanLevelField( BlzGetUnitAbility(unit,‘AInv’), ABILITY_BLF_CAN_USE_ITEMS, 0, true)

    • //unit can’t use items
      call BlzSetAbilityBooleanLevelField( BlzGetUnitAbility(unit,‘AInv’), ABILITY_BLF_CAN_USE_ITEMS, 0, false)

    • Using the BlzSetAbilityBooleanLevelField native to do this crashes the game, it’s unfortunate since this is the standard way to do it

    • The workaround is this: use BlzSetAbilityIntegerLevelField instead of BlzSetAbilityBooleanLevelField and use ConvertAbilityIntegerLevelField instead of ConvertAbilityBooleanLevelField and use 1 and 0 instead of true and false)

  • the following inventory ability parameters have the same problem:
    • inv3 (can unit use items?)
    • inv4 (can unit pick items?)
    • inv5 (can unit drop/move its items?)
    • inv2 (does unit automatically drop all its items on death?)
    • The game crashes if you use the following natives on units who don’t have the appropriate autoattack type but it works on units with the right autoattack type

      • Change how much times the unit’s bouncing autoattack will bounce (bug: setting a lower value for this doesnt work, can only set a higher value than current one) (for exemple the huntress’ autoattack will bounce off of 10 enemies)

      • call BlzSetUnitWeaponIntegerField(unit,UNIT_WEAPON_IF_ATTACK_MAXIMUM_NUMBER_OF_TARGETS,0,10)

      • change aoe for unit’s autoattack’s bounce/splash (for exemple the huntress’ autoattack will bounce off of any enemy within a 999 radius of the attacked target)

      • call BlzSetUnitWeaponIntegerField(unit,ConvertUnitWeaponIntegerField(‘ua1f’),0,999)
        call BlzSetUnitWeaponIntegerField(unit,ConvertUnitWeaponIntegerField(‘ua1f’),1,999)
        call BlzSetUnitWeaponIntegerField(unit,ConvertUnitWeaponIntegerField(‘ua1f’),2,999)

7 Likes

ABILITY_ILF_ALTERNATE_FORM_UNIT_EMEU and ABILITY_SLF_NORMAL_FORM_UNIT_EME1 do not work and the later is a string field for some reason which doesn’t make sense if its meant to be a counterpart to the former.

These are meant to the change the unit type for all the transformation abilities such as bear form, chaos, and metamorphosis.

ABILITY_IF_BUTTON_POSITION_NORMAL_Y and X do not work.

ABILITY_SLF_CASTER and _EFFECT does not work. _TARGET works
These are fields to changing the models used for effects on abilities.

when using ABILITY_RLF_CASTING_DELAY_SECONDS on channel, it reverts its target type back to its default type that is used in the editor.

1 Like

Well done, this is the kind of bug that can go unnoticed and plague the game for decades.

i skimmed it, maybe i will read more later, but… how does it affect melee?

What kind of reply is that, this is very disrespectful, read all of it and you’ll get your answer.

3 Likes

i read it all now but i didnt find the answer. This seems like a long list of broken functions, but none of those functions are used in melee games.

So, how does this even affect melee at all?

bumping this because it’s all still broken

1 Like

It would be nice to see especially the ability fields get fixed, so enchanting systems for items/abilities will work. The number of summoned units worked for me but many bonus fields do not work.

Also fields like gold and lumber costs and icon positions and hotkeys (not sure if this already exists) should be changable, so you can move abilities to different slots.