Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
6 years ago
Auto-translated
In general, the problem is described here: /topic/at/1162432/. The fix is also there, but it's somewhat clunky and “noticeable” for the player
In reply to Gerter
User Avatar
6 years ago
Auto-translated
Phew... This issue won't affect me; I only play PvE.
In reply to Долгий
User Avatar
6 years ago
Auto-translated
I encountered the following problem: when displaying a TalkBox with variables inside and fewer than 5 answers, the game automatically adds 1 answer option with the text from the main text (the "text" parameter).
TalkBoxForPlayers(PLAYER_1, icon, nil, {text, var1=variable_1, var2=variable_2, var3=variable_3}, nil, nil, 0, title, GetMapDataPath().."ChooseAnswer.txt", 0, GetMapDataPath().."OK.txt");
WITHOUT VARIABLES: WITH VARIABLES: If anyone has any ideas on how to fix this and why it's happening, I would be very grateful to hear them.
User Avatar
6 years ago
Auto-translated
Good afternoon, could you please help me? I've encountered a problem in this section of the script. ``` function fb1 () RemoveHeroCreatures("RedHeavenHero03",8,20); sleep(1); RemoveHeroCreatures("Biara",20,1*D); sleep(1); StartDialogScene("/Maps/SingleMissions/Warprolog/StartScene2/DialogScene.xdb#xpointer(/DialogScene)"); sleep(1); MoveHeroRealTime("Biara", 88, 59, GROUND); sleep(1); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "stfb1", "fb1",nil); end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "stfb1", "fb1"); ``` The issue is that after Biara makes her move, the StartScene2 cutscene plays a second time, specifically within this trigger. There are no other mentions of it. Could someone who understands this please advise on what might be causing this? I'm completely stumped.
User Avatar
6 years ago
Auto-translated
I suspect that Biara also enters the region and triggers the second event, and you don't have time to disable it because of the sleep function. Try this:

function fb1()
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "stfb1", "fb1", nil);
RemoveHeroCreatures("RedHeavenHero03", 8, 20);
sleep(1);
RemoveHeroCreatures("Biara", 20, 1*D);
sleep(1);
StartDialogScene("/Maps/SingleMissions/Warprolog/StartScene2/DialogScene.xdb#xpointer(/DialogScene)");
sleep(1);
MoveHeroRealTime("Biara", 88, 59, GROUND);
sleep(1);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "stfb1", "fb1");
In reply to Рыцарь Бездны
User Avatar
6 years ago
Auto-translated
Knight of the Abyss
Hello, could you please help me? I'm having a problem with this part of the script.

function fb1()
RemoveHeroCreatures("RedHeavenHero03", 8, 20);
sleep(1);
RemoveHeroCreatures("Biara", 20, 1*D);
sleep(1);
StartDialogScene("/Maps/SingleMissions/Warprolog/StartScene2/DialogScene.xdb#xpointer(/DialogScene)");
sleep(1);
MoveHeroRealTime("Biara", 88, 59, GROUND);
sleep(1);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "stfb1", "fb1", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "stfb1", "fb1");

The problem is that after Biara makes her move, this cutscene, StartScene2, plays a second time, specifically within this trigger. There are no other mentions of it. If anyone understands, please tell me what might be the cause. I've been racking my brain over this.

At the very least, the highlighted red section of code is not needed. And it's better to reset the trigger before other operations.
User Avatar
6 years ago
Auto-translated
Thank you! I managed to solve the previous problem, but now a new one has emerged. I'm trying to implement a change in lighting every in-game day.

function Sutki()

if GetDate(DAY_OF_WEEK)==1 then
SetAmbientLight(0,"d1",true, 5);
end;
if GetDate(DAY_OF_WEEK)==2 then
SetAmbientLight(0,"d2",true, 5);
end;
if GetDate(DAY_OF_WEEK)==3 then
SetAmbientLight(0,"d3",true, 5);
end;
if GetDate(DAY_OF_WEEK)==4 then
SetAmbientLight(0,"d4",true, 5);
end;
if GetDate(DAY_OF_WEEK)==5 then
SetAmbientLight(0,"d5",true, 5);
end;
if GetDate(DAY_OF_WEEK)==6 then
SetAmbientLight(0,"d6",true, 5);
end;
if GetDate(DAY_OF_WEEK)==7 then
SetAmbientLight(0,"d7",true, 5);
end;
end;


Trigger(NEW_DAY_TRIGGER, "Sutki");

The problem is that the game doesn't react to any of this; the lighting remains the same as on the first day throughout the week. Moreover, the console is silent; there are no error messages, and nothing happens. Initially, I did everything according to the example of a user named Khottabych, who was a few pages above, but then the console complained about an incorrect value for argument 1. After that, I looked at how the developers implemented this in the fifth mission for Arantir. There, I noticed that they had a "0" before the lighting name, so I added it to mine. The console stopped complaining, but it still didn't work. I've tried setting "True" as the developers did, and I've also tried replacing it with "GROUND" as Khottabych suggested, but there's no difference; the console remains silent in both cases. The InternalName of the lighting is specified correctly, and the lighting itself is duplicated in the map files. But it still doesn't work. Please advise on what the problem might be.
User Avatar
6 years ago
Auto-translated
Look for the lines containing "SetAmbientLight" in the script of my map "Runes in Good Hands"; it worked for me.
In reply to }{0TT@6bI4
User Avatar
6 years ago
Auto-translated
}{0TT@6bI4
Look for the lines SetAmbientLight in the script of my map "Runes in Good Hands," it worked for me.

It's strange, I'm doing it the same way as you, but nothing happens, and the console is still silent. I really don't know what to think :o Even a simple SetAmbientLight outside the trigger doesn't change anything. I'll have to try it on a separate map, maybe I messed something up there). In any case, thank you very much for the advice!
User Avatar
6 years ago
Auto-translated
By the way, I forgot to mention: this highlighting should be in the Ground/UnderGroundAmbientLights list in the Map Properties Tree. In Runes, the line SetAmbientLight(GROUND, "NecromancyFog", true, 3) worked, so the issue must be with the point mentioned above.
In reply to }{0TT@6bI4
User Avatar
6 years ago
Auto-translated
}{0TT@6bI4
By the way, I forgot to mention: this lighting should be in the Ground/UnderGroundAmbientLights list in the Map Properties Tree. In Runes, the line SetAmbientLight(GROUND, "NecromancyFog", true, 3) worked, so the issue is with the point mentioned above.

It worked! You were right, I added a few more lines to GroundAmbientLight, specified all the desired lighting in them, and now everything works. The FPS drops slightly during the lighting change, but it's worth it; the location really comes alive with all this.
User Avatar
6 years ago
Auto-translated
Feel free to ask! By the way, if you change the 3rd parameter from true to false, the FPS drop should be reduced to a minimum.
User Avatar
6 years ago
Auto-translated
Thanks, I will definitely do that. And another question: could someone share an example of a StartCombat script where the enemies include, for example, a stack of militia and another stack of archers, each with 10 units? I can write a StartCombat script for a single type of unit, but I can't figure out how to add a full army of different units; I don't understand which variables to use for the second stack, and it would be easier to understand with a real-life example. Thanks in advance.
In reply to Рыцарь Бездны
User Avatar
6 years ago
Auto-translated
Knight of the Abyss
Thank you, I will definitely do that. And another question, could someone share an example of a StartCombat script where the enemies include, for example, a stack of militia and another stack of archers, each with 10 units? I can write a StartCombat for a single type of creature, but I can't figure out how to add a full army of different units; I don't understand which variables to write for the second stack, and it would be easier to understand with a live example. Thank you in advance.

The number of stacks is determined by the third parameter in StartCombat, followed by pairs of [creature ID - number of creatures in the stack]. The number of these pairs corresponds to the number of stacks. Therefore, for the described case, the function would look something like this:
StartCombat('hero_name', nil, 2, CREATURE_MILITIAMAN, 10, CREATURE_ARCHER, 10)
In reply to Gerter
User Avatar
5 years ago
Auto-translated
Good afternoon, the console displays the following error: (Script) ERROR: "=" expected. The script itself looks like this: * Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'mavzolei', 'grobniza'); function grobniza(hero) if GetObjectOwner(hero)==PLAYER_1 and hero=="Brem" then MessageBox(path.."mavzolei-boi.txt"); sleep (5); StartCombat("Brem", nil, 5, 4, 40, 12, 4, 10, 1, 12, 4, 4, 40, nil); sleep (5); MessageBox(path.."mavzolei-poisk.txt"); void GiveArtefact("Brem", 13, nBindToHero=0); Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'mavzolei', nil); end; end; What is the error here?

Statistics

Welcome our newest member: recijeb