Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to antonag07
Auto-translated
antonag07
I understand that – it's just that for this command (MarkObjectAsVisited) to work, the object must be turned off – that's why other heroes can't interact with it.
Well, I'm saying that the object is turned off. :confused:
:smile33:. It's turned off via scripts – otherwise, it doesn't work as it should. Interaction is done through TOUCH_TRIGGER.
In reply to JonnyP
Auto-translated
JonnyP
Well, what I'm writing is that the object is disabled if needed. :confused:
:smile33:. It's disabled using scripts - otherwise, it doesn't work as it should. Interaction is done through TOUCH_TRIGGER.

Try a different method - disable it using region_enter_and_stop_trigger.
In reply to antonag07
Auto-translated
antonag07
try a different method - disabling it using the enter_and_stop_trigger command.
Other methods won't work. I've already tried them. It's just unclear why this function is so problematic :smile48: - it doesn't want to work correctly.
Auto-translated
or could it be a trick with the name? (i.e., the game considers 'geroy' to be the entire array of heroes under the player's control)
In reply to antonag07
Auto-translated
antonag07
Could it be a trick with the name? (i.e., the game considers 'geroy' to be the entire array of heroes under the player's control)
Here, look at a part of the script:
num_stone=3; --number of demon stones
for i=1,num_stone do
SetObjectEnabled ('stone_'..i,nil);
Trigger (OBJECT_TOUCH_TRIGGER,'stone_'..i,'up_herolider');
end;

function up_herolider(geroi,object)
if geroi==Larion then
................
MarkObjectAsVisited (object,geroi);
.................
else
if geroi==Derin then
.................
MarkObjectAsVisited (object,geroi);
end;end;
end; ..............

Derin and Larion are constants (hero names); there's a lot more, but this is the basis. When any of the heroes 'contacts' the object, when the second hero right-clicks on the 'stone' object, it says 'already visited', but if you approach it, the bonus is given normally. Visually, it's not clear whether one or both heroes were at the object.
Auto-translated
I wanted to ask you right away about the message that appears when hovering the cursor; because as it is, it doesn't make the game very playable.

And what if we launch threads to check whether a particular hero has visited a specific object?
In reply to antonag07
Auto-translated
antonag07
I actually wanted to ask you right away about the message that appears when you hover the cursor; because as it is, it doesn't make the game very playable.

What if we launch threads to check whether a particular object is visited by a specific hero?
I don't think it's worth it - there will be at least 50 of these objects, and it will slow down the game too much. Besides, there will be other threads as well. So, you don't know what the problem is?
In reply to JonnyP
Auto-translated
JonnyP
I don't think it's worth it - there will be at least 50 such objects, which will slow down the game too much. Besides, there will be other processes running. Don't you know what the problem is?


I don't know - I can only guess;

I tried using this value: MarkObjectAsVisited(sObjectID, true);
where sObjectID is the script name of the object.
?
User Avatar
Auto-translated
for i=1,num_stone do
SetObjectEnabled ('stone_'..i,nil);
Trigger (OBJECT_TOUCH_TRIGGER,'stone_'..i,'up_herolider');
end;

There seems to be an issue with the loops. Try disabling the object in a different way, for example, by naming all three stones differently: stone01, stone02, stone03, and then selecting them in the script:

stone = {'stone01', 'stone02', 'stone03'};
stone.n = length(stone);
...
for i=1, stone.n do
SetObjectEnabled (stone,nil);
Trigger (OBJECT_TOUCH_TRIGGER,stone,'up_herolider');
end;
...
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
In reply to antonag07
Auto-translated
antonag07
I don't know – I can only guess;

I tried recording this value: MarkObjectAsVisited(sObjectID, true);
where sObjectID is the script name of the object.
Yes, it gives an error that there is no hero '1' on the map. And I also tried setting the third parameter to true – I thought maybe there was an error in the manual. The effect is achieved anyway, but not for a specific hero.

Added 2 minutes later
KioM
There's something wrong with the loops; try disabling the object in a different way, for example, by naming all three stones differently: stone01, stone02, stone03, and then selecting them in the script:

stone = {'stone01', 'stone02', 'stone03'};
stone.n = length(stone);
...
for i=1, stone.n do
SetObjectEnabled (stone,nil);
Trigger (OBJECT_TOUCH_TRIGGER,stone,'up_herolider');
end;
...

This loop works perfectly fine – it has been tested many times. You are suggesting doing the same thing, but in a more verbose way. (And what if I have 1000 'stone' objects? ;) )
User Avatar
Auto-translated
I might have misunderstood. Does `MarkObjectAsVisited` work, but not for a specific hero, but for all heroes?
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
In reply to KioM
Auto-translated
KioM
I might have misunderstood. Does MarkObjectAsVisited work, but not for a specific hero, but for all of them?
Yes. I already wrote about this in the posts above.
In reply to JonnyP
Auto-translated
JonnyP
yes - accordingly, it gives an error that there is no hero '1' on the map. And I also set the third parameter to true - I thought maybe there was an error in the manual. The effect is achieved in principle even without it, but not for a specific hero.

)


Did the error with the hero's name always occur, or only after MarkObjectAsVisited(sObjectID,true);?

(because in message 379 I also made such a suggestion)
In reply to antonag07
Auto-translated
antonag07
Did the error with the hero's name always occur, or only after MarkObjectAsVisited(sObjectID,true);
?

(because in message 379, I also made such a suggestion)
Of course, it happens after you change the function's parameters. All errors can be easily caught with print statements. :)
Yeah, it will be a bad problem for players - not knowing which obelisk has been visited :smile13:
User Avatar
Auto-translated
Sorry, I misunderstood earlier (I'm already tired), here's how you should do it:

Trigger (OBJECT_TOUCH_TRIGGER,'stone_'..i,'up_herolider');

function up_herolider(geroi,object)
if geroi ==Larion then
................
-MarkObjectAsVisited (object,geroi);
+MarkObjectAsVisited (object,Larion);
.................
and so on, i.e., directly reference the specific hero.
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация

Statistics

Welcome our newest member: Emil