Auto-translated
Could you please provide instructions on how to create a script that changes the lighting every day, for example: Monday - dawn, Tuesday - morning, Wednesday - daytime, Thursday - sunset, Friday - midnight.
New here? I'm Roha — want a quick tour?
Please tell me how to create a script so that the lighting changes every day: for example, Monday - dawn, Tuesday - morning, Wednesday - daytime, Thursday - sunset, Friday - midnight.
function NewDayCheck()
if GetDate(DAY_OF_WEEK)==1 *(Monday) then
SetAmbientLight("SunRaise", GROUND, 5);
end;
if GetDate(DAY_OF_WEEK)==2 *(Tuesday) then
SetAmbientLight("SunMiddle", GROUND, 5);
end;
...
end;
Trigger(NEW_DAY_TRIGGER, "NewDayCheck");Read more about AmbientLight in the manual of the highly respected Jack_of_shadows. Here and further I will refer to his guide and my own.How do I create a script so that when interacting with an object, a battle starts with specific enemies (in my case, 3 groups of 5 infantry units each), but the number of creatures depends on the difficulty level (for example, 5 infantry units on Warrior difficulty, and 7 on Hero difficulty)? Thanks in advance to whoever answers.
diff=GetDifficulty();
--diff == 1 on Recruit, 2 on Warrior, 3 on Veteran, 4 on Hero
function MyCombat(heroname, objectname)
if heroname == "MyHeroScriptName" then--Check if the correct hero touched the object
StartCombat(heroname, nil, 3, 6, 5+2*diff, 6, 5+2*diff, 6, 5+2*diff, nil, "resultsf"--Function that runs after the battle, needed if something should happen after the battle);
Trigger(OBJECT_TOUCH_TRIGGER, "nObject", nil); --Resets the function
end;
end;
Trigger(OBJECT_TOUCH_TRIGGER, "nObject", "MyCombat");
function results(hero, result)
if result == not nil then
--Script that runs after victory...
else --Script that runs in case of defeat...
end;
end;6 is the ID of the infantry unit; there will be 3 stacks of 5 plus 2 for each difficulty level.
diff=GetDifficulty();
function bitva_1(heroname, objectname)
if heroname == "Raelag" then
StartCombat(heroname, nil, 3, 6, 5+2*diff, 6, 5+2*diff, 6, 5+2*diff, nil);
sleep(5);
RemoveObject('q7');
RemoveObject('q8');
RemoveObject('q9');
end;
end;
Trigger(OBJECT_TOUCH_TRIGGER,'q7','bitva_1');
Trigger(OBJECT_TOUCH_TRIGGER,'q8','bitva_1');
Trigger(OBJECT_TOUCH_TRIGGER,'q9','bitva_1');
I think I did it right, but the hero ends up with 9 lamellar armor, and I need 7. As I understand it, 5+2*diff means 5 lamellar armor + the amount multiplied by the difficulty. If the difficulty is Recruit, then diff=1, and it turns out that on Recruit there will be 7 lamellar armor, if the difficulty is Warrior, then diff=2, and there are already 5+2*2=9. Can you please explain what the error is here? Thank you in advance.
Added 25 minutes ago
I would also like to ask something else. Does the OpenCircleFog function exist? It reveals the fog of war, and with it you can reveal part of the map. Is it possible to use some function to make it not reveal, but close the fog of war, thus preventing the hero from seeing certain places that he has already visited, and so that this part of the map is not visible on the minimap in the lower left corner of the game?
diff = GetDifficulty(); to diff = GetDifficulty()+1. If you really need 7 on the Hero, then write inside the function before Start Combatdiff= GetDifficulty()+1;
...
...
local amount=0;
local i=1;
for i,4 do
if diff == i then
amount=i;
end;
end;
...It seems that this is correct, but I'm not 100% sure...
diff=GetDifficulty()+1;
...
...
local amount=0;
if diff == 1 then
amount=5;
end;
if diff == 2 then
amount=5;
end;
if diff == 3 then
amount=6;
end;
if diff == 4 then
amount=7
end;And in the formula for calculating the number of lamellar armor, just write amount.CloseCircleFog(x, y, floor, radius, PLAYER_ID); or ask Jack_of_shadows in a private message
Thank you, it seems to be working. Where can I find the IDs for the Stronghold and the 3rd tier units of all other factions besides Humans?
Is it possible to manipulate weeks using scripts?
The dialogue appears, I click on one of the answers, and none of them work.