Do you get any errors, or does the game create a *.log -file in the mapfolder?
I assume that you already noticed that there was no Actions to replace or transfer control of houses or troops from one player to another, so you tryed adding it again after its destroyed. Is that correct?
Usually i'd say it's not possible to "replace" a house like that, because the old house has to be removed, before you can put a new house on the old houses locations. However, the coordinates for the houses you've used a different from each other. I can't really see the problem with the lines of codes you've presented here.
Make sure you check the fallowing:
1. Are all those players active? Player 1 in the MapEditor is Player 0 in script f.e.
2. Are the coordinates correct? For old and new house.
3. Maybe there is an unbuildable object at the spot of the storehouse you wanna place
4. Does the procedure even trigger? Maybe try giving out a message with "Actions.ShowMsg(-1, 'House should have been placed...');", like so:
- Code:
procedure OnHouseDestroyed(aHouse : Integer; aHouseOwnerIndex : Integer);
begin
Actions.ShowMsg(-1, 'A House was destroyed!');
If (States.HousePositionX(aHouse) = 103) AND (States.HousePositionY(aHouse) = 26) then
begin
Actions.GiveHouse(1,11,84,42);
Actions.ShowMsg(-1, 'House should have been placed...');
end;
end;
5. I'd modify the script to something like that: (It's a neater way of doing it; dont have to check for each Coordinate seperatly)
- Code:
procedure OnHouseDestroyed(aHouse: Integer; aHouseOwnerIndex: Integer);
begin
if States.HouseAt(103, 26) = aHouse then
Actions.GiveHouse(1, 11, 84, 42);
end;
Hope that helps! And btw, please join us on discord (
https://discord.gg/erSvW5G). Troubleshooting scripts here is quite difficult^^
Best regards,
Strange