You could simply loop the MoveHeroRealTime function so that the enemy constantly moves towards the position of the desired hero. However, it's better not to loop CalcHeroMoveCost, as the game starts to lag if you create an infinite loop with this function.
function check_loop()
while 1 do
local x, y, floor=GetObjectPosition("nMyhero");
if CalcHeroMoveCost(?)("nAI", x, y, floor)<=100 then
StartCombat(...);
end;
sleep(1)
MoveHero("nAI", x, y, floor);
end;
end;
startThread(check_loop);Have you checked if it crashes? Simply looping MoveHero will move the AI "towards us," but it won't trigger interaction, and the player will still decide whether to attack or not. The goal, as I understand it, is for the AI to automatically attack us...
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________