Way Of
    The Wombat
Mod_* Functions


7.0 Mod_* Functions
7.1 Broken Mod_* Functions
7.0 Mod_* Functions

The wierdest of all SLIC, these are functions that do not have to be triggered.

There are two ways to think of this, either they apply all the time in the game, setting "ground rules", or that they call themselves at the correct times. Either way, you set them up, and the game calls them.

There are theoretically eight, but only four have obvious effects. These are:

int_f mod_CanPlayerHaveAdvance (int_t thePlayer, int_t theAdvance) { // code } int_f mod_CanCityBuildBuilding (city_t theCity, int_t theBuilding) { // code } int_f mod_CanCityBuildUnit (city_t theCity, int_t theUnit) { // code } int_f mod_CanCityBuildWonder (city_t theCity, int_t theWonder) { // code }
They do exactly as they suggest, they limit which techs, wonders, buildings and units are available to players and cities.

You can use code (mostly using 'if' statements I should think) to limit to where the rules apply. As they are int_f functions, you need only add certain constraints, and end each block in a "return 1" or "return 0" to indicate a "yes" to the function, or a "no".

If in doubt, copy a known format. The Alexander the Great scenario has a basic example of limitations to a tech tree, and the MedMod2 restricts the use of some units.

Basically all the functions go the same way:

int_f mod_CanCityBuildBuilding (city_t theCity, int_t theBuilding) { int_t tmpBuilding; tmpBuilding = theBuilding; city[0] = theCity; if(tmpBuilding == BuildingDB(IMPROVE_SILO)){ if(g.year >= 48){ return 1; } else { return 0; } } elseif(tmpBuilding == BuildingDB(IMPROVE_CITY_WALL)){ if(IsHumanPlayer(city[0].owner)){ return 0; } else { return 1; } } else { return 1; } }
Start with deciding which building you want to limit the use of, then decide who you are limiting the building to or from, and why. For example, above, I have only allowed the building of Silos after year 48, I have prevented the human from building city walls, and allowed everything else.
7.1 Broken Mod_* Functions
If anyone wants to experiment with the other four, they are:

int_f mod_CityHappiness int_f mod_UnitAttack int_f mod_UnitRangedAttack int_f mod_UnitDefense
After writing this document the first time, some extensive tests were conducted by myself and others on UnitAttack, UnitRangedAttack and UnitDefense. It seems they fire properly at every round of battle, but as the others, the only possible returns on the function is 1 and 0. Other values count as a 1. Setting the UnitAttack to return 1 for instance, and the battle will take place normally. Returning 0 will simply prevent the unit from dealing attack damage. There is no continuum to unit attacks as we had hoped, for allowing further contol of unit stats within the game.

mod_CityHappiness I believe remains untested. If it is the same as the others, a 1 would return normal happiness, and a 0 would return a rather serious revolt...

back close forward