Dota 2 Workshop Tools/Scripting/API/CDOTA BaseNPC Hero.AddExperience

From Valve Developer Community
< Dota 2 Workshop Tools‎ | Scripting‎ | API
Revision as of 14:11, 24 January 2015 by Noya (talk | contribs) (Fixed missing bool parameter)
Jump to navigation Jump to search
Note.pngNote: This page is automatically generated. Any changes may be overwritten

Function Description

bool AddExperience(float amount, bool applyBotDifficultyScaling, bool unknown)

Adds experience to this unit.


Example
--Upgrade any spawned hero to Level 6
function MyGameMode:OnNPCSpawned( keys )
  local spawnedUnit = EntIndexToHScript( keys.entindex )
  if spawnedUnit:IsHero() then
    local level = spawnedUnit:GetLevel()
      while level < 6 do
        spawnedUnit:AddExperience (2000,false,false)
        level = spawnedUnit:GetLevel()
      end
  end
end

Parameters

Type Name Description
float amount No Description Set
bool applyBotDifficultyScaling No Description Set

Returns

bool - No Description Set