h=1;
while h==1 do
x, y = GetObjectPosition("Hero2");
MoveHeroRealTime("Hero3", x+1, y, -1);
end;
end;
Posts from Scripts
Auto-translated
sleep is needed within the loop.
What is SetStandState actually used for?
apparently, it is used to store information that is later used in scripts (I haven't found any other use for it). It's like SetObjectiveState, which we assign to a player, and then a task is activated/completed for them, and then we check its state with if GetObjectiveState ... and perform some actions. The same applies to SetStandState, only it doesn't change anything in the game, but simply sets a number, by checking which, various conditions can be performed in scripts.
Added 2 minutes ago
while 1 do
x, y = GetObjectPosition("Hero2");
MoveHeroRealTime("Hero3", x+1, y, -1);
sleep(20);
end;
or even like this:
while 1 do
if IsObjectExists("Hero2") == true then
x, y = GetObjectPosition("Hero2");
MoveHeroRealTime("Hero3", x+1, y, -1);
else return;
end;
sleep(10);
end;
P.S. This probably needs to be moved to the "Scripts" topic
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
Oh, it worked! You just need to block the space around the NPC so that it doesn't go anywhere, and then it works.
You just need to block the space around the NPC so it can't move anywhere, and it works.
In what sense?
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
In what sense?
He can move far away from the hero after pressing "end turn," and then he won't have enough movement points to be near the main character.
Then you can add before MoveHeroRealTime:
ChangeHeroStats("Hero3", 7, 3500);In general, I advise you to take a look at how it's done in the developers' campaigns, in the first mission of the Hammers of Fate, if I'm not mistaken, Laszlo follows Frida... They created an in-script function to check the distance, so the heroes constantly stay close to each other.
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
script operations for working with objects on the map of type AdvMapStandShared (e.g., TieruHut). To create your own stand, you need to:
1) place the Objects\All-Terrain objects\Tieru's Dwelling object on the map.
2) in the ObjectPropertiesTree, in the Shared graph, click on ...(ellipsis).
3) in the left part of the window that appears, right-click, select NewObject, and name your object.
4) choose a model, animation, effect, and impassable tiles for the stand.
5) in the States graph, select a new model and animation for the modified stand, and in StatesChanges, select which visual and sound effects will be played.
_____
You can create multiple stand states (as desired) and change them using SetStandState(objectName, newStateID).
then you can add before MoveHeroRealTimeChangeHeroStats("Hero3", 7, 3500);
in general, I advise you to take a look at how it is done in the developers' campaigns, in the 1st mission of the Fortress, if I'm not mistaken, Laslo follows Frida... They made an in-script function to check the distance, so the heroes constantly stay close to each other.
Does anyone know how many movement points a hero has by default?
Does anyone know how many movement points a hero has by default?
2500 - without logistics, 2749 - initial logistics, 2999 - developed, 3249 - masterful.
Also, the Traveler's Boots give +25% to movement points on top of everything...
P.S. I managed to get a maximum of 4661 movement points, logistics + boots + stables.
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
2500 - without logistics, 2749 - initial logistics, 2999 - developed, 3249 - advanced.
Also, the Traveler's Boots give +25% to movement points on top of everything...
P.S. I managed to get a maximum of 4661 movement points, logistics + boots + stables.
ChangeHeroStats - add movement points
MoveHeroRealTime - the hero moves towards the main hero
ChangeHeroStats - completely remove movement points.
This way, when the "end turn" button is pressed, the hero will stay in place.
Thank you. I just had an idea:
ChangeHeroStats - add movement points
MoveHeroRealTime - the hero moves towards the main hero
ChangeHeroStats - completely remove movement points.
This way, when the "end turn" button is pressed, the hero will stay in place.
For this, it's not necessary to know the exact number of movement points; you can use GetHeroStat and variables:
start = GetHeroStat("Hero3", 7);
ChangeHeroStat("Hero3", 7, start+3500);
MoveHeroRealTime(...); -- (this function is not modal! I tried to make it modal once, and the game crashed :))
sleep(20);
startThread(end);
function end()
end = GetHeroStat("Hero3", 7);
ChangeHeroStat("Hero3", 7, -end);
end;and no extra numbers ;)
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация