Skip to content

Posts from Scripts Auto-translated

4.8 (8 ratings)
In reply to AstralLein
User Avatar
#2592
Auto-translated
AstralLein
Does it definitely use this scheme:

ReplaceDwelling("script name", TOWN_NECROMANCY)?
After that, there are 4 more optional parameters for creature types. But the type of dwelling is determined precisely by the second argument.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#2594
Auto-translated
I entered the following into the console: `
@ReplaceDwelling(GetObjectNamesByType("AXEMEN")[0], TOWN_NECROMANCY)
` and in the red player's (dwarf) zone, the blade house turned into a necropolis.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#2596
Auto-translated
How can you get out of this situation: a hero triggers an event by capturing a town, which is immediately rebuilt... But the AI always sends the hero inside the town before the transformation, and the hero dies...
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
In reply to AstralLein
User Avatar
#2597
Auto-translated
AstralLein
How can you get out of this situation: a hero activates an event by capturing a town, which is immediately rebuilt... But the AI always sends the hero inside the town before the transformation, and the hero dies...
For starters, I would try inserting a move point penalty before the pause.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#2598
Auto-translated
How does this subtraction work? I tried it, but I don't quite understand how the function works.

Added 3 minutes later
Usually, I use it to add experience or stats... but it's not entirely clear here.
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
In reply to AstralLein
User Avatar
#2599
Auto-translated
AstralLein
How does this subtraction work? I tried it, but I don't quite understand how the function works.

Added 3 minutes later
I usually use it to add experience or stats... but it's not quite clear here.
The action points, which are displayed as a green bar in the game, are changed by the specified amount (but not less than 0 and not more than the maximum - the daily gain).
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to AstralLein
User Avatar
#2601
Auto-translated
AstralLein
How do I determine how much to subtract?
If you need to subtract the full amount, use:
-GetHeroStat('hero_name', 7)
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#2602
Auto-translated
I did it like this, but the hero still enters the Castle and commits suicide. And there's another problem there... When transforming into a Necropolis, the Halls of Shields somehow become inaccessible, even though the owner hires a caravan from there without any problems. The other buildings work as expected. ``` function CaptureStraker() if (GetObjectOwner("PlayerTown") == PLAYER_4) then ChangeHeroStat("Straker", 7, -GetHeroStat('Straker', 7)) Trigger(OBJECT_CAPTURE_TRIGGER, "PlayerTown", nil) TransformTown("PlayerTown", TOWN_NECROMANCY) sleep(2) SetAIPlayerAttractor("PlayerTown", 4, 1) SetAIPlayerAttractor("DwarfTown", 4, 2) sleep(2) ReplaceDwelling("d", TOWN_NECROMANCY) SetObjectOwner("d", 4) ReplaceDwelling("dd", TOWN_NECROMANCY) SetObjectOwner("dd", 4) ReplaceDwelling("ddd", TOWN_NECROMANCY) SetObjectOwner("ddd", 4) ReplaceDwelling("dddd", TOWN_NECROMANCY) SetObjectOwner("dddd", 4) AddObjectCreatures("PlayerTown", CREATURE_LICH, 20) AddObjectCreatures("PlayerTown", CREATURE_BONE_DRAGON, 10) ChangeHeroStat("Straker", 0, 25000) end end
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
User Avatar
#2603
Auto-translated
AstralLein
Just a moment...

Added 4 minutes ago
Trigger(OBJECT_CAPTURE_TRIGGER, "PlayerTown", "CaptureStraker")

function CaptureStraker()
if ( GetObjectOwner ("PlayerTown") == PLAYER_4 ) then
Trigger(OBJECT_CAPTURE_TRIGGER, "PlayerTown", nil)
sleep(5)
TransformTown("PlayerTown", TOWN_NECROMANCY)
ChangeHeroStat("Straker", 7, -999999999999999)
sleep(5)
SetAIPlayerAttractor("PlayerTown", 4, 1)
ReplaceDwelling("Dwell1", TOWN_NECROMANCY)
SetObjectOwner("Dwell1", 4)
ReplaceDwelling("Dwell2", TOWN_NECROMANCY)
SetObjectOwner("Dwell2", 4)
ReplaceDwelling("Dwell3", TOWN_NECROMANCY)
SetObjectOwner("Dwell3", 4)
ReplaceDwelling("Dwell4", TOWN_NECROMANCY)
SetObjectOwner("Dwell4", 4)
end
end

Added 1 minute ago
ChangeHeroStat("Straker", 7, -999999999999999) was supposed to remove all movement points and prevent the hero from committing suicide during the Castle transformation, but he still manages to enter it and die.

sleep is unnecessary, try this:
function CaptureStraker(oldOwner, newOwner, heroName, objectName)
local dwellings = {"Dwell1", "Dwell2", "Dwell3", "Dwell4"};
if GetObjectOwner(objectName) == PLAYER_4 then
Trigger(OBJECT_CAPTURE_TRIGGER, "PlayerTown", nil);
TransformTown(objectName, TOWN_NECROMANCY);
sleep(3);
for i = 1, length(dwellings) do
ReplaceDwelling(dwellings, TOWN_NECROMANCY);
sleep(1);
SetObjectOwner(dwellings, PLAYER_4);
SetAIPlayerAttractor("PlayerTown", PLAYER_4, 1);
end;
end;
end;

p.s. if it doesn't help, add BlockGame(); before Transform and Unblock at the end of the function

Added 4 minutes ago
AstralLein
And there's another problem... When transforming into a Necropolis, the Halls of Shields somehow become inaccessible, even though the owner can hire caravans from there without any problems. The other buildings work fine.


this happens because the coordinates and available tiles are different for each dwelling, so you need to leave one or two passable tiles around the post so that after the transformation, the active tile is not blocked by another object
Карты для Heroes V: Повелители орды:
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация
User Avatar
#2604
Auto-translated
When transforming into a Necropolis, the halls of shields somehow become inaccessible, even though the owner can still hire caravans from there without any problems. The other buildings work as intended.
Yes, as KioM mentioned, the grid of cells for the hall of shields doesn't match that of the other level 1 buildings. This can be resolved by destroying the building (RazeBuilding) and building a new one (CreateDwelling).
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
#2605
Auto-translated
RedHeavenHero
Yes, as KioM said, the grid of cells for the Fortress dwelling does not match that of the other level 1 buildings. This can be resolved by destroying the building (RazeBuilding) and placing a new one (CreateDwelling).

It gives an error in the console, stating that the building is indestructible.

Added 14 minutes later
I fixed the suicide bug using teleportation. It now teleports the unit one cell back with a teleport animation. It works. It survives.
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
User Avatar
#2606
Auto-translated
It outputs an error to the console stating that the building is indestructible.
Try creating the shield house using the CreateDwelling function as well – these types of buildings should definitely be destructible.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4