[Python/SDK] Cycling through units promotions?

salaminizer

Colorado Internacional
Joined
Aug 12, 2006
Messages
221
Location
Porto Alegre, Brasil
Yeah I'll once again start a thread with "I don't know if it's the right way" but whatever. I'm advancing my idea of "attachable" units and I thought about doing it with cargo transport - when a unit is loaded, its promotions are added to the transport, and when it's unloaded, the same promotions are removed (yeah, maybe I'll have some problems with conflicting promotions but it probably can be handled later).

I've added two events, onUnitLoad and onUnitUnload so I can do it in python. from what I've seen, there isn't a way to iterate through a unit's promotions, there's no function returning the promotion's array (if I understood correctly, that's how it works) or anything like that. Am I right?

And apparently every promotion is allocated to its index value, so a simple FOR from 0 to the length of the array wouldn't work. Is there another way to iterate through the promotion's array?
 
just thought I should say that it worked, at first I was confused by your post but then TOTAL made sense. still, I hardcoded it in the SDK because I was unable to solve some problems while passing the units to new custom events, onUnitLoad and onUnitUnload. :goodjob:
 
Top Bottom