Python Functions attached to missions?

cfkane

Emperor
Joined
Feb 7, 2006
Messages
1,196
A while back The_J released his respawn python function, which lets units be rebuilt if they die in combat. I've been wondering if this function could be attached to Great People, so they could be reborn after being consumed by a specific action such as researching a technology or completing a trade mission.

How would this be done?
 
Don't rush, don't rush, i would have started a thread in the next days.


Okay, what's the problem atm:

PHP:
	def onSelectionGroupPushMission(self, argsList):
		'selection group mission'
		eOwner = argsList[0]
		eMission = argsList[1]
		iNumUnits = argsList[2]
		listUnitIds = argsList[3]

The definition of onSelectionGroupPushMission gives me the performed mission with a defined value, also the owner.
The problem is listUnitIds = argsList[3], which doesn't give me the real ID of a unit, it's an unique game-internal identifier.
Trying
PHP:
iUnit = listUnitIds[0]
[...]
unit = gc.getUnitInfo(iUnit)

gives me "None", so the problem is, that i can't get from this ID to the unit and unitclass to "revive" it.
I could get the x and y coordinates, and then guess, which unit on this plot did the action, but this would cause problems, if i have more units on this plot, which can do the mission, than numbers of units in the unitlist.

I would need some suggestions :(.
 
Back
Top Bottom