Что делать ?

Vaness

Пользователь
12 Ноя 2018
11
0
Посмотрите код я не понимаю в чём тут дело. Юнит просто бегает за мной и ничего не кастует..

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
 
Последнее редактирование:

I_GRIN_I

Друзья CG
15 Мар 2016
1,335
105
Посмотрите код я не понимаю в чём тут дело. Юнит просто бегает за мной и ничего не кастует..

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
Так ты в фростбайт не передаешь абилки, там нет переменной ability
 

HappyFeedFriends

Друзья CG
14 Авг 2017
540
32
Проект
Battle Heroes Arena
А ну да, запуск из KV файла, типа такого. Вспомнил.
 
Реклама: