Could you suggest a script for attacking a monster on the global map (playing the attack animation)?
Could you suggest a script for attacking a monster on the global map (playing the attack animation)?
New here? I'm Roha — want a quick tour?
Is this the only enemy hero?
I encountered such a problem...
There is an enemy hero (mobile). His death leads to victory in the scenario... but if this hero dies during the AI's turn (he crashes into the player), then after the cutscene and everything else, instead of victory, the game displays a console error "No player!", and the turn change freezes. If the player attacks the hero himself, then everything works correctly.
Does anyone know how to fix this? Please!)))
Here is the function itself:
Trigger(PLAYER_REMOVE_HERO_TRIGGER, 2, "TheEnd")
function TheEnd(hero)
if hero == "RedHeavenHero05" then
StartDialogScene(path.."DialogScenes/DialogFinal/DialogScene.xdb#xpointer(/DialogScene)")
sleep(5)
SetObjectiveState("Final", OBJECTIVE_COMPLETED)
SetObjectiveState("NecroTown", OBJECTIVE_COMPLETED)
SetObjectiveState("ArantirLive", OBJECTIVE_COMPLETED)
sleep(10)
Win()
end
end
I encountered the following problem...
There is an enemy hero (mobile). His death leads to victory in the scenario... but if this hero dies during the AI's turn (he crashes into the player), then after the video and other things play, instead of victory, the game displays a console error "No player!", and the turn change freezes. If the player attacks the hero himself, then everything works correctly.
Does anyone know how to fix this? Please!)))
Here is the function itself:
Trigger(PLAYER_REMOVE_HERO_TRIGGER, 2, "TheEnd")
function TheEnd(hero)
if hero == "RedHeavenHero05" then
StartDialogScene(path.."DialogScenes/DialogFinal/DialogScene.xdb#xpointer(/DialogScene)")
sleep(5)
SetObjectiveState("Final", OBJECTIVE_COMPLETED)
SetObjectiveState("NecroTown", OBJECTIVE_COMPLETED)
SetObjectiveState("ArantirLive", OBJECTIVE_COMPLETED)
sleep(10)
Win()
end
end
I had a similar problem; if an enemy hero collided with a player, the game would freeze (BlockGame). I solved it by making my event, which occurred when that hero died, happen during the third player's turn, and everything was fine. But if you only have 2 active players, I don't know how that could help.
Hey guys, can you suggest a script so that a creature attacks and then shows a "happy" animation on the map? It's very important for the map, please help.
PlayObjectAnimation("scripted unit name", "happy", ONESHOT_STILL);
ONESHOT_STILL - if the animation should be played only once;
if you want the animation to be continuous, you need a different command; refer to the manual for the specific command.
PlayObjectAnimation("scripted unit name", "happy", ONESHOT_STILL);
ONESHOT_STILL - if the animation should be played only once;
if you want the animation to be continuous, you need a different command; refer to the manual for the specific command.
PlayObjectAnimation("scripted unit name", "happy", ONESHOT_STILL);
ONESHOT_STILL - if the animation should be played only once;
if you want the animation to be continuous, you need a different command; refer to the manual for the specific command.
OrnsteinDragonslayer explained everything in detail.
In the editor, you assign a script name to the creature that should play the animation. Then, you copy this line into the script for each of these creatures.
PlayObjectAnimation("enter the creature's script name here", "happy", IDLE) - for a looping "happy" animation
PlayObjectAnimation("enter the creature's script name here", "attack00", IDLE) - for a looping "attack" animation
Unfortunately, they are still just standing around doing nothing.
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);
end
end
startThread (BattleThread);