Hey, I would appreciate any kind of help
I have a hero unit that can spawn a summoned hero unit, this summoned unit has exp gain disabled, but they still share exp on creep kills even though the summoned unit cant level up.
So I am trying to make it so if the Hero unit Babidi(udg_unit34) is within 1200 range of the dying creep and Hero unit Babidi(udg_unit34) is within 1200 range of The summoned hero unit Dabura then give udg_unit34 half the xp on top of what he alrdy gets. since the share reduction is 50%.
Hero XP Gained - Normal, Constant factor: 5
Hero XP Gained - Normal, Level factor: 5
Hero XP Gained - Normal, Previous value factor: 1
Hero XP Gained - Normal, Table: 25
Experience gained = "Previous value" * "Previous value factor" + "Level" * "Level factor" + "Constant factor"
The map runs on 400%, so giving udg_unit34 the other half I just multiply it by 2x or 0.5(I havent tested if the exp bonus applies already or not)
I am trying to accomplish this with the help of an array and im kinda lost, I also dont know how I apply the previous value, that goes up 25,40,60,85 etc
The leaderboard has nothing to do with the exp thing, I just do it here since it already keeps tracks of Babidi and his summoned units kills(he has a scoreboard for creep kill count)
My global variable
I have a hero unit that can spawn a summoned hero unit, this summoned unit has exp gain disabled, but they still share exp on creep kills even though the summoned unit cant level up.
So I am trying to make it so if the Hero unit Babidi(udg_unit34) is within 1200 range of the dying creep and Hero unit Babidi(udg_unit34) is within 1200 range of The summoned hero unit Dabura then give udg_unit34 half the xp on top of what he alrdy gets. since the share reduction is 50%.
Hero XP Gained - Normal, Constant factor: 5
Hero XP Gained - Normal, Level factor: 5
Hero XP Gained - Normal, Previous value factor: 1
Hero XP Gained - Normal, Table: 25
Experience gained = "Previous value" * "Previous value factor" + "Level" * "Level factor" + "Constant factor"
The map runs on 400%, so giving udg_unit34 the other half I just multiply it by 2x or 0.5(I havent tested if the exp bonus applies already or not)
I am trying to accomplish this with the help of an array and im kinda lost, I also dont know how I apply the previous value, that goes up 25,40,60,85 etc
The leaderboard has nothing to do with the exp thing, I just do it here since it already keeps tracks of Babidi and his summoned units kills(he has a scoreboard for creep kill count)
My global variable
JASS:
integer array experienceGained
JASS:
function Trig_Update_Collect_Babidi_Conditions takes nothing returns boolean
return((GetOwningPlayer(GetKillingUnit())==Player(7)))and((GetOwningPlayer(GetDyingUnit())==Player(12)))
endfunction
function Trig_Update_Collect_Babidi_Func004001 takes nothing returns boolean
return(udg_integer02>=500)
endfunction
function Trig_Update_Collect_Babidi_Actions takes nothing returns nothing
local integer base = 25
local integer prevMult = 1
local integer levelMult = 5
local integer constantOne = 5
local integer maxLevel = 21
local integer experienceGained[22]
set experienceGained[1] = base
local integer i = 1
local integer value
loop
set i = i + 1
exitwhen i > maxLevel
set value = experienceGained[i-1] * prevMult + i * levelMult + constantOne
set experienceGained[i] = value
endloop
local unit deadUnit = GetDyingUnit()
local integer xp
local location locBabidi = GetUnitLoc(udg_unit34)
local location locDeadUnit = GetUnitLoc(deadUnit)
local location locDabura = GetUnitLoc('O000')
local real distanceToBabidi = DistanceBetweenPoints(locBabidi, locDeadUnit)
local real distanceToDabura = DistanceBetweenPoints(locBabidi, locDabura)
call DisableTrigger(GetTriggeringTrigger())
set udg_integer02=(udg_integer02+1)
call LeaderboardSetPlayerItemValueBJ(Player(7),udg_leaderboard01,udg_integer02)
if((udg_integer02>=500))then
call TriggerExecute(udg_trigger535)
else
call EnableTrigger(GetTriggeringTrigger())
endif
if Trig_Update_Collect_Babidi_Conditions() and distanceToBabidi <= 1200 and distanceToDabura <= 1200 then
if GetUnitLevel(deadUnit) >= 1 and GetUnitLevel(deadUnit) <= 21 then
set xp = experienceGained[GetUnitLevel(deadUnit)]
else
set xp = 0
endif
call AddHeroXP(udg_unit34, experienceGained, true)
endif
call RemoveLocation(locBabidi)
call RemoveLocation(locDeadUnit)
call RemoveLocation(locDabura)
endfunction