talchas
Prince
- Joined
- Jan 3, 2006
- Messages
- 428
Alright, here is the new version of my action buttons utilities (old version, which uses python only is here) that uses the SDK. This means that there are no more problems due to negative action numbers, and there are tooltips. The mod is runnable as it is as a demo where all units that can attack and have combat 1 get a healing ability.
As before the AI does not use this.
The files:
Civ4-talchas-AB.xls - an excel file that outputs the action buttons xml file.
C++ source - the C++ source files. To rebuild the new dll, copy these on top of a copy of the sdk files. It also includes the Code::Blocks project file I am using
Assets\Python\EntryPoints\CvABInterface.py - A new entry point for this utility. You should open this up and change the "import MyMod" at the top to something for your mod.
Assets/Python/MyMod.py - the python file containing all of the functions used by the action buttons. This file could be named anything, or split into many different files, but all of the files would have to be imported in CvABInterface.py.
Assets/XML/Units/CIV4ActionButtonInfos.xml - this is where all of the actions are defined. There are explanations of the tags in the excel file.
Assets/CvGameCoreDLL.dll - the modified dll file.
To use:
File at http://members.aol.com/ben77/ActionButtons2.zip
As before the AI does not use this.
The files:
Civ4-talchas-AB.xls - an excel file that outputs the action buttons xml file.
C++ source - the C++ source files. To rebuild the new dll, copy these on top of a copy of the sdk files. It also includes the Code::Blocks project file I am using
Assets\Python\EntryPoints\CvABInterface.py - A new entry point for this utility. You should open this up and change the "import MyMod" at the top to something for your mod.
Assets/Python/MyMod.py - the python file containing all of the functions used by the action buttons. This file could be named anything, or split into many different files, but all of the files would have to be imported in CvABInterface.py.
Assets/XML/Units/CIV4ActionButtonInfos.xml - this is where all of the actions are defined. There are explanations of the tags in the excel file.
Assets/CvGameCoreDLL.dll - the modified dll file.
To use:
- Copy all of the Assets/* files into your mod's Assets folder.
- Rename MyMod.py to whatever you want and change CvABInterface's import statement to import the new name.
- Open up the renamed MyMod.py and add 2 functions for each action you want. One function should return true when you can use the action. The other should do whatever the action is supposed to do. See the note in MyMod.py about bTestVisible, basically when bTestVisible is true, the game is testing whether or not the button should appear at all.
- Open up CIV4ActionButtonInfos.xml or the excel file. If you use the excel file, reimport the CIV4ActionButtonInfos.xml from wherever your mod is.
- Add entries for each action. PyRequirement should call the function you defined previously for this action that returns true when you can do this action. There are three variables you can use here - pUnit, which is a reference to the selected unit, eAction, which is the number of the action, cooresponding to gc.getActionButtonInfo(), and bTestVisible, which I discussed before. PyResult should call the function that does whatever you want the button to do.
- If you are using the the excel file, export it.
- Run Civ4.
File at http://members.aol.com/ben77/ActionButtons2.zip