• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Are these APIs can't work in 1.31?

Status
Not open for further replies.
Level 3
Joined
Aug 6, 2019
Messages
74
I have tested the following code without any effect, is it a bug?

code:
BlzSetUnitWeaponRealFieldBJ( GetTriggerUnit(), UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, 1, 300 )
BlzSetUnitAttackCooldown( gg_unit_Hamg_0003, 0.50, 1 )
BlzSetUnitWeaponRealFieldBJ( GetTriggerUnit(), UNIT_WEAPON_RF_ATTACK_RANGE, 1, 10000.00 )
 

Attachments

  • 1.31APItest.w3x
    17.5 KB · Views: 12
I have tested the following code without any effect, is it a bug?

code:
BlzSetUnitWeaponRealFieldBJ( GetTriggerUnit(), UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN, 1, 300 )
BlzSetUnitAttackCooldown( gg_unit_Hamg_0003, 0.50, 1 )
BlzSetUnitWeaponRealFieldBJ( GetTriggerUnit(), UNIT_WEAPON_RF_ATTACK_RANGE, 1, 10000.00 )

Carefull, most Blz functions are 0 indexed since 1.31. BlzSetUnitAttackCooldown is in this case for sure:
BlzSetUnitAttackCooldown( ..., ..., 0 ): change attack speed of weapon 1
BlzSetUnitAttackCooldown( ..., ..., 1 ): change attack speed of weapon 2

About the BlzSetUnitWeaponXxxxField I think it's the lotery to know if they work or not.. All weapon integer fields that I tried did not work...
 
Last edited:
Level 3
Joined
Aug 6, 2019
Messages
74
1 or 0, he still doesn't work
Carefull, most Blz functions are 0 indexed. BlzSetUnitAttackCooldown is in this case for sure:
BlzSetUnitAttackCooldown( ..., ..., 0 ): change attack speed of weapon 1
BlzSetUnitAttackCooldown( ..., ..., 1 ): change attack speed of weapon 2

About the BlzSetUnitWeaponXxxxField I think it's the lotery to know if they work or not.. All weapon integer fields that I tried did not work...
 
1 or 0, he still doesn't work

I'm puzzled. With 1.31 I use BlzSetUnitAttackCooldown in 4-5 functions and they all work. Knowing that in 1.30 or lower, the function is 1-indexed, but in 1.31 and newer, it is 0-indexed

For example, the code below increases attack by 15 x LocalTempInteger & attack speed by 2% x LocalTempInteger, and is compatible with both 1.30- and 1.31+.
JASS:
set udg_LocalTempIndex = 0
    loop
        exitwhen udg_LocalTempIndex > 2
        call BlzSetUnitBaseDamage( GetSummonedUnit(), ( BlzGetUnitBaseDamage(GetSummonedUnit(), udg_LocalTempIndex) + ( 15 * udg_LocalTempInteger ) ), udg_LocalTempIndex )
        call BlzSetUnitAttackCooldown( GetSummonedUnit(), ( BlzGetUnitAttackCooldown(GetSummonedUnit(), udg_LocalTempIndex) / ( 1 + ( I2R(udg_LocalTempInteger) * 0.02 ) ) ), udg_LocalTempIndex )
        set udg_LocalTempIndex = udg_LocalTempIndex + 1
    endloop
 
Status
Not open for further replies.
Top