[Solved] Patch 1.31: 0-indexed & not-0-indexed functions ??

Level 9
Joined
Feb 27, 2019
Messages
298
Hello,

I read that with patch 1.31 normally all "natives" are now 0-indexed. However I have the following trigger that seems to proove it wrong.

The trigger is done to reduce all cooldowns by 20% when a unit carries an given item (In short, everytime a spell is cast, I compare the ability CD, the unit ability CD and the presence of the item, and reduce or restore the unit ability CD if numbers don't match).

When I test it, it seems to reduce the cooldown of the level+1 of the ability... That was unexpected!

Translated in JASS, it seems that:
- function GetUnitAbilityLevelSwapped: ability level is 1-indexed.
- functions BlzGetAbilityCooldown, BlzGetUnitAbilityCooldown, BlzSetUnitAbilityCooldown: ability level is 0-indexed.

Is it normal ?
Does "Natives" only mean "Blz..." functions ?
Or did I miss something in patch 1.31 update & bug logs ?


  • CooldownsReduction
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • -------- Upon each cast, we check if cooldown should be reduced or restored --------
      • Set GlobalTempAbilityCode = (Ability being cast)
      • Set GlobalTempInteger = (Level of GlobalTempAbilityCode for (Triggering unit))
      • Set GlobalTempReal = (Cooldown of GlobalTempAbilityCode, Level: GlobalTempInteger)
      • Set GlobalTempReal1 = (Ability Cooldown of (Triggering unit) for ability GlobalTempAbilityCode, Level: GlobalTempInteger)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item carried by (Triggering unit) of type Gloves of Spell Mastery) Not equal to No item
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GlobalTempReal Equal to GlobalTempReal1
            • Then - Actions
              • -------- Reduce cooldown of 20% --------
              • Game - Display to (All players) the text: Reduce
              • Unit - For Unit (Triggering unit), Set cooldown of ability GlobalTempAbilityCode, Level: GlobalTempInteger to (0.80 x GlobalTempReal)
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • GlobalTempReal Greater than GlobalTempReal1
            • Then - Actions
              • -------- Restore normal cooldown --------
              • Game - Display to (All players) the text: Restore
              • Unit - For Unit (Triggering unit), Set cooldown of ability GlobalTempAbilityCode, Level: GlobalTempInteger to GlobalTempReal
            • Else - Actions
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
I read that with patch 1.31 normally all "natives" are now 0-indexed. However I have the following trigger that seems to proove it wrong.
I think that statement means "all new natives are now 0-indexed" (new means with new 1.29+ stuff), unless I am wrong.
Does "Natives" only mean "Blz..." functions ?
Not exactly, there are two (excluding AI files) main scripting files for jass, common.j and blizzard.j. The ones in common.j file are called native functions, they are just jass wrappers of underlying C functions They are not necessarily start with letters "Blz" (see my next point). In fact almost none of them does not. The functions in blizzard.j are created from native functions + custom jass functions that used for different kinds of stuff (GUI functions, some helper functions for enum stuff, melee initialization scripts etc...) You can find these two files in your game's mpq files.

Or did I miss something in patch 1.31 update & bug logs ?
New developer team seem to using this Blz... convention. I guess since they are new working people on an old game, some function names and conventions might be different than older functions.
 
Top