• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[JASS] [SOLVED] Setting the integer field of Gloves of Haste attack speed

Status
Not open for further replies.
Level 6
Joined
Mar 9, 2023
Messages
72
Hello!

In one of my abilities, I want to give the hero a scaling attack speed bonus. This is via adding a variant of the gloves of speed ability, then manipulating its integer field. However, it's constantly 0. If I change the field in the object editor of course it increases. Been double-checking with the debug.

Here's the gist of it:
JASS:
local unit u = GetTriggerUnit()
local integer abilityId = 'A0CE' //my ability
local integer as = R2I(GetUnitState(u,UNIT_STATE_MAX_MANA)*0.05) //It can be any value, still doesn't work
local ability a
call UnitAddAbility(u, abilityId)
set a = BlzGetUnitAbility(u, abilityId)

call IncUnitAbilityLevelSwapped( abilityId, u )
call BlzSetAbilityIntegerLevelField(a, ConvertAbilityIntegerLevelField('Isx1'), 0, as)
call DecUnitAbilityLevelSwapped( abilityId, u )

It correctly sets the variables, adds the ability, correctly increases and decreases the ability. However, the integer field just doesn't get changed. It's always the same as the object editor.
Later on, I remove the ability and clean up, but that's not a concern. Help is appreciated!

Edit:

Solved! Here is the updated version:
JASS:
local unit u = GetTriggerUnit()
local integer abilityId = 'A0CE'
local real as = GetUnitState(u, UNIT_STATE_MAX_MANA) * 0.05
local ability a

call UnitAddAbility(u, abilityId)
set a = BlzGetUnitAbility(u, abilityId)

call IncUnitAbilityLevelSwapped(abilityId, u)
call BlzSetAbilityRealLevelField(a, ABILITY_RLF_ATTACK_SPEED_INCREASE_ISX1, 0, as)
call DecUnitAbilityLevelSwapped(abilityId, u)

///Clean up and removal
 
Last edited:
Unless I'm mistaken, it should be a real field, not integer

1721483810479.png
 
Status
Not open for further replies.
Back
Top