не могу заставить юнита иди к зданию и атаковать только его. Он сразу же переагривается:
Lua:
function task4()
print("ПОШЛО ПОЕХАЛО")
local whiteColor = "#FFD700"
local redColor = "#FFFFFF"
local message = "<font color='" .. whiteColor .. "'>СЛУГА БОЖИЙ:</font><font color='" .. redColor .. "'> Вот вам мое благословление)</font>"
local targetFort = Entities:FindByName(nil, "npc_goodguys_fort")
if targetFort then
print("ФОРТ НАЙДЕН")
end
Timers:CreateTimer(3, function()
GameRules:SendCustomMessage(message, 0, 0)
-----------------------------------------
spawnedUnitGlobal:RemoveModifierByName( "modifier_invulnerable" )
spawnedUnitGlobal:SetAttackCapability(DOTA_UNIT_CAP_MELEE_ATTACK)
-----------------------------------------
spawnedUnitGlobal:SetForceAttackTarget(targetFort)
if spawnedUnitGlobal:GetForceAttackTarget() == targetFort then
print("АТАКУЮ ФОРТ")
end
end)
end