Skip to content
User Avatar
#4030
Auto-translated

I haven't quite figured out all the forum's features and how to insert code snippets here... Please excuse me.

There are no syntax errors, but it still doesn't work.

I did as you suggested, adding debug printing, but nothing appears in the console.

Regarding the method using cheats and skipping a turn, cheats don't seem to work in multiplayer games (and the map is specifically for multiplayer), so this option isn't suitable.
I've added debug printing to the first day function:

function first_day ()
if GetDate (0) == 1 then -----Check the day of the week (Monday)
startThread (day_1);
print("hello,");
elseif GetDate (0) == 3 then -----Check the day of the week (Wednesday)
startThread (day_3rd);
end;
end;

The entire script:

function first_day ()
if GetDate (0) == 1 then -----Check the day of the week (Monday)
startThread (day_1);
print("hello,");
elseif GetDate (0) == 3 then -----Check the day of the week (Wednesday)
startThread (day_3rd);
end;
end;

function day_1 ()
ChangeHeroStat ('Brem', 7, -999999999); -----Reduces movement points for player 2
end;

function day_3rd ()
if GetTownRace ('player_1') == 1 then -----Check the Faction of player 1's town
sleep(5);
startThread (zaclyatye_1);
end;
if GetTownRace ('player_2') == 1 then -----Check the Faction of player 2's town
sleep(5);
startThread (zaclyatye_2);
end;
end;

function zaclyatye_1 ()
if GetTownRace ('player_2') == 0 then SetObjectPosition('zaclyatye_humy_1', 125, 15);
elseif GetTownRace ('player_2') == 1 then SetObjectPos('zaclyatye_elfy_1_1', 125, 15);
elseif GetTownRace ('player_2') == 2 then SetObjectPos('zaclyatye_magi_1', 125, 15);
elseif GetTownRace ('player_2') == 3 then SetObjectPos('zaclyatye_liga_1', 125, 15);
elseif GetTownRace ('player_2') == 4 then SetObjectPos('zaclyatye_nekry_1', 125, 15);
elseif GetTownRace ('player_2') == 5 then SetObjectPos('zaclyatye_demony_1', 125, 15);
elseif GetTownRace ('player_2') == 6 then SetObjectPos('zaclyatye_gnomy_1', 125, 15);
elseif GetTownRace ('player_2') == 7 then SetObjectPos('zaclyatye_orki_1', 125, 15);
end;
end;

function zaclyatye_2 ()
if GetTownRace ('player_1') == 0 then SetObjectPosition('zaclyatye_humy_1', 8, 122);
elseif GetTownRace ('player_1') == 1 then SetObjectPos('zaclyatye_elfy_1_2', 8, 122);
elseif GetTownRace ('player_1') == 2 then SetObjectPos('zaclyatye_magi_1', 8, 122);
elseif GetTownRace ('player_1') == 3 then SetObjectPos('zaclyatye_liga_1', 8, 122);
elseif GetTownRace ('player_1') == 4 then SetObjectPos('zaclyatye_nekry_1', 8, 122);
elseif GetTownRace ('player_1') == 5 then SetObjectPos('zaclyatye_demony_1', 8, 122);
elseif GetTownRace ('player_1') == 6 then SetObjectPos('zaclyatye_gnomy_1', 8, 122);
elseif GetTownRace ('player_1') == 7 then SetObjectPos('zaclyatye_orki_1', 8, 122);
end;
end;

Trigger(NEW_DAY_TRIGGER, 'first_day' );

And another question arose: I have two scripts that depend on Trigger(NEW_DAY_TRIGGER), but I read that using two functions for the same trigger cancels out the second function. That is, I have...

function Spawn_army()
....
....
....
Trigger(NEW_DAY_TRIGGER, 'Spawn_army' );

How can I run 2 scripts so that they both start on the same day? For example, on Wednesday - spawn an army in caravans and move a stack of creatures to the player's coordinates (for the Elf to place the summoned creatures).