-------------------------------------------------------------------------------- function Spawn( entityKeyValues ) if not IsServer() then return end if thisEntity == nil then return end thisEntity:SetContextThink( "SmallHellbearThink", SmallHellbearThink, 1 ) end -------------------------------------------------------------------------------- function SmallHellbearThink() if ( not thisEntity:IsAlive() ) then return -1 end if GameRules:IsGamePaused() == true then return 1 end if not thisEntity.bInitialized then thisEntity.vInitialSpawnPos = thisEntity:GetOrigin() thisEntity.bInitialized = true end -- Increase acquisition range after the initial aggro if ( not thisEntity.bAcqRangeModified ) and thisEntity:GetAggroTarget() then thisEntity:SetAcquisitionRange( 750 ) thisEntity.bAcqRangeModified = true end if thisEntity:GetAggroTarget() then thisEntity.fTimeWeLostAggro = nil end if thisEntity:GetAggroTarget() and ( thisEntity.fTimeAggroStarted == nil ) then --print( "Do we have aggro and need to get a timestamp?" ) thisEntity.fTimeAggroStarted = GameRules:GetGameTime() end if ( not thisEntity:GetAggroTarget() ) and ( thisEntity.fTimeAggroStarted ~= nil ) then --print( "We lost aggro." ) thisEntity.fTimeWeLostAggro = GameRules:GetGameTime() thisEntity.fTimeAggroStarted = nil end if ( not thisEntity:GetAggroTarget() ) then if thisEntity.fTimeWeLostAggro and ( GameRules:GetGameTime() > ( thisEntity.fTimeWeLostAggro + 1.0 ) ) then return RetreatHome() end end return 0.5 end -------------------------------------------------------------------------------- function RetreatHome() --print( "RetreatHome - " .. thisEntity:GetUnitName() .. " is returning to home position" ) ExecuteOrderFromTable({ UnitIndex = thisEntity:entindex(), OrderType = DOTA_UNIT_ORDER_MOVE_TO_POSITION, Position = thisEntity.vInitialSpawnPos -- + RandomVector( RandomFloat( -300, 300 ) ) }) return 0.5 end --------------------------------------------------------------------------------