Zebra 9
Emperor
This allows any person who has a knowledge of Civ Python to add new actions that can range from ranged bombardment to planting forests.
Limitations include units that use all of their moves don't end their turn and there is no AI.
I have included a sample that allows any worker (including fast workers) to plant forests and gives seige units the ability to bombard a 2 plot range damaging any enemy unit on the targeted plot.
Some of the code I copied from the spellDemo MOD COMP Thingy.
Usage Tutorial
Download Here
Enjoy
Limitations include units that use all of their moves don't end their turn and there is no AI.

I have included a sample that allows any worker (including fast workers) to plant forests and gives seige units the ability to bombard a 2 plot range damaging any enemy unit on the targeted plot.
Some of the code I copied from the spellDemo MOD COMP Thingy.
Usage Tutorial

Spoiler Usage :
The first step in adding an action using zActions is desiding what the action will be called, what it will do, when it will be able to be preformed, and what units can use it.
Once you have all the information above we need to convert it into python in the form of functions. Now because zActions requires you to create 6 functions I have created a system by which we can list all 6, and some other information, in one spot. The code for this goes in zActionsActions.py, so example code is blow:
Now the line that reads "Rand Bombard" tells python that the action is to be called Rand Bombard[/] (I couldn't think of anything else).
Now the line that reads "art/interface/buttons/actions/bombard.dds" tells python what button to use for the action.
Now the line that reads getDistRangeFuncSquare(2) tells python how to find the plots that can be bombarded, this code tells python that the most distant plot can not be more than 2 plots away from the active unit.
Now the line that reads canBombard tells python if the action can be preformed, it calls a function in zActionsFuncs.py.
Now the line that reads canEverBombard tells python if the active unit can preform the action, it calls a function in zActionsFuncs.py.
Now the line that reads canBombardOnPlot tells python if the action can be preform on a certain plot, it calls a function in zActionsFuncs.py.
Now the line that reads shouldBombard tells python if the action is recommended, it calls a function in zActionsFuncs.py.
Now the line that reads bombard tells python how to do the action, it calls a function in zActionsFuncs.py.
Next we need to create the nessicary functions in zActionsFuncs.py. First we will make the function canBombard, it looks like:
Then we need to make canEverBombard, this function looks like:
Next let's create canBombardOnPlot:
We will next make shouldBombard, it looks like:
Lastly, but most important, we will make bombard, it looks like:
All of the arguments for the functions are pretty much self explanitory, but so you know action is an instance of the action that is currently being worked with. Now because zActions require a more in depth knowledge I havn't gone indepth explaining how everything works. This is just supposed to show the basic steps and give some information on how zActions works.
Once you have all the information above we need to convert it into python in the form of functions. Now because zActions requires you to create 6 functions I have created a system by which we can list all 6, and some other information, in one spot. The code for this goes in zActionsActions.py, so example code is blow:
Code:
zActionInfos.addZAction (
"Bombard City", ## Name
"art/interface/buttons/actions/bombard.dds", ## Button
getDistRangeFuncSquare(2), ## Plots it can hit
canBombard, ## Tells if the action can be done
canEverBombard, ## Tells if it can do action now
canBombardOnPlot, ## Tells if action can be done on plot
shouldBombard, ## Tells if action is recommended
bombard, ## Does Action
2 ## Range
)
Now the line that reads "art/interface/buttons/actions/bombard.dds" tells python what button to use for the action.
Now the line that reads getDistRangeFuncSquare(2) tells python how to find the plots that can be bombarded, this code tells python that the most distant plot can not be more than 2 plots away from the active unit.
Now the line that reads canBombard tells python if the action can be preformed, it calls a function in zActionsFuncs.py.
Now the line that reads canEverBombard tells python if the active unit can preform the action, it calls a function in zActionsFuncs.py.
Now the line that reads canBombardOnPlot tells python if the action can be preform on a certain plot, it calls a function in zActionsFuncs.py.
Now the line that reads shouldBombard tells python if the action is recommended, it calls a function in zActionsFuncs.py.
Now the line that reads bombard tells python how to do the action, it calls a function in zActionsFuncs.py.
Next we need to create the nessicary functions in zActionsFuncs.py. First we will make the function canBombard, it looks like:
Code:
def canBombard(unit, action):
if unit.getMoves() == unit.baseMoves() * 60:
return False
return True
Code:
def canEverBombard(unit, action):
plot = unit.plot()
if unit.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_SIEGE"):
return True
return False
Code:
def canBombardOnPlot(unit, plot, action):
if plot.getNumDefenders(-1) > 0:
if plot.getBestDefender(-1, unit.getOwner(), unit, True, True, True).isNone() == False:
return True
return False
Code:
def shouldBombard(unit, action):
return False
Code:
def bombard(unit, plot, action):
yUnit = plot.getBestDefender(-1, unit.getOwner(), unit, True, True, True)
rand = CyGame().getSorenRandNum(90, 'Zebra9') + 10
dmg = yUnit.getDamage()
yUnit.setDamage(dmg + rand, -1)
unit.setMoves(unit.getMoves() + 60)
unit.setMadeAttack(True)
Download Here
Enjoy
