|
Thread: Odd scripting issue | |
|
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*?
|
|
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.
|
|
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.
|
|
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.
|
|
|
|