Посмотрите код я не понимаю в чём тут дело. Юнит просто бегает за мной и ничего не кастует..
function Spawn( entityKeyValues )
if not IsServer() then
return
end
if thisEntity == nil then
return
end
local ability = thisEntity:FindAbilityByName("frostbite_enigma")
--FindUnitsInRadius(int teamNumber, Vector position, handle cacheUnit, float radius, int teamFilter, int typeFilter, int flagFilter, int order, bool canGrowCache)
local enemies = FindUnitsInRadius(DOTA_TEAM_BADGUYS, thisEntity:GetAbsOrigin(), nil, FIND_CLOSEST, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_FLAG_NONE, FIND_CLOSEST, false)
thisEntity:SetContextThink( "EnigmaBossThink", EnigmaBossThink, 1 )
end
function EnigmaBossThink()
if ( not thisEntity:IsAlive() ) then
return -1
end
if GameRules:IsGamePaused() == true then
return 1
end
if #enemies > 0 then
if ability ~= nil and ability:IsFullyCastable() then
return frostbite()
end
end
return 1
end
function frostbite( hTarget )
ExecuteOrderFromTable({
UnitIndex = thisEntity:entindex(),
OrderType = DOTA_UNIT_ORDER_CAST_TARGET,
TargetIndex = hTarget:entindex(),
AbilityIndex = ability:entindex(),
Queue = false,
})
return 0.5
end
if not IsServer() then
return
end
if thisEntity == nil then
return
end
local ability = thisEntity:FindAbilityByName("frostbite_enigma")
--FindUnitsInRadius(int teamNumber, Vector position, handle cacheUnit, float radius, int teamFilter, int typeFilter, int flagFilter, int order, bool canGrowCache)
local enemies = FindUnitsInRadius(DOTA_TEAM_BADGUYS, thisEntity:GetAbsOrigin(), nil, FIND_CLOSEST, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_FLAG_NONE, FIND_CLOSEST, false)
thisEntity:SetContextThink( "EnigmaBossThink", EnigmaBossThink, 1 )
end
function EnigmaBossThink()
if ( not thisEntity:IsAlive() ) then
return -1
end
if GameRules:IsGamePaused() == true then
return 1
end
if #enemies > 0 then
if ability ~= nil and ability:IsFullyCastable() then
return frostbite()
end
end
return 1
end
function frostbite( hTarget )
ExecuteOrderFromTable({
UnitIndex = thisEntity:entindex(),
OrderType = DOTA_UNIT_ORDER_CAST_TARGET,
TargetIndex = hTarget:entindex(),
AbilityIndex = ability:entindex(),
Queue = false,
})
return 0.5
end
Последнее редактирование: