Trigger(PLAYER_REMOVE_HERO_TRIGGER, PLAYER_2, 'Player2LoseHero');
function Player2LoseHero(looser, winner)
if(looser == 'hero_name') then
...
end
end
Additional checks might be needed if the target hero can be lost in ways other than being killed by a player.
Posts from Current questions and answers regarding the map editor.
EnableHeroAI('Brem', nil);
EnableHeroAI('Straker', nil);
StartAdvMapDialog(0);
function rewF()
StartAdvMapDialog(1);
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "rew", "rewF" );
After adding the trigger for hero death and subsequent actions, all cutscenes and triggers stopped working.
EnableHeroAI('Brem', nil);
EnableHeroAI('Straker', nil);
StartAdvMapDialog(0);
function rewF()
StartAdvMapDialog(1);
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "rew", "rewF" );
Trigger(PLAYER_REMOVE_HERO_TRIGGER, PLAYER_2, 'Player2LoseHero');
function Player2LoseHero(looser, winner)
if(looser == 'Brem') then
StartAdvMapDialog(2);
StartAdvMapDialog(3);
CreateMonster(134,inferno,134,90,10,0,mood= MONSTER_MOOD_AGGRESSIVE,courage= MONSTER_COURAGE_CAN_FLEE_JOIN,rotation= 0 );
StartAdvMapDialog(4);
StartAdvMapDialog(5);
StartAdvMapDialog(6);
StartAdvMapDialog(7);
StartAdvMapDialog(8);
end;
end;
mood= MONSTER_MOOD_AGGRESSIVE,courage= MONSTER_COURAGE_CAN_FLEE_JOIN,rotation= 0
function InitMap()
print('init start');
EnableHeroAI('Brem', nil);
EnableHeroAI('Straker', nil);
print('init heroes OK');
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "rew", "rewF" );
Trigger(PLAYER_REMOVE_HERO_TRIGGER, PLAYER_2, 'Player2LoseHero');
print('init triggers OK');
print('init finish');
end
InitMap();
This code is placed at the very end of the script, and when the map starts, we first look at the console.
If there is a syntax error in the code that the Lua interpreter cannot handle, the console will be empty; the `InitMap()` function will simply not be reached.
If everything is fine, the console will end with the line 'init finish'.
If we try to initialize something incorrectly, for example, we make a mistake with the region name "rew", the console will show:
init start
init heroes OK
some error in red font
Now, the cutscenes work until the hero is killed; after that, the game ends.
And another question. Is there a way to make the Dungeon editor brighter? I can only see the object when I select it. I tried searching for something useful on the forum, but I didn't find anything.
Is there a way to make the dungeon editor brighter?
Added 8 minutes later
Nope, all the animations are there. A complete set, plus three types of dialogue and much more. By the way, take a look at the script itself. It works, but feedback would be helpful.
Added 2 minutes later
Here's an addition to the task: How can I make the appearance of a quest update visible to the player without them having to know the method of "going into the quests and seeing what has changed"? The SetObjectiveProgress command doesn't affect the global map.