Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
15 years ago
Auto-translated
Yes, there are. But they don’t cancel out the music that plays automatically (for example, on a specific arena), and that’s exactly what’s annoying. In principle, I just turned up the volume, but it would be better to temporarily disable the background music.
15 years ago
Auto-translated
How do I properly use NEW_DAY_TRIGGER? Please help!
User Avatar
15 years ago
Auto-translated
There shouldn't be any problems with NEW_DAY_TRIGGER; this trigger simply activates every day. I personally had issues with the GetDate function. Here's an example of its usage (from "Adept of War"):
if GetDate(DAY_OF_WEEK)==1 then
This means the trigger will activate on Mondays.
In reply to Ment
User Avatar
15 years ago
Auto-translated
What's wrong here?

SetObjectEnabled("zd1", false);

function zd1F () MessageBox("Maps/SingleMissions/Gardholm/kluch.txt"); SetObjectiveState("zadanie4", OBJECTIVE_COMPLETED); Trigger(OBJECT_TOUCH_TRIGGER, "zd1", nil); end;

Trigger(OBGECT_TOUCH_TRIGGER, "zd1", "zd1F");

The building is disabled, but everything below it doesn't work :smile45:
User Avatar
15 years ago
Auto-translated
90% chance that the issue is due to a mismatch in names (case sensitivity or something similar). Check the name of the text file and the task. Also, make sure that the text file is saved in Unicode format if you didn't use an editor to create it.
15 years ago
Auto-translated
I need help again: how do I use GetDate()? I've done everything as required, but it doesn't work. Please advise.
User Avatar
15 years ago
Auto-translated
What could be causing RemoveObject to not work? Here's a snippet of the script:
function silF ()
if HasArtefact("Nadaur", 77) then
MessageBox("Maps/SingleMissions/Moon glade/derevo.txt");
PlayVisualEffect( "/Effects/_(Effect)/Spells/HolyWord.xdb#xpointer(/Effect)", "sil", 0, 0, 0, 6, 0 );
RemoveArtefact("Nadaur", 77);
SetObjectiveState("zadanie2", OBJECTIVE_COMPLETED);
sleep(2);
RemoveObject("ubr");
MessageBox("Maps/SingleMissions/Moon glade/sil.txt");
Trigger(OBJECT_TOUCH_TRIGGER, "sil", nil);
end;
end;
Trigger(OBJECT_TOUCH_TRIGGER, "sil", "silF");

Everything works except for the highlighted line. The object name is definitely correct. (The object was initially a tree, then I changed it to a structure, but it still doesn't work.)
User Avatar
15 years ago
Auto-translated
This function only works if the object's IsRemovable property is set to true.
User Avatar
15 years ago
Auto-translated
Here's the question. There's a castle and a garrison on the map, which blocks the path to the castle. There's also an AI hero. I need to make this hero move to capture the castle. But nothing works! I tried disabling AI control + MoveHero (both for the garrison and the city), but it doesn't work - the hero just stands still. I tried with AI enabled + SetAIHeroAttractor (both for the garrison and the city), but it doesn't work either - the hero doesn't stay in one place, but he doesn't intend to capture the garrison. It takes more than a day to reach the garrison. I guarantee that the names match. How can I make the hero go where I want him to go?
User Avatar
15 years ago
Auto-translated
1) You haven't tried the most obvious option: disabling AI and MoveHero. 2) If you immediately set MoveHero to capture a castle, I know from experience that it might not work. First, you need to make it capture the garrison, and then the castle. Moreover, even this option is not guaranteed: in one of my maps ("Gnomomania"), I remember having to teleport the heroes through the garrison. However, the situation was slightly different there: there were not one, but three heroes, and instead of MoveHero, I used MoveHeroRealTime.
User Avatar
15 years ago
Auto-translated
1) I tried (I tried disabling AI control + MoveHero (both for the garrison and the town), but it doesn't work - the hero stays in place.).
2) I tried sending him to the garrison and not in RealTime - it still doesn't work.
User Avatar
15 years ago
Auto-translated
Yeah, there are glitches with the garrison there. Another option: direct the unit not to the garrison, but nearby, and then run the MakeHeroInteractWithObject script.
User Avatar
15 years ago
Auto-translated
Thank you, I will try.
User Avatar
15 years ago
Auto-translated
Hello, I haven't been doing mapmaking in Heroes for 4 months, but I decided to get back to it. However, even with the simplest scripts, I'm having trouble. Here's the script: function gloriaF () if HasArtefact ("RedHeavenHero04", 58); then MessageBox (GetMapDataPath().."gloriaF.txt"); ChangeHeroStat ("RedHeavenHero04", STAT_EXPERIENCE 8000); Trigger(OBJECT_TOUCH_TRIGGER, ”gloria”, nil ); else MessageBox (GetMapDataPath().."gloria1F.txt"); end; end; SetObjectEnabled(”gloria”, false); Trigger(OBJECT_TOUCH_TRIGGER, ”gloria”, ”gloriaF” ); The encoding seems to be correct (I extracted the "name" file from the map and kept changing and renaming it), but no matter how I tweak the script, it won't work. 4 months ago, I was writing much more complex scripts... By the way, the first map is already ready. I just need to fix this script and I'll upload it. Please help me fix the script (maybe I'm disabling the trigger too early, or I forgot a parenthesis).
15 years ago
Auto-translated
SetObjectEnabled("gloria", nil);
function gloriaF(heroname)
if HasArtefact("RedHeavenHero04", 58) then
MessageBox(GetMapDataPath().."gloriaF.txt");
ChangeHeroStat("RedHeavenHero04", STAT_EXPERIENCE, 8000);
Trigger(OBJECT_TOUCH_TRIGGER, "gloria", nil);
else MessageBox(GetMapDataPath().."gloria1F.txt");
end;
end;
Trigger(OBJECT_TOUCH_TRIGGER, "gloria", "gloriaF");

"else MessageBox(GetMapDataPath().."gloria1F.txt");" is better to remove.

Added 2 minutes ago
Do you know how to properly use GetDate and NEW_DAY_TRIGGER?

Statistics

Welcome our newest member: recijeb