• 🏆 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!

GetAbilityMaxLevels

Status
Not open for further replies.
Level 13
Joined
Mar 29, 2012
Messages
530
I used this on my spell to set variables related with ability levels, so I want to share with you cuz I'm still unsure too about things like: is it okay to use this (create a unit) on map initialization? What's the best unit type to use? And is this effective?
JASS:
function GetAbilityMaxLevels takes integer abilCode returns integer
    local integer result
    local unit dummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), 'Naka', 0, 0, 0)
   
    call UnitAddAbility(dummy, abilCode)
    call SetUnitAbilityLevel(dummy, abilCode, 100)
    set result = GetUnitAbilityLevel(dummy, abilCode)
   
    call RemoveUnit(dummy)
    set dummy = null
   
    return result
endfunction
 
I don't think it's reasonable to make this single function a library, need to add more useful functions.
Mostly a system should not have as much functionality as possible, but rather the opposite is better. The thinking to have extra more functionality for the sense of submitting should happen carefully. ;P

In my opinion it's a bit too simple for a submission, not only from JASS-side, but the concept in general. One can also replicate this functionality pretty easy using GUI. Lab seems fine imo, or also maybe here Small Code Snippets.
 
Last edited:
Status
Not open for further replies.
Top