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

Skill Damage Based on Hero Damage

Level 7
Joined
Nov 6, 2019
Messages
186
Ok so as we all know you can make skills do damage based on ur Attributes including Bonus

So question is, how do i get Skill to do Damage Based on Heros Damage Including Bonus Damage

So: 20 Base = 180 Bonus Damage would make skill do 200 Damage total not just 20?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
There's no easy solution:
 
Level 7
Joined
Nov 6, 2019
Messages
186
There's no easy solution:
Sadly my map is vJass so that code wouldn't work, Tried to convert to vJass and got error

JASS:
globals
    private constant integer bj_MAX_PLAYERS = 7
    private constant string SYNC_EVENT_NAME = "BonusDamage"
    private timer SyncDamage_Timer = null
    private trigger SyncDamage_Trigger = null
    private integer SyncDamage[bj_MAX_PLAYERS] = {0}
endglobals
function SyncDamage_Action takes nothing returns nothing
    local integer playerIndex = 0
    local player triggerPlayer = null
    local string totalAttack = ""
    local integer colorStartIndex = 0
    local string bonusDamage = ""
    loop
        exitwhen playerIndex >= bj_MAX_PLAYERS
        set triggerPlayer = Player(playerIndex)
        set SyncDamage[triggerPlayer] = tonumber(BlzGetTriggerSyncData())
        if triggerPlayer == GetTriggerPlayer() then
            set totalAttack = BlzFrameGetText(BlzGetFrameByName("InfoPanelIconValue", 0))
            set colorStartIndex = StringFind(totalAttack, "|", 1, true)
            if colorStartIndex > 0 then
                set bonusDamage = SubString(totalAttack, colorStartIndex + 10, -3)
                if SyncDamage[GetLocalPlayer()] == null or SyncDamage[GetLocalPlayer()] != tonumber(bonusDamage) then
                    BlzSendSyncData(SYNC_EVENT_NAME, bonusDamage)
                endif
            else
                if SyncDamage[GetLocalPlayer()] != 0 then
                    BlzSendSyncData(SYNC_EVENT_NAME, "0")
                endif
            endif
        endif
        set playerIndex = playerIndex + 1
    endloop
endfunction
function SyncDamage_TimerAction takes nothing returns nothing
    call SyncDamage_Action()
endfunction
function InitTriggers takes nothing returns nothing
    set SyncDamage_Trigger = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(SyncDamage_Trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(SyncDamage_Trigger, function SyncDamage_Action)
    set SyncDamage_Timer = CreateTimer()
    call TimerStart(SyncDamage_Timer, 0.2, true, function SyncDamage_TimerAction)
endfunction
function InitCustomTriggers takes nothing returns nothing
    call TimerStart(CreateTimer(), 0.0, false, function
        call InitTriggers()
    end)
endfunction
private function Init takes nothing returns nothing
    call InitCustomTriggers()
endfunction
endlibrary
 
Last edited:
Top