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
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
Multiplayer: Господство, Извечное противостояние, Война за Магию, Торговая империя, Анатомия войны, Эксперимент
SingleScenario: Последний Рубеж, Трон, Элиралис, Вернуться домой!, Лабиринты разума
Campaign: Колонизация