Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 5 - Modders Workshop > Thread: Odd scripting issue
Thread: Odd scripting issue
Maurice
Maurice

Hero of Order
Part of the furniture
posted September 07, 2007 08:30 PM

Odd scripting issue

While trying to set up an AI testing map, I decided to delve into a little scripting as well.

The main idea is to teleport the AI Heroes right in the middle of a circle, with mines on the outside perimeter. Within a day, they can only reach one mine, and with them being teleported back to the center (being equally distant to any of the given mines), they will not use distance to choose the next mine to capture, but rather how useful it considers the mine.

Anyway, the script is simple as heck:

function going_home()
SetObjectPosition("Havez", 33, 99 , 0);
SetObjectPosition("Dalom", 100, 99, 0);
SetObjectPosition("Glen", 33, 34, 0);
SetObjectPosition("Bersy", 100, 34, 0);
SetObjectPosition("Guarg", 33, 99, 1);
SetObjectPosition("Straker", 100, 99, 1);
SetObjectPosition("Ossir", 33, 34, 1);
end;

Trigger( NEW_DAY_TRIGGER, "going_home",nil );

That's it, nothing fancy or anything else. I named the Heroes of the different AI players, ranging from player 2 (Havez), down to player 8 (Ossir). I myself am in control of player 1, so it's not included in the script.

Now, the script works half. Havez, Dalom, Glen and Bersy are all four on the surface level. These Heroes get teleported correctly at the start of each day. Guarg, Straker and Ossir are on the subterranean level, and they remain where they are. . As far as I know, the syntax of the SetObjectPosition script is Hero name, followed by the x-coordinate, y-coordinate and floor, where 0 is the surface level and 1 the subterranean area.

Anyone have a clue why this script only works *half*?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted September 07, 2007 08:56 PM

It gets even more weird. I just replaced the three Heroes who refused to be teleported by some of their counterparts. Guarg moved out for Veyer, Straker moved out for Aberrar, and Ossir made room for Heam.

Now they all teleport back as they should.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Kronos1000
Kronos1000


Promising
Supreme Hero
Fryslân Boppe
posted September 07, 2007 09:30 PM

Trigger( NEW_DAY_TRIGGER, "going_home",nil ); this line is wrong, the NEW_DAY_TRIGGER should be used like this: Trigger( NEW_DAY_TRIGGER, "going_home");  if this isn't it I need to dig deeper tell me if it works.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted September 07, 2007 09:35 PM

Actually, that line comes from the script of the first mission of the "standard" HoMM5 Dungeon campaign . Not sure what the "nil" value does, but I guess it is needed in the function syntax.

But as said, I replaced the three refusing Heroes with alternates (also changing the names in the script of course) and now it works as it is intended.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0181 seconds