Auto-translated
And there, for sure, is a scheme:
ReplaceDwelling("script name", TOWN_NECROMANCY)?
ReplaceDwelling("script name", TOWN_NECROMANCY)?
New here? I'm Roha — want a quick tour?
Does it definitely use this scheme:
ReplaceDwelling("script name", TOWN_NECROMANCY)?
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...
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.
How do I determine how much to subtract?
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.
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;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.
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 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 outputs an error to the console stating that the building is indestructible.