Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
13 years ago
Auto-translated
Now, let's try.

Added 3 minutes later
Oh, thank you, I somehow didn't think to add numbers.

And could you tell me what the problem is with
SetObjectDwellingCreatures('elftown' , 2, 100)
? I don't really understand why there's such a strange range (2-15) in the second parameter...

Whatever
In reply to Heroist
User Avatar
13 years ago
Auto-translated
Heroist
Could you help me understand what the problem is with
SetObjectDwellingCreatures('elftown' , 2, 100)
? I don't really understand why there's such a strange range (2-15) in the second parameter...
I'm not sure, I haven't worked with this command, but maybe its description from the manual will help:
Allows you to set/get the number of creatures that will "grow" in an object, if the latter is a recruitment point (e.g., a town). To clarify, you cannot change the type of creatures being recruited, you can only control their quantity. For example, if you try to use SetObjectDwellingCreatures for an Inferno town with the parameter nCreatureID=1 (peasants), no peasants will appear in the town. (However, this call does not lead to an error). That is, the specified type of stack should, in principle, be possible to recruit in the specified location.
Карты для Heroes of Might and Magic V
Цикл "Закадычные враги": "Особенное гостеприимство, "Супероружие", "Меж молотом и наковальней"
"Падение Шантири"

Кампания для "Кодекса Войны"
"Выбор Сагиттеля"
User Avatar
13 years ago
Auto-translated
Aha. So, the second parameter is the creature's ID?

Okay, I understand now. I was reading the wrong part of the manual.

Whatever
In reply to Heroist
User Avatar
13 years ago
Auto-translated
Heroist
Hmm, thank you.

Added 37 minutes ago
here are a couple more questions:

1) What is the error? The script doesn't work at all, it doesn't even try


---transformation (trans)---

trans = 0

function trans()
while 1 do
sleep(1)
if GetObjectOwner ('elftown') == 1 and trans == 0 then
sleep(1)
ShowFlyingSign(GetMapDataPath().."trans1.txt", "Berein", -1, 7);
sleep(5)
TransformTown ('elftown' , 4)
ReplaceDwelling ('elfdwel1' , 4)
ReplaceDwelling ('elfdwel2' , 4)
ReplaceDwelling ('elfdwel3' , 4)
ReplaceDwelling ('elfdwel4' , 4)
trans = 1
end
end
end
startThread (trans)


(Everything is named correctly, as in the editor)

2) Can I immediately destroy the tavern in the town right after the transformation? (I remember asking a similar question, but I didn't quite manage it, or I was just lazy)
It is better to use breaks.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
13 years ago
Auto-translated
I know. This is the beginning of the script. After the middle, there are breaks.

Whatever
In reply to Heroist
User Avatar
13 years ago
Auto-translated
Here, you can avoid using resource-intensive loops altogether and implement the functionality using OBJECT_CAPTURE_TRIGGER.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
13 years ago
Auto-translated
Well, that works too. It's a perfect solution ;)

Whatever
User Avatar
13 years ago
Auto-translated
I mean, the StartTread command is written with a lowercase letter. I think it shouldn't be.
In my opinion, it's not forbidden, but necessary. It seems that writing it with a capital letter doesn't work; it results in an error. Writing it with a lowercase letter works 100%.
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
13 years ago
Auto-translated
Ment
In my opinion, it's not just possible, but necessary. It seems that using a capital letter at the beginning causes an error, while using a lowercase letter works 100%.

That's a perfectly accurate observation. I just couldn't remember why I always write all startThread calls like that...

Whatever
User Avatar
13 years ago
Auto-translated
The following question arose:
I place a powerful hero with the AI, level 20, at the very beginning of the game, but I disable it until my hero levels up enough for a battle. However, several problems arise:
a) The AI hero is placed directly in the city: the AI doesn't want to send out its heroes, and it hires them, places the disabled hero in the garrison, but still doesn't send out its own.
b) The AI hero is one tile away from the city: the AI hires heroes, but transfers the entire army to the disabled hero, which makes the game less interesting, as it already has an army.

How can I make the AI ignore its own hero if it is disabled?

Whatever
In reply to Heroist
User Avatar
13 years ago
Auto-translated
Heroist
I have a question:
I place a powerful hero with AI, level 20, at the beginning of the game, but I disable him until my hero levels up enough for a battle. However, several problems arise:
a) The AI hero is placed directly in the city: the AI doesn't want to send out its heroes, and it hires them, places the disabled hero in the garrison, but still doesn't send out its own.
b) The AI hero is one tile away from the city: the AI hires heroes, but sends the entire army to the disabled hero, which makes the game less interesting, as he already has an army.

How can I make the AI ignore its own hero if it is disabled?

EnableHeroAI("name", nil)
SetObjectEnabled("name", nil)

won't work?
Кампании для Heroes V 3.1 (Трилогия):

Пробуждение зла
Нашествие из Преисподней
Смена эпох

Скачать все кампании одним архивом: Яндекс.Диск Google.Диск

You can download the set of 3 Campaigns (English version) here


Одиночные сценарии Heroes V 3.1:


Незваные гости
Красный кристалл
Синий кристалл
Закат тьмы

Мультиплеерные карты для Heroes V 3.1:

Легендарная война
Сердце вулкана
Передел мира
In reply to Heroist
User Avatar
13 years ago
Auto-translated
Heroist
I have a question:
I place a powerful hero, level 20, for the AI at the very beginning of the game, but I disable him until my hero levels up enough for a battle. However, several problems arise:
a) The AI hero is placed directly in the city: the AI doesn't want to send out its heroes, and it hires them, places the disabled hero in the garrison, but still doesn't send out its own.
b) The AI hero is one tile away from the city: the AI hires heroes, but transfers the entire army to the disabled hero, which makes the game less interesting, as he already has an army.

How can I make the AI ignore its own hero if it is disabled?
Try simply placing the hero in an inaccessible location and teleporting him to the city for battle using SetObjectPosition.
Карты для Heroes of Might and Magic V
Цикл "Закадычные враги": "Особенное гостеприимство, "Супероружие", "Меж молотом и наковальней"
"Падение Шантири"

Кампания для "Кодекса Войны"
"Выбор Сагиттеля"
User Avatar
13 years ago
Auto-translated
Well... that's too obvious a method. Besides, it's somewhat unrealistic and unsightly. Maybe it could be done using an AI attractor? Or something like that. Set the hero's priority to zero...

Whatever
User Avatar
13 years ago
Auto-translated
What about Juss456's method? I would do the same. Not just disable the AI, but completely disable it so it can't be touched. Although, it's possible that the computer will still try... But you can only use the priority function at your own risk; it doesn't work when you need it to, but when it feels like it. An ideal solution: surround the hero with a region (even a very small one) that cannot be passed through, and then unlock the region with a script.
 

К А
Стикеры GBF в Telegram
User Avatar
13 years ago
Auto-translated
But the hero is in the city ;) I think the region won't be able to do anything here. As for the method – maybe through "enabled"? It's a good option. Even a very good one. But... how do you bring it back to life when player 1 touches it? As far as I know, you can't attach a trigger to a hero, and I would really like the mayor not to leave the city until the end. Besides, the computer will really aggressively keep clicking on the poor hero. And wasn't something similar done in the original campaigns? Well, in general, you could put a non-stopping region in front of this hero that would check and, accordingly, disable "enable" if the first player passes through it. As an option... But it won't save it from the clicking...

Whatever

Statistics

Welcome our newest member: recijeb