| 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 |
|
Prince
Join Date: Feb 2006
Posts: 451
|
Help out a python newbie?
Ok, what I'm trying to do here is make an event that removes a random religion from all cities. The event uses this python function:
Code:
def doObsoleteReligion1(argsList): kTriggeredData = argsList[0] iReligion = kTriggeredData.eReligion gc.getGame( ).clearHolyCity( iReligion ) for iPlayer in range(gc.getGame( ).getNumCivPlayers()): pPlayer = gc.getPlayer(iPlayer) for iCity in range(pPlayer.getNumCities()): pCity = pPlayer.getCity(iCity) pCity.setHasReligion(iReligion, 0, 0, 0) |
|
|
|
|
|
#2 |
|
Emperor
Join Date: Sep 2005
Location: a puddle
Posts: 1,206
|
Try adding a debug statement to make sure it actually fired, something like:
CyInterface().addImmediateMessage("religion picked: %s"%(iReligion,"") This will go to the screen only with all the other messages, so don't miss it! And then look in PythonErr.log and see if there is a problem. Last edited by primordial stew; Jan 22, 2008 at 12:21 AM. |
|
|
|
|
|
#3 |
|
Event Master
Join Date: Aug 2007
Location: 2 food, 2 commerce plot in Utah
Posts: 89
|
Hmm, the placement of the line: gc.getGame().clearHolyCity(iReligion) has me worried. I'm not certain but I think that bugger needs to be told which holy city to clear of iReligion. I don't think it hones in on the holy city of type iReligion.
Notice that in the Gods of Old mod, the line preceding that one is: if pCity.isHolyCityByType( iReligionLoop ): Now, why would it be asking whether that pCity was the holy city of that type if it was just going to find it with the clearHolyCity thingi? Not only did you not specify which holy city to clear, you didn't really specify a city. There might be more, but I'll have to think about it. EDIT: Why did you use that line in the first place? Is it needed? If you are cycling through all of the cities anyway, you shouldn't need to specifically target the holy city beforehand, should you? Perhaps you are confusing the python as much as you are me. In the which case, just remove that line and you might be better. |
|
|
|
|
|
#4 | |
|
Prince
Join Date: Feb 2006
Posts: 451
|
Quote:
|
|
|
|
|
|
|
#5 |
|
Event Master
Join Date: Aug 2007
Location: 2 food, 2 commerce plot in Utah
Posts: 89
|
Wait, I think you're right. It does take something different to get rid of holy cities.
Another thing, I may just be a total idiot, but is iReligion defined correctly? (I'll edit this after I check.) EDIT: It is entirely possible that I know a whole lot less about Python than you do, but shouldn't it be: iReligion = gc.getReligionInfo(kTriggeredData.eReligion) EDIT2: Gah, I just realized I've been thinking in terms of event modding. *sigh* I should just leave you alone. EDIT3: On second thought, maybe I should just learn to read. This is an event, so yes, I think iReligion needs to be defined like above. Last edited by ddrekins; Jan 22, 2008 at 04:59 PM. |
|
|
|
|
|
#6 |
|
Prince
Join Date: Feb 2006
Posts: 451
|
Well, having tried the ideas in this thread and seeing no change whatsoever (most importantly, primordial stew's Immediate Message thing), I am forced to conclude that the python function isn't being called in the first place. This is how the event should be done, right?
Code:
<EventInfo> <Type>EVENT_OBSOLETE_RELIGION_1</Type> <Description>They will be sorely missed</Description> <LocalInfoText/> <WorldNewsTexts/> <OtherPlayerPopup/> <QuestFailText/> <bQuest>0</bQuest> <bGlobal>0</bGlobal> <bTeam>0</bTeam> <bPickCity>0</bPickCity> <bPickOtherPlayerCity>0</bPickOtherPlayerCity> <bDeclareWar>0</bDeclareWar> <iGold>0</iGold> <bGoldToPlayer>0</bGoldToPlayer> <iRandomGold>0</iRandomGold> <iCulture>0</iCulture> <iEspionagePoints>0</iEspionagePoints> <bGoldenAge>0</bGoldenAge> <iFreeUnitSupport>0</iFreeUnitSupport> <iInflationMod>0</iInflationMod> <iSpaceProductionMod>0</iSpaceProductionMod> <Tech>NONE</Tech> <TechFlavors/> <iTechPercent>0</iTechPercent> <iTechCostPercent>0</iTechCostPercent> <iTechMinTurnsLeft>0</iTechMinTurnsLeft> <PrereqTech>NONE</PrereqTech> <UnitClass>NONE</UnitClass> <iNumFreeUnits>0</iNumFreeUnits> <bDisbandUnit>0</bDisbandUnit> <iUnitExperience>0</iUnitExperience> <iUnitImmobileTurns>0</iUnitImmobileTurns> <UnitPromotion/> <UnitName/> <UnitCombatPromotions/> <UnitClassPromotions/> <BuildingClass>NONE</BuildingClass> <iBuildingChange>0</iBuildingChange> <BuildingExtraYields/> <BuildingExtraCommerces/> <BuildingExtraHappies/> <BuildingExtraHealths/> <iHappy>0</iHappy> <iHealth>0</iHealth> <iHurryAnger>0</iHurryAnger> <iHappyTurns>0</iHappyTurns> <iRevoltTurns>0</iRevoltTurns> <iMinPillage>0</iMinPillage> <iMaxPillage>0</iMaxPillage> <iFood>0</iFood> <iFoodPercent>0</iFoodPercent> <FreeSpecialistCounts/> <FeatureType>NONE</FeatureType> <iFeatureChange>0</iFeatureChange> <ImprovementType>NONE</ImprovementType> <iImprovementChange>0</iImprovementChange> <BonusType>NONE</BonusType> <iBonusChange>0</iBonusChange> <RouteType>NONE</RouteType> <iRouteChange>0</iRouteChange> <BonusRevealed>NONE</BonusRevealed> <BonusGift>NONE</BonusGift> <PlotExtraYields/> <iConvertOwnCities>0</iConvertOwnCities> <iConvertOtherCities>0</iConvertOtherCities> <iMaxNumReligions>-1</iMaxNumReligions> <iOurAttitudeModifier>0</iOurAttitudeModifier> <iAttitudeModifier>0</iAttitudeModifier> <iTheirEnemyAttitudeModifier>0</iTheirEnemyAttitudeModifier> <iPopulationChange>0</iPopulationChange> <AdditionalEvents/> <EventTimes/> <ClearEvents/> <PythonCallback>doObsoleteReligion1</PythonCallback> <PythonExpireCheck/> <PythonCanDo/> <PythonHelp/> <Button>,Art/Interface/Buttons/Process/Blank.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,8,5</Button> <iAIValue>1000</iAIValue> |
|
|
|
|
|
#7 |
|
Event Master
Join Date: Aug 2007
Location: 2 food, 2 commerce plot in Utah
Posts: 89
|
Sorry to mislead you earlier ;( . I hope this helps though: You don't need to specify: "NONE" for BuildingClass followed by a 0 in iBuildingChange. A zero value in iBuildingChange doesn't make much sense to me. Is that how it is done in other XML events in the game? The values that I understand in iBuildingChange are -1 for destroy and 1 for create. But, like I said, you don't need either field filled in. That may not make a difference, but it can't take long and I'm fresh out of (bad) ideas.
|
|
|
|
|
|
#8 | |
|
Prince
Join Date: Feb 2006
Posts: 451
|
Quote:
|
|
|
|
|
|
|
#9 |
|
Event Master
Join Date: Aug 2007
Location: 2 food, 2 commerce plot in Utah
Posts: 89
|
Heh, interesting. I guess it doesn't matter whether that is in there or not. I'm really sorry. I thought I might be able to help you but alas, I don't know what I'm talking about.
|
|
|
|
![]() |
| Bookmarks |
|
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help out another Python newbie? | IdiotsOpposite | Civ4 - Creation & Customization | 1 | Jan 22, 2008 08:19 PM |
| <Bts>?python?....beginning python modders question | SeanDeven | Civ4 - SDK/Python | 4 | Oct 20, 2007 11:22 AM |
| Mega-error in python *python guru's please help* | Paasky | Civ4 - Creation & Customization | 15 | Mar 12, 2007 05:38 PM |
| Python problems => Python solutions | Fabrysse | Civ4 - Creation & Customization | 2 | Dec 01, 2006 01:17 AM |
| [Python]: Help, How does python assign GP names? | Civkid1991 | Civ4 - Creation & Customization | 10 | Sep 25, 2006 08:37 PM |