Skip to content

Scripts for beginners.

#237
Auto-translated
}{0TT@6bI4
I also recommend checking the console if the code doesn't work, as the error there is often the key to solving the problem.
That's where I saw that the script (check button) wasn't working.

There was a message that the line `function Def(heroname)` is not defined
and the line `function CREATURE_CRYSTAL_DRAGON` is not defined

Added 1 minute ago
}{0TT@6bI4
Look at the script name of the hero in its settings (Select => Space => Settings => Script name). And replace `hero` with this name.
That is:
function Def(heroname)
if heroname == hero then
StartCombat(hero,nil,1,CREATURE_CRYSTAL_DRAGON,6);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "def", nil);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "def", "Def");

Since you left the last 4 parameters as nil, you can simply not specify them.

But I need any hero, except for the heroes of the Forest Pact, to enter into combat when entering the area