Advertisement
Civilization Fanatics' Center  

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.

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python

Notices

Reply
 
Thread Tools
Old Dec 28, 2008, 02:37 PM   #1
salaminizer
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!
salaminizer is offline   Reply With Quote
Old Dec 28, 2008, 03:39 PM   #2
xienwolf
Deity
 
xienwolf's Avatar
 
Join Date: Oct 2007
Location: Location! Location!
Posts: 10,589
Images: 8
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.
xienwolf is offline   Reply With Quote
Old Jan 05, 2009, 09:11 AM   #3
salaminizer
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!
salaminizer is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - SDK/Python > [Python/SDK] Cycling through units promotions?

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


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


Advertisement

All times are GMT -6. The time now is 06:47 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR