Simple way of identifying a captured unit when captured?

Pazyryk

Deity
Joined
Jun 13, 2008
Messages
3,584
I was hoping for a simple Lua solution for this, but haven't thought of one yet. I need this for both worker captures (from worker or settler) and for military units captured with a "Slave Maker" promotion (has Capture tag set). Both are part of a slavery system available with different slavery policies.

I could give each unit a player-specific promotion and then test for that whenever SerialEventUnitCreated fires (I think it will fire for a captured unit). Unfortunately, a newly built unit won't look any different, except that it happens to be in a city (could that ever be the case for a captured unit?). Can anyone think of a more elegant solution?


Edit: Actually, do promotions or even experience transfer on unit capture? I assumed so as I wrote the question above, but now I'm not so sure. If not, that would be an easy solution for me. (If you didn't know, civilians can have promotions and even experience, though the UI won't show the latter without modification.)
 
It's not on the wiki page, but there is a GetOriginalOwner() method on the Unit object
 
Ah! Thanks. It is there in DonQuiche's wiki, but I didn't think to look for such a method. The only other thing I need is something that fires on capture. I'd expect that SerialEventUnitCreated does this but I'll have to test...
 
Back
Top Bottom