Skip to content

Current questions and answers regarding the map editor.

User Avatar
#4772
Auto-translated
Jack_of_shadows
Are you setting the animation type to IDLE? They are (probably) incorrectly defined for these creatures. I suggest creating a battle as a sequence of ONESHOT animations. It works perfectly, and you can also set a variable interval between attacks, which looks much more realistic. That's how I always did it:
function BattleThread()
while (true) do
if (IsObjectExists(CREATURE 1)) then
PlayObjectAnimation(CREATURE 1, 'attack00', ONESHOT);
end
sleep(random(10)+5);
if (IsObjectExists(CREATURE 2)) then
PlayObjectAnimation(CREATURE 2, 'attack00', ONESHOT);
end
sleep(random(10)+5);
end
end

startThread(BattleThread);

You can experiment with the intervals, types of attacks; you can set it so that when one creature attacks, the other receives the attack, and a whole lot more.
Hmm, is it necessary to select the animations themselves in the shared properties of the creatures? I have some fire and water element animations selected there, but your function doesn't work, and the units just stand there. Here's what I entered, just in case. Also, the print statement doesn't indicate that the animation is complete.
function BattleThread()
while (true) do
if (IsObjectExists(elemF)) then
PlayObjectAnimation("elemF", "attack00", ONESHOT);
end
sleep(random(10)+5);
if (IsObjectExists(elemW)) then
PlayObjectAnimation("elemW", "attack00", ONESHOT);
end
sleep(random(10)+5);
print("animation elemov complete")
end
end

startThread (BattleThread);
Here's what the console says:
Автор карт:
Долина расхитителей
Выбор мира