Magil
Monarch
- Joined
- Sep 26, 2010
- Messages
- 1,618
So, I'm looking for a way to, when a city is captured, check to see if a specific building is present, and if it is, remove that building (alternately, look to see if a building has a particular property, in this case MaxPlayerInstances > 0). I imagine this would need to be done in LUA as it doesn't appear the game's XML/SQL supports removing buildings, except perhaps if it was hard-coded to an outer defense value.
I'm pretty clueless when it comes to LUA. Nevertheless, I have made some attempts to figure it out. I first supposed maybe if I could put it into RazeCity.lua somewhere, I could maybe hack that in, but then I looked at this table (which is helpful, thank you Gedemon) and determined that City.RemoveBuilding was a GameplayScript rather than a UI Script, so that probably wouldn't work. So, a Gameplay Script using an event was my next thought, but also checking that table, I couldn't find any events that corresponded to a city capture.
I'm at a bit of a loss, so I thought I'd just ask if anyone knew a better way to go about this, or could explain where my logic failed.
I'm pretty clueless when it comes to LUA. Nevertheless, I have made some attempts to figure it out. I first supposed maybe if I could put it into RazeCity.lua somewhere, I could maybe hack that in, but then I looked at this table (which is helpful, thank you Gedemon) and determined that City.RemoveBuilding was a GameplayScript rather than a UI Script, so that probably wouldn't work. So, a Gameplay Script using an event was my next thought, but also checking that table, I couldn't find any events that corresponded to a city capture.
I'm at a bit of a loss, so I thought I'd just ask if anyone knew a better way to go about this, or could explain where my logic failed.