Avatar Of Woe
Chieftain
- Joined
- Nov 20, 2011
- Messages
- 5
Oh wise and great masters of Civ4 modding, help this humble modder.
I made a spell that summons a worker unit, but the summoned unit is given UNITAI_ATTACK, so he loses all the nice automation that workers should have (RouteTo and such).
So I figured I could use onUnitCreated to give the right AI to the little guy. Sounds easy, right? I thought so, too, once.
So my question: what is the code that would make this work?
Here's what I've been trying so far (unsuccessfully):
Any advice?
I made a spell that summons a worker unit, but the summoned unit is given UNITAI_ATTACK, so he loses all the nice automation that workers should have (RouteTo and such).
So I figured I could use onUnitCreated to give the right AI to the little guy. Sounds easy, right? I thought so, too, once.
So my question: what is the code that would make this work?
Here's what I've been trying so far (unsuccessfully):
Code:
from CvPythonExtensions import *
from BasicFunctions import *
import PyHelpers
gc = CyGlobalContext()
def onUnitCreated(self, argsList):
pUnit = argsList[1]
if pUnit.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_WORKER"):
pUnit.setUnitAIType(UnitAITypes.UNITAI_WORKER)
Any advice?