BtS MODing Info

Zebra 9

Emperor
Joined
May 17, 2006
Messages
1,554
Location
Middle of Cyberspace
In this thread I will list new MODing info for BtS such as new functions and things of importance to MODers. Feel free to post your findings.

Multi-Buildings:
To start with there is a new XML Global Define called CITY_MAX_NUM_BUILDINGS. This new define allows you to limit how many buildings a city can build. So let's say you set it to 5. Now all of your cities can build 5 of any building. Now for the really cool part, if you have 5 court houses in the city it should give you the effects of 5 court houses not 1. :eek:

Now because of this there is no longer a setHasRealBuilding or a isHasRealBuilding function. Instead they have setNumRealBuildings and getNumRealBuildings. These functions both take the building type index and setNumRealBuildings takes an integer value as the second value, this second value tells the game that you want so many buildings. So code like this:
Code:
[FONT=Courier New]pCity.setNumRealBuildings(gc.getInfoTypeForString("BUILDING_COURTHOUSE", 5)[/FONT]
will put five 5 court houses in the city. Again all 5 are fully operational and working.:eek:

New Civs:
Now we can create a new civ with the CyGame().addPlayer function! This function takes 4 arguments. They are, eNewPlayer, eNewTeam ( a team type index), eLeader (a leader type index, and eCiv (a civ type index). As far as I can tell you could use this function to change a players civ, leader, and team by setting eNewPlayer to a value that is equal to the index of the player you want to change. Here is some code to show what I mean:
Code:
iPlayer = 0	## In single player this is the human player
iCiv = CyGlobalContext().getInfoTypeForString("CIVILIZATION_AMERICA")
iLeader = CyGlobalContext().getInfoTypeForString("LEADER_WASHINGTON")
iTeam = 0

CyGame().addPlayer(iPlayer, iTeam, iLeader, iCiv)
Now this should set playere 0 to team 0, with Washington as the leader of America. Now a few problems with this are that it will change the player color to an available color, so if the Americans are already in the game the new team will not get the American blue. Also I believe that it will change the player from human to AI (that could be bad).

Creating New Units:
I noticed while helping out with some stuff that the code to create a unit in python has been changed. It used to be:
Code:
CyUnit initUnit(UnitType iIndex, INT iX, INT iY, UnitAIType eUnitAI)
but has now been changed to
Code:
CyUnit initUnit(UnitType iIndex, INT iX, INT iY, UnitAIType eUnitAI, DirectionType eDirection)
I'm assuming the direction type was added for the After World scenario.
Oh, so everyone knows putting DirectionTypes.DIRECTION_SOUT in the eDirection spot works. And if anyone cares the direction types are:
DirectionTypes.NO_DIRECTION
DirectionTypes.DIRECTION_NORTH
DirectionTypes.DIRECTION_NORTHEAST
DirectionTypes.DIRECTION_EAST
DirectionTypes.DIRECTION_SOUTHEAST
DirectionTypes.DIRECTION_SOUTH
DirectionTypes.DIRECTION_SOUTHWEST
DirectionTypes.DIRECTION_WEST
DirectionTypes.DIRECTION_NORTHWEST
DirectionTypes.NUM_DIRECTION_TYPES

Python API for BtS is here. :D
 
So that's how they did the multiple building thing in Final Frontier. Sweet!
 
Which tidbit would that be? (it's helpful if you tell us what you've changed somewhere ;) )
 
I'm hoping to have that API done by friday next week.
Yea if I quite playing the game I might be able to finish it. :D
 
Back
Top Bottom