Connection ErrorBad RequestThis page went staleSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
This page went stale
Your security token was rejected, usually because the page sat open too long or you signed in elsewhere. Nothing was saved. Reload the page and try again.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
That's the issue. The trigger for the new day isn't a list of handlers, but a single function name (like all other triggers). If you put multiple ones, only the last one will work. You need to merge their handlers into one.
How do you scroll up and down in the console?
As far as I remember, PAGE_UP/PAGE_DOWN scrolled somehow, but within a small range.
Hmm. I'll post a screenshot of the second one shortly.
Added 24 minutes later
So, there's this script. At the beginning of the day, it checks a number of conditions, and if they are true, it executes a couple of functions, which then shut down. The idea is that it could be placed in a separate thread, but I don't know how to do that.
Added 1 hour 14 minutes later
It all works now! Thank you very much, Jack_of_shadows!
function ZehirFlev1 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 1 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 320); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev1" );
function ZehirFlev3 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 3 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 600); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev3" );
function ZehirFlev5 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 5 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 750); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev5" );
function ZehirFlev7 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 7 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 950); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev7" );
function ZehirFlev10 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 10 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 400); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev10" );
function ZehirFlev12 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 12 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 700); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev12" );
function ZehirFlev14 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 14 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 820); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev14" );
function ZehirFlev16 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 16 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev16" );
function ZehirFlev18 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 18 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 350); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev18" );
function ZehirFlev20 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 20 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 830); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev20" );
function ZehirFlev22 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 22 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 400); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev22" );
function ZehirFlev25 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 25 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev25" );
function ZehirFlev28 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 28 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 525); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev28" );
function ZehirFlev30 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 30 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); end; end;
Trigger(NEW_DAY_TRIGGER, "ZehirFlev30" );
function ZehirFlev33 (hero) if IsHeroAlive("Zehir") == not nil and GetHeroLevel ("Zehir") >= 33 then ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 900); sleep(5); ChangeHeroStat("Zehir", STAT_EXPERIENCE, 650); end; end;
Before this, I was using the stat check (GetHeroStat) to determine specialization, but it only worked when the hero had exactly that much experience, not more, which is what I need.
sergejez, there can only be one trigger for a new day, so the script doesn't work. If we remove the experience distribution in several steps and leave only the logic "every day Zehir receives experience proportional to his level," then it can be written like this:
-- table of levels and experience amounts
zehir_lvl_and_exp = {from highest level to lowest, {3,600}, {1,320}};
function NewDay()
if IsHeroAlive("Zehir") == not nil then
local zehir_level = GetHeroLevel("Zehir");
for lvl_and_exp in zehir_lvl_and_exp do
if zehir_level >= lvl_and_exp[1] then
ChangeHeroStat("Zehir", STAT_EXPERIENCE, lvl_and_exp[2]);
break
end
end
end
end
Trigger(NEW_DAY_TRIGGER, "NewDay" );
I don't know if this question has been asked before, but is it possible to somehow keep a defeated hero with the player after their defeat? Or immediately after the battle, place the same hero on the strategic map, bypassing the condition "... must survive"?
This only happens during a specific quest, and otherwise, it's needed throughout the entire mission. In principle, you could simply create a separate thread to check for the hero's existence and disable it during the quest, but how would you then place that same hero on the map? Or is there still a way for the hero to remain after being defeated?
You don't need to create a separate thread; there's a special trigger for when a hero is lost – PLAYER_REMOVE_HERO_TRIGGER. There was also a function that automatically made a hero reappear in the tavern after death – MakeHeroReturnToTavernAfterDeath. If you need the hero to reappear on the map, you need to place the hero in reserve (in the editor, in the map settings) and then remove him from reserve at the beginning of the map and each time after he dies – DeployReserveHero.
Hey guys, sorry if this question has already been asked. Can you tell me how to enable scripts on maps? I have scripts in Data/scripts/ that change some abilities in the game, but they don't work on GSC maps. So, how do I activate them on a map?
If I understand correctly, the scripts are located in data.pak/scripts, or in the data/scripts folder. In both cases, you can manually call the desired script from the console:
If I understand correctly, the scripts are located in data.pak/scripts, or in the data/scripts folder, then in both cases, you can manually call the desired script from the console:
@doFile("/scripts/SCRIPT_NAME.lua")
Is it possible to place a link somewhere in the map so that they work when the map is launched? In IRMG, scripts work immediately without any external intervention. In the NHF mod, there is a third-party program that patches maps (as it turned out, it works not only for their mod, and the problem has already been solved, but I want to understand the essence).
Couldn't you provide a link within the map so that they would work when the map is launched?
Every map has (or you can create) a MapScript.lua file, which is executed when the map starts. You can add the line I provided there, but without the "@" at the beginning.
Could you please explain why, when using StartCombat, the enemy hero deployed from the reserve becomes neutral? Is there a way to fix this?
The code essentially looks like this:
```
DeployReserveHero('Skeggy', 27, 145, 0, 0);
sleep(1);
local ENA = crtables(random(3)+1);
StartCombat(hero, 'Skeggy', 5, ENA[1][1], ENA[1][2], ENA[2][1], ENA[2][2], ENA[3][1],
ENA[3][2], ENA[4][1], ENA[4][2], ENA[5][1], ENA[5][2], nil, 'AC',
'/Arenas/Arena.AdventureFlybyScene).xdb#xpointer(/AdventureFlybyScene)');
```
crtables is an external function.