Skip to content
#3611
Auto-translated
Hello!
Could you please provide some guidance on scripts?
There's a video on YouTube showing how to make it so that 200 peasants join a hero every Wednesday.
Here's the script:
function Armia()
local day=GetDate(3)
if day==3 then
AddHeroCreatures("Raelag, 1,200);
end;
end;

Trigger (NEW_DAY_TRIGGER "Armia")

I want to expand this function so that random creatures from a selection are added every Wednesday.
That is, a variable like "random" is introduced, and depending on its values, the function performs certain actions.
For example, if it's 1, add peasants; if it's 2, add archers; if it's 3, add swordsmen, and so on. What exactly is added is determined randomly, and each week it's determined anew, rather than the variable taking a value from the selection at the beginning of the game and always adding archers.
How can I do this correctly? Please provide the syntax.
I understand that I need to define a "random" variable in the function and put a condition if then inside the if then condition.

Statistics

Welcome our newest member: wayal