• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Skill Damage Based on Hero Damage

Status
Not open for further replies.
Level 7
Joined
Nov 6, 2019
Messages
212
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?
 
There's no easy solution:
 
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:
Status
Not open for further replies.
Back
Top