Abandon/Raze City and Buildings

modifieda,

thanks for the response, i checked your mod and i noticed that there isnt a "revdcm" in it so the civutils.py wasnt in it, and that you removed the customereventsmanager.py and input the abadoncityraze info in eventmanager.py... is that how you did it? lol
sorry this just seems so hopless garrr..
when you merged them was there a specific place that you altered in order to get it to work besides the variable names? ps which variable names??

thanks!
 
any otherideas??

Here is the bare bones version of the Abandon Raze City Mod. All python modifications are clearly identified in the CvEventManager.py file. Use "Control > Shift > A" to bring up the popup.

Enjoy!

Orion Veteran :cool:
 

Attachments

  • Abandon Raze City.zip
    10.5 KB · Views: 179
hey it worked!!! thanks alot, that basic version really came out well especially since it was all outlined =)
thanks!:goodjob:
 
Just tried loading this up but I have no idea what to do to abandon/raze a cit.

Any help?

\Skodkim

EDIT: I found out. Ctrl+a
 
Here is a version of this mod which works with BUG 3.6. It includes a text file documenting how to incorporate it in your BUG based mod. For those playing Rise of Mankind, I am posting a version that works with it on the RoM forum. It has one character different because RoM has its units defined in a different order. :)

Spoiler :
Abandon City Demolish Building mod for BUG version 3.6

Files:-

Assets\Config\Abandon City Mod.xml - defines the mod to BUG
Assets\Python\AbandonCityEventmanager.py - the code :)
Assets\xml\text\Abandon_City_CIV4GameText.xml - the language text for the pop up screen
READ ME FILES\AbandonCity ReadMe.txt - this document

-----------------------------------------------

To use:- Ctrl-A with the city screen open.

This brings up a popup with all the buildings in the city with "abandon city" as teh last building. Select what you want demolished.

-----------------------------------------

Changes from previous versions:-

Made to work in BUG. Theoretically if you have a BUG built mod you just need to load this mod in your init.xml file in Assets\Config.

Now calls the "cityRazed" event.

I have not done the language translations but the mod will use them if someone else can come up with some or all of the translation text :)

---------------------------------------------
To get this working in any mod you need to:-
1. put
<load mod="Abandon City Mod"/>
in the init.xml in the Python/Config directory

2. If you find that abandoning a city of population greater than 4 does not give you one worker for every whole 5 population but some other unit is generated, then you will need to change the number on the line of code

Player.initUnit(5, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)

to the index of the worker unit in your mods unitinfos.xml




Note that I have not done the translations to non-English but it should support them if they are added to the xml\text file.
 
One of the things I was going to fix but do not have the knowledge to (yet) is replace the hard coded "5" in the code with the the index thingy that points to workers in the list of units. In standard BtS 5 is the number that points to workers but in Rise of Mankind for example, 5 points to wolves and 15 points to workers. I found the correct number by going into world builder mode looking at the units you can place and counting the icons, starting at zero I think, until I got to the worker icon :)
 
All I know is that I had to change the hard coded "5" on line 125
Code:
Player.initUnit(5, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
to "15" to get workers in Rise of Mankind.

And yes in RoM UNIT_WORKER is the 16th unitinfo in the unitinfos xml. (15=16-1 because the index starts at zero not one.) In unmoded BtS it is the sixth which gives it an index of five.
 
You could also use python function to find out the ID number of specific unit type - I think few examples could be found from python files (don't remember from memory the exact function).
 
In the original and this version of the Abandon City Demolish Building mod if you abandon a city you get 1 worker for each five population that the city had. That is all.

In testing the merge of this mod just abandon a city of size > 5 and see what unit is put in its place. If it is a worker then you know you don't have to change the the number in the code.

Perhaps I should have said in my doco something like:-

To merge this with your BUG 3.6 ready mod add <load mod="Abandon City Mod"/> to the init.xml.

If you find that abandoning a city of population greater than 4 does not give you one worker for every whole 5 population but some other unit is generated, then you will need to change the number on the line of code
Code:
Player.initUnit(5, ix, iy, UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
to the index of the worker unit in your mods unitinfos.xml
 
As I was working on fixing that hard coded number problem (done but not posted here) I found that I had changed the code back to just producing workers. I have figured out how I can extend this mod further and was wondering if such things would be useful out there. The stuff I am working on:-

1. one settler per 5 population plus 1 or 2 workers for the left over population.
2. if civ has UU worker or settler produce them instead.
3. if mod has upgrades to worker or settler and the player has the techs needed then produce upgrade instead.
4. sell for money a la Civ 2 and 3 or demolish penalty cost both based on :hammers: cost since it costs to reduce a building to rubble. Then there are the problems associated with Wonders, national wonders and team projects.

Since my version is BUG compatible it should be fairly easy to set up an .INI file and maybe XML to parameterise some of these options.
 
As I was working on fixing that hard coded number problem (done but not posted here) I found that I had changed the code back to just producing workers. I have figured out how I can extend this mod further and was wondering if such things would be useful out there. The stuff I am working on:-

1. one settler per 5 population plus 1 or 2 workers for the left over population.
2. if civ has UU worker or settler produce them instead.
3. if mod has upgrades to worker or settler and the player has the techs needed then produce upgrade instead.
4. sell for money a la Civ 2 and 3 or demolish penalty cost both based on :hammers: cost since it costs to reduce a building to rubble. Then there are the problems associated with Wonders, national wonders and team projects.

Since my version is BUG compatible it should be fairly easy to set up an .INI file and maybe XML to parameterise some of these options.

Seems very interesting :goodjob:

\Skodkim
 
I am really confused on how to install this mod. Other mods I add to the mod folder, but the README states to place the this in id Meier's Civilization 4\CustomAssets\python\ folder.

Inside the zip there is an Assets folder and an ini file on the same level does this entire tree need to be placed in the above folder? An earlier post stated moving just the .py files and the entrypoints folder into the above directory, but then where does the ,ini file go?

Any help would be great. Thanks.
 
I am really confused on how to install this mod. Other mods I add to the mod folder, but the README states to place the this in id Meier's Civilization 4\CustomAssets\python\ folder.

Inside the zip there is an Assets folder and an ini file on the same level does this entire tree need to be placed in the above folder? An earlier post stated moving just the .py files and the entrypoints folder into the above directory, but then where does the ,ini file go?

Any help would be great. Thanks.

This is a new version made especially for working with BUG this means that things are different. There is a need for a small amount of editing of the BUG initialisation XML file to get it to work with a mod.

As the readme states most of the stuff goes in the Assets not CustomAssets folder. There is no ini file - I have not done the changes which would require one :).

The only problem is that you need to add this mod to your init.xml file otherwise BUG does not know it exists so the code will not be activated.

So to get this working

Step 1. copy the contents of the zip file into your mod directory
Step 2. edit init.xml which is found in the directory Assets/Python/Config. I put the line just after all the other load statements.

If the init.xml file does not exist then you are not using BUG and this mod won't work.
 
Thanks. I downloaded and installed BUG 3.6 and was able to get it to work. I also downloded BAT 1.1 which has BUG 3.5. I tried to get it to work with that, but it does not work. It reported some XML errors on the main screen. Is there a version for BUG 3.5?
 
No version for BUG 3.5. I had an earlier version which did not use BUG at all but that was basically the same as what was posted earlier on this thread.
 
Here is a minor upgrade to the Abandon City mod for BUG 3.6.

Fixes the hard coded worker problem.
Abandoning the city produces workers and maybe settlers - variables for this are in the Python code for modders.
Now selling buildings rather than demolishing them. Costs based on game speed.
Selling any religious building now causes unhappiness.
Can't abandon last city.
Proactive fix for CTD bug if you try and call this on your only city which has no buildings :)

Still working on the free building problem. See doco in READ ME directory for design decisions made.
 
Top Bottom