Abandon/Raze City and Buildings

Dancing Hoskuld, I'm not sure if you are aware of this or not, but using this modcomp in multiplayer causes an instant OOS. I'd appreciate it if you could look into this.
 
I realized later that the old file I put up works, but it doesn't correctly show the price you get back for demolishing a building. It keeps saying zero, but when you get the building demolished it will correctly give you your gold back.

I fixed the line in the code so now it works... at least for me.

As for multiplayer... I uh... never played multiplayer... but I'll take a look into it.

Oh yeah, if my old files works perfectly for you (which it shouldn't) this one has nothing new, but a one line fix that corrects an error with showing the gold you get back for demolishing a building.
 

Attachments

  • Abandon City V2.zip
    6.9 KB · Views: 196
Dancing Hoskuld, I'm not sure if you are aware of this or not, but using this modcomp in multiplayer causes an instant OOS. I'd appreciate it if you could look into this.

Ah, but I no longer maintain it :mischief: zeroRPGmaker does. Besides we have a slightly different one in RoM and Zappara and I have different versions also. The OOS stuff is ,I belive, due to how it sends messages and displays screens - I did read something somewhere on it. Zappara and I were discussing some improvements to this anyway but it was very low priority. I will now compare our versions and see if I can remember what you need to do to stop OOS. However don't be surprised if zeroRPGmaker gets there first, I just got given a copy of Dragon Age :)
 
I realized later that the old file I put up works, but it doesn't correctly show the price you get back for demolishing a building. It keeps saying zero, but when you get the building demolished it will correctly give you your gold back.

I fixed the line in the code so now it works... at least for me.

As for multiplayer... I uh... never played multiplayer... but I'll take a look into it.

Oh yeah, if my old files works perfectly for you (which it shouldn't) this one has nothing new, but a one line fix that corrects an error with showing the gold you get back for demolishing a building.

Hmm. I'll give this a try, but I seem to have a slightly different problem.

The modcomp seems to work but I receive 1/3 (I think) of the gold it says I should. Selling a Barracks for example should give me 15 gold according to the pop up but I only receive 5.

\Skodkim
 
MongooseSDK has had an ability to do this that doesn't cause desyncs in Multiplayer since last summer.

I didn't provide the Python code that preserves unreplaceable things (World Wonders, Shrines, Corporate HQs) when razing one of your own cities b/c it's exploitable in its current form, but the city destruction part will work fine.
 
MongooseSDK has had an ability to do this that doesn't cause desyncs in Multiplayer since last summer.

I didn't provide the Python code that preserves unreplaceable things (World Wonders, Shrines, Corporate HQs) when razing one of your own cities b/c it's exploitable in its current form, but the city destruction part will work fine.

Yeah, I know, and I would add it, except it doesn't offer the ability to sell buildings off as well (unless I'm mistaken, in which case, correct me.)
 
No, it doesn't... Originally I had absolutely everything preserved, not just unreplaceable buildings, and also provided a free settler so that it was basically like sliding a dolly underneath the city and wheeling it over to a new location when you blew it up, but we ultimately decided there needed to be some sort of penalty for doing this and the loss of the normal buildings seemed appropriate (along with population, culture level, etc, which admittedly might've been too severe).

That being said... I hadn't thought of being able to sell off normal buildings, which is a great idea! It could be done as an instant refund for a fraction of the total hammer value of all the buildings present, or it could be something where the player can only sell one building per turn and thus has to take a while if he wants to get all the money out of a larger city before razing it... did you have a preference? I'm in the middle of a massive update atm so I'm happy to add this.
 
That being said... I hadn't thought of being able to sell off normal buildings, which is a great idea! It could be done as an instant refund for a fraction of the total hammer value of all the buildings present, or it could be something where the player can only sell one building per turn and thus has to take a while if he wants to get all the money out of a larger city before razing it... did you have a preference? I'm in the middle of a massive update atm so I'm happy to add this.

IMO, the first way would be better, but you could do both, and make them switchable in the global defines... Either way, I'll add it. :p
 
I'm sorry for bumping and old thread.

But I'm confused as to how to install this modification or if it works at all, I just started playing CIV IV so I'm new to this all.

I'm using this file with the unmodded BTS 1.19:

I realized later that the old file I put up works, but it doesn't correctly show the price you get back for demolishing a building. It keeps saying zero, but when you get the building demolished it will correctly give you your gold back.

I fixed the line in the code so now it works... at least for me.

As for multiplayer... I uh... never played multiplayer... but I'll take a look into it.

Oh yeah, if my old files works perfectly for you (which it shouldn't) this one has nothing new, but a one line fix that corrects an error with showing the gold you get back for demolishing a building.

I place the folder in the "mods" folder in the BTS folder and then load it ingame, but it doesn't seem to work, as it was said in this thread that Ctrl + A brings the pop up but nothing happens.

What am I doing wrong?

Sorry for my noobness.
 
Just testing the linked Abandon City V2.zip from post 62 and there appears to be a bug in the python on lines 249 & 250 when determining the settler & worker units to create:

Code:
indexWorker = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_WORKER')
indexSettler = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_SETTLER')

should be

indexWorker = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNITCLASS_WORKER')
indexSettler = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNITCLASS_SETTLER')

The calls to get the civ specific unit always returns 0 otherwise. I set up autolog and got the following results for the before and after code (using India as the civ so the worker unit changes)

Code:
Logging by BUG Mod 4.5 [Build 2245] (BtS 3.13-3.19)
------------------------------------------------
[u][b]Turn 2/500 (3920 BC) [12-Apr-2012 22:47:54][/b][/u]
Worker Index: 182
Settler Index: 180
Unique worker Index: 0
Unique settler Index: 0
Creating worker: 0
Creating settler: 0

Logging by BUG Mod 4.5 [Build 2245] (BtS 3.13-3.19)
------------------------------------------------
[u][b]Turn 2/500 (3920 BC) [12-Apr-2012 22:54:07][/b][/u]
Worker Index: 127
Settler Index: 119
Unique worker Index: 183
Unique settler Index: 180
Creating worker: 183
Creating settler: 180
 
Apologies for the further thread necromancy, but an explanation of why you may wish to make the previous python change for anyone else in the future who looking for things to add to their own mish-mash mod

If the default BTS CIV4UnitInfos & CIV4UnitClassInfos xml files the settler & worker units are at the start after the animals, with no UU before them, so the index in both files is the same: 4 for the settler & 5 for the worker. In this scenario the original python code would give you the expected behaviour...but it is by chance not design. If, as in my mod, the order of the units is changed so the indexes do not match then you will see an issue where an incorrect unit is created.

As a quick test move the UNITCLASS_SETTLER entry to the start of the CIV4UnitClassInfos file and you will probably find yourself creating a wolf rather than a settler when you abandon a city!
 
Just in case anyone cares :)

Mod with updated python code to fix minor bug described above
 

Attachments

  • Abandon City v2.1.zip
    6.5 KB · Views: 187
Top Bottom