[Python Q] Limiting Teach Spellcasting targets?

LightofAbraxas

Chieftain
Joined
Sep 9, 2011
Messages
30
So, I've been messing around with the Amurite faction quite a bit lately, and I've been trying (unsuccessfully) to prevent Govannon's Teach Spellcasting ability from giving arcane spells to disciple units. I'm assuming that this is done in the same way that prevents animals and birds from being targets, but I can't figure out how to exclude disciple class units specifically.

Any help from someone more experienced would be greatly appreciated!
 
Look at the def spellTeachSpellcasting(caster) function in python\entrypoints\CvSpellInterface.py (I think you already got to that point).
At the beginning, the iAnimal variable is defined:
Code:
iAnimal = gc.getInfoTypeForString('UNITCOMBAT_ANIMAL')
"Animal" is an unitcombat, so you can do the same with disciple units:
Code:
iDisciple = gc.getInfoTypeForString('UNITCOMBAT_DISCIPLE')

The check is at the end of the function:
Code:
if pUnit.getUnitCombatType() != iAnimal:
You can change it (after defining iDisciple) to
Code:
if pUnit.getUnitCombatType() != iAnimal and pUnit.getUnitCombatType() != iDisciple:
to exclude Disciple units also.

Hope that helps :)
 
You should also make the same change to def reqTeachSpellcasting(caster):, unless you still want to be able to cast the spell (and have the AI waste its chances to cast the spell too) while it is not actually able to do anything.
 
Top Bottom