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

A way to amplify ability damage without damage engine, with blz natives

Status
Not open for further replies.
Level 3
Joined
Oct 9, 2012
Messages
28
require recent patch. I tested following code on 1.31.1
the idea is to dynamically modify ability field when some spell ordered, using BlzSetAbilityXXXLevelField functions. Don't know if someone posted it before.

Code:
private function ordered takes nothing returns boolean
        local ability ab
        if GetIssuedOrderId() == OrderId("fanofknives") then
            call BJDebugMsg("ordered, level: " + I2S(GetUnitAbilityLevel(GetOrderedUnit(), 'AEfk')))
            set ab = BlzGetUnitAbility(GetOrderedUnit(), 'AEfk')
            call BlzSetAbilityRealLevelField(ab, ABILITY_RLF_DAMAGE_PER_TARGET_EFK1, GetUnitAbilityLevel(GetOrderedUnit(), 'AEfk') - 1, 100.0 * GetHeroAgi(GetOrderedUnit(), true))
        endif
        set ab = null
        return false
    endfunction

private function init takes nothing returns nothing
        call RegisterAnyPlayerUnitEvent(EVENT_PLAYER_UNIT_ISSUED_ORDER, function ordered)
endfunction

edit: use
EVENT_PLAYER_UNIT_SPELL_* events instead of EVENT_PLAYER_UNIT_ISSUED_ORDER should also works
 
Last edited:
Level 3
Joined
Oct 9, 2012
Messages
28
There is now a native ‘any unit damaged’ event so really a damage engine is mostly unnecessary anyway. You could achieve this functionality just using that new event without having to modify spell fields.
yes. And there's a tiny difference though: my method respect the max damage field of the ability.
 
Level 3
Joined
Oct 9, 2012
Messages
28
Does it work? Since if BlzSetAbilityRealLevelField returns false it means the setting failed and it seems to do that for a lot of fields.

the code in my post is cut from a working example. I also tested change the missing chance of Demon Hunter's evade ability, it works too. Not sure about other abilities.
 
For passive abilities changes are often not applied, one can refresh such an ability by increasing and decreasing that abilities level (does not work for some abilities although, if they are 1 level only).

After doing that the ability uses the changed values (tested for devotion aura, ATK damage, attack speed, armor, attribute boni Hero version, Move Speed by Boots).
 
Status
Not open for further replies.
Top