Skip to content
#2850
Auto-translated
AstralLein
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

Record it as I suggested, using startThread.

function TheEnd()
while IsHeroAlive( "RedHeavenHero05" ) == true do sleep(5) end
sleep(1)
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
(I might have missed something)
The function itself needs to be launched after defeating Vessel.
Карты: Экспедиция ГрувераНаследие ШантириВременной парадоксПоиски рунной сферыПуть возвращения

Statistics

Welcome our newest member: leyu