Skip to content

Scripts for beginners.

#240
Auto-translated
}{0TT@6bI4
Don't confuse the log editor with the game console. You can find instructions on how to unlock it online. I also recommend using a dedicated script editor => https://yadi.sk/d/W6cz5UBu3SGAvb. It's more stable, works better, and is more convenient. You need to create a table of script names for the elf heroes:
preserve_heroes={"Name", "Name1", ..., "Name7"}.
Then, in the function:
function Def(heroname)
for key, name in preserve_heroes do
if name==heroname then
local PreserveHero=1
end
end
if not PreserveHero then
StartCombat(...)
end
...
end

Trigger...

Good afternoon!

As a result, I got the following script:

preserve_heroes={"Elleshar", "Linaas", "Gillion", "Diraya", "Itil", "Ossir", "Nadaur"}
function Def( heroName )
for key, name in preserve_heroes do
if name == heroName then
local PreserveHero=1
end;
end;
if not PreserveHero then
         StartCombat(heroName, "Metlirn",7,44,24,146,80,148,16,147,48,50,16,48,48,44,24)
     end;
end;
Trigger( REGION_ENTER_AND_STOP_TRIGGER, "def", "Def" );

It intercepts all heroes without exception...
I even tried having Ilfina ("Itil") enter the region, and a battle starts, and the console displays the message: Value was NIL when getting global with name 'PreserveHero'