| 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 |
|
Secular Humanist
Join Date: Feb 2010
Location: Alberta, Canada
Posts: 1,675
|
How would you, for example, get all cities within (59, 48) and (66, 54) to receive 3 units (Musketman, Rifleman, Infantry, Marine, whichever is the most modern the civ can build) upon completion of a specific building? (Let's say "BUILDING_WALKÜRE" or whatever it would be called in python)
If I can't remove the German UP, I'll improve it |
|
|
|
|
|
#2 |
|
"Hit It"
Join Date: Dec 2009
Location: Sweden
Posts: 5,530
|
First of all, you launch your code with the onBuildingBuilt callup in CvEventManager. The second argsList value is the building type, so the conditional statement would read:
Code:
if argsList[1] == buildingTypes.BUILDING_WALKÜRE: Code:
for iX in range(59, 66+1):
for iY in range(48, 54+1):
Code:
pPlot = gc.getMap().plot(iX, iY) if pPlot.isCity(): Code:
pCity = pPlot.getPlotCity() eUnitType = pCity.getConscriptionUnit() Code:
player = PyHelpers.PyPlayer(ePlayer) player.initUnit(eUnitType, iX, iY, 3) To get the player ID you can use the line: Code:
ePlayer = argsList[0].getOwner()
__________________
How to Make a Python Mod - Python modding tutorial CivIV Python Class Reference - modding Python API How to Think Like a Computer Scientist - online Python textbook CivPlayer - Python scripting tool Spoiler:
|
|
|
|
|
|
#3 |
|
Secular Humanist
Join Date: Feb 2010
Location: Alberta, Canada
Posts: 1,675
|
Where would I type all that? Can it just be anywhere? (But in order, of course)
|
|
|
|
|
|
#4 |
|
Say No 2 Net Validations
![]() ![]() |
In Assets\Python\CvEventManager.py, one example:
PHP Code:
|
|
|
|
|
|
#5 | |
|
"Hit It"
Join Date: Dec 2009
Location: Sweden
Posts: 5,530
|
Quote:
So I intentionally didn't do your mod for you, as then you wouldn't have to learn anything. Just tell me if you're not interested and I can do the whole thing to your specifications. Then you wouldn't have to bother with it. And most of these things are explained in the tutorial.
__________________
How to Make a Python Mod - Python modding tutorial CivIV Python Class Reference - modding Python API How to Think Like a Computer Scientist - online Python textbook CivPlayer - Python scripting tool Spoiler:
Last edited by Baldyr; Aug 15, 2010 at 05:04 AM. |
|
|
|
|
|
|
#6 |
|
"Hit It"
Join Date: Dec 2009
Location: Sweden
Posts: 5,530
|
Also, I now realize you're mod-modding RFC, right?
Then you would add the code in the UniquePowers module with its own function definition: Code:
def germanUP(self, argsList): This function (really a method of the UniquePowers class, don't ask) would then be called from the onBuildingBuilt callup in CvRFCEventHandler module, like: Code:
self.up.germanUP(argsList)
__________________
How to Make a Python Mod - Python modding tutorial CivIV Python Class Reference - modding Python API How to Think Like a Computer Scientist - online Python textbook CivPlayer - Python scripting tool Spoiler:
|
|
|
|
![]() |
| Bookmarks |
|
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| out dated units cant be built?? | Vietcong | Civ4 - General Discussions | 11 | Jul 26, 2006 01:36 PM |
| Units I never built | kokomo | Civ4 - General Discussions | 63 | May 30, 2006 02:17 AM |
| Any units you've never built? | madmaven | Civ4 - General Discussions | 58 | Dec 14, 2005 12:27 PM |
| Units that can't be Built, but CAN be Upgraded to | Mr. Do | Civ3 - Creation & Customization | 29 | Jul 19, 2004 06:47 AM |