I want to remove bounty any spawned hero so I try to use SetMinimumGoldBounty and SetMaximumGoldBounty with 0 values but it seems to be not working. Below is my code to handle any unit spawn event -
function CAddonTemplateGameMode:OnUnitSpawned(args) local entH = EntIndexToHScript(args.entindex) if entH == nil then return end if not entH:IsHero() then return end print("hero spawned " .. entH:GetUnitName()) entH:SetMinimumGoldBounty(0) entH:SetMaximumGoldBounty(0) print("bounty on " .. entH:GetUnitName() .. " is " .. entH:GetGoldBounty()) end
and each time it prints (in console) -
hero spawned npc_dota_hero_axe bounty on npc_dota_hero_axe is 133 hero spawned npc_dota_hero_skeleton_king bounty on npc_dota_hero_skeleton_king is 133
How can I remove bounty on any spawned hero?