| General | Hosted Sites | Civ5 | CivRev | Civ4Col | Civ4 | Civ3 | Civ2 | Civ1 | Misc | Marketplace |
![]() |
|
|
Welcome to Civilization Fanatics' Center. You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support. |
|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Colorado Internacional
Join Date: Aug 2006
Location: Porto Alegre, Brasil
Posts: 220
|
[Python/SDK] Cycling through units promotions?
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?
__________________
Zing! |
|
|
|
|
|
#2 |
|
Deity
|
You are on the right track, you do a loop from 0 to the total Number of Promotions, and for each number in the loop you check the unit to ask if he has that promotion.
__________________
Fall from Heaven: - Random Stories and Fragments - Trivia Thread - The Complete FfH Manual - Lore Compendium - The Erebus Project - #erebus - The Mega Story General Information: Mod Details, World Information Resource, Easter Eggs, Quick-Guide, Empyrean/Esus & Guilds Information, The Other Religions, Mana Chart, Religous ThemesSpecific Details: FfH Wikia, FfH Wiki, FF Wiki, World Spells, FoL Guide, Council of Esus Guide, Magic Comparison, Potential Fix for MAF issues |
|
|
|
|
|
#3 |
|
Colorado Internacional
Join Date: Aug 2006
Location: Porto Alegre, Brasil
Posts: 220
|
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.
__________________
Zing! |
|
|
|
![]() |
| Bookmarks |
|
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SDK] Combat Engineers (New Promotions and Game Mechanics!) | Kailric | Civ4 - Mod Components | 27 | Mar 14, 2013 02:11 PM |
| Tsentom1 Python Promotions | tsentom1 | Civ4 - Mod Components | 63 | Mar 16, 2009 11:26 AM |
| Manually cycling through all units | maitrebart | Civ4 - General Discussions | 1 | Dec 15, 2007 08:55 PM |
| Help needed about cities (SDK, python & SDK+python) | Fabrysse | Civ4 - SDK/Python | 3 | Nov 05, 2007 01:31 AM |
| [REFERENCE] [SDK Tut] Calling from the SDK a custom python modules function. | Gerikes | Civ4 - Modding Tutorials & Reference | 13 | Sep 08, 2006 10:48 AM |