Skip to content
User Avatar
#1496
Auto-translated
Oligarch
I spawned monsters through a loop, so there is no need to get all the monster names, at least I think so.
Here is the script:
for x=66,67 do
for y=127,159 do
if IsTilePassable(x, y, 0)==1 then
CreateMonster ("name"..i, 32, 1, x, y, 0,1,2,270)

if x==67 and y==130 then
PlayObjectAnimation ("name"..i, "death", ONESHOT_STILL)
end
if x==67 and y==154 then
PlayObjectAnimation ("name"..i, "death", ONESHOT_STILL)
end
if x==66 and y==155 then
PlayObjectAnimation ("name"..i, "death", ONESHOT_STILL)
end
i=i+1
end
end
end

That is, as a result, it should produce monsters standing in a rectangle, some of them dead. At the same time, the game does not play the death animation for creatures at the checked coordinates; the console says that a monster with the name name(...) was not found.
If I put sleep between CreateMonster and the checks, the monsters spawn not in a rectangle, but randomly according to some unclear principle. What could be the problem?
for x=66,67 do
for y=127,159 do
startThread(function(int)
local name="name"..int
CreateMonster(name, 32, 1, %x, %y, 0, 1, 2, -90)
sleep(1)
SetObjectPosition(name, %x, %y, 0)
if (%x==67 and %y==130) or (%x==67 and %y==154) or (%x==66 and %y==155) then
PlayObjectAnimation(name, "death", ONESHOT_STILL)
end
end, i)
i=i+1
end
end
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4

Statistics

Welcome our newest member: leyu