Годрикова впадина, ваш скрипт будет неправильно работать в случае недостатка ресурсов. Но это мелочь. Разрушение замка происходит функцией RazeTown(), с этим всё правильно. Я с ней не эксперементировал, поэтому практических советов дать не могу, но в официальной документации она достаточно подробно описана, и вроде бы ничего сложного не имеет (кроме создания модельки разрушенного замка):
RazeTown
RazeTown – raze a town on the map
Syntax
RazeTown(townName);
Description
Removes the specified town from the map and replaces it with a static object – razed town. The
‘razed town’ object is determined by the razedfield in AdvMapTownShared. If this field is
empty, the town can’t be razed. The set of blocking tiles of the razed town must be the same as
those of the original one’s. The razed town, as any other static object, must have no interactive
tiles.
townName– town name
Warning!
The modifications made in the "Shared" properties ofan object will affect all the objects of that
kind in the game.
If you want your modification to be effective only on a specific map follow these steps:
1)Place on the map the desired object.
2)Go to the Shared field of that object.
3)In the Objects list create a new folder (Right click-New Folder) with the name of your
map.
4)Place in this folder a copy of the object you want to modify.
5)Make the desired modifications to the copy.
For the modifications to be in effect makesure that the path of the shared property leads to
the copy.