1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Help Wanted Ads

Discussion in 'Civ4 - Caveman 2 Cosmos' started by strategyonly, Jan 16, 2012.

  1. God-Emperor

    God-Emperor Deity

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    You should not be assigning a random event's Python function to a game event of any sort. Random events run their own checks independent of game events. The two things have nothing to do with each other, directly.

    The Python functions that are called by the DLL for event triggers, and events, go in CvRandomEventInterface.py. That is where the random event stuff in the DLL looks for the function names that are given in the XML, so that is where they need to be.

    As an aside...
    You can manually activate a "random" event trigger (in which case it is not really random) in a game event handler. The Partisans event that happens when a city is razed is done this way. See the BtS CvEventManager.py file's onCityRazed function. That fires off the trigger, which then applies all of its criteria (like the TechPrereq) and, if it passes, does what it does.

    But you should not need to do that, since the example in the tutorial doesn't and what you are doing is pretty much exactly the same sort of thing it is doing.
     
  2. Vokarya

    Vokarya Deity

    Joined:
    Mar 25, 2011
    Messages:
    6,159
    I'll try the RandomEventInterface file and see if that does the trick. It seems to me that the XML should be able to set up a loop of triggers and events, but that doesn't seem to work. The files I attached to my 2/27 post is my pure-XML attempt. Did I miss something there?
     
  3. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    One thing I am confused though is this.
    You are using python to trigger an event to add the relationship bonus.
    Then you are getting alot of errors to get the event to repeat.

    The thing is if you are going to use python to trigger an event to achieve it, you might as well just use python to give the bonus directly?

    Every X turns:
    Roll a Random Number 0 or 1
    If 0 (means 50%) then choose a random player
    Add the relationship bonus

    Isn't it simpler than triggering an event just to do the same job and then trying to make the event repeatable?
     
  4. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Doesn't work across modifier recalcs again. Events get replayed (for their tag-generated effects), but the python doesn't get re-invoked because the DLL has no way to separate one-time stuff from persistent stuff, so if it called the Python as if the event were new each time, it would repeat the one-time stuff (including messaging etc.)

    Thus if the processing is mediated by tag-defined event outcomes as Vokarya is seeking to do, it works fine across recalcs. However, if it relies on direct modifier setting by Python it does not.
     
  5. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    I see, but since he already done a field of gold wonder using python effects, I was assuming it works for you guys.
    But since you said the effects this way is going to be wiped, I don't see how field of gold can work without getting wiped either
     
  6. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,516
    Gender:
    Male
    Location:
    Canberra, Australia
    It may not work, but no one has mentioned it yet. This is one of the reasons we have a freeze period. So all the modders can check each others work out rather than just their own.
     
  7. Vokarya

    Vokarya Deity

    Joined:
    Mar 25, 2011
    Messages:
    6,159
    I'm brainstorming ideas for new wonders, and I had a thought while looking over the list of Python functions in CvEventManager. Is there a function that can affect a unit's combat strength under specific circumstances? An example would be a unit defending alone, or a unit attacking another unit controlled by the controller of your state religion's Holy City. I see there is a function for after combat, but not beginning combat.
     
  8. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,552
    Gender:
    Male
    Location:
    MN
    I WISH "we" could ue the regular CvEventManager.py, would be ten times easier, but for some reason, it wont work with this BUG installed, i wish some "PYTHON" experts could figure out this problem, if so, i could add more than 20 new things to C2C and it would be 30 times better if so.
     
  9. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,414
    There is no problem to figure out. The reason that the BUG event manager exists is that it allows modular Python additions in the first place.
    It is easy enough to convert stuff to use it.
     
  10. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,552
    Gender:
    Male
    Location:
    MN
    For python knowledge people,sure, but i am not a python person, and i used to be able to just cut/paste all the CvEventManager stuff , but now i cant, ie: Tsunami/Disease Diplomacy Units etc, if so "we" could be have a great time with this stuff that Thomas had made.
     
  11. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,414
    The conversion is quite a mechanic process that has little to do with Python and more with BUG mod XML.
    In most cases it just means copying the code into a new Python file and then telling BUG that there is an event handler in there.
     
  12. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,516
    Gender:
    Male
    Location:
    Canberra, Australia
    I have already told StrategyOnly the three or four steps that he needs to do to convert any python into modular python but he reckons he is an "old dog who can't learn new tricks":mischief:. I have converted much that has been asked for but some things are either duplicates of what we already have or I "hates".
     
  13. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,552
    Gender:
    Male
    Location:
    MN
    ahahaha :splat: Yeah your right, i am an old dog :scared: :p At least this made me laugh, thx.;)
     
  14. WontonAlertBulb

    WontonAlertBulb Chieftain

    Joined:
    Apr 3, 2012
    Messages:
    4
    I have been lurking on your forum as well as playing C2C for over a year and a half now and was wondering if I could help with adding Civilopedia for all of the awesome new things that C2C adds. Thanks and I hope that you are interested.
     
  15. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,516
    Gender:
    Male
    Location:
    Canberra, Australia
    Well as you can see in the quote below from the Player How To Document post #6. If you see something that needs fixing then fix it and post the result.:) This is especially true of pedia entries and translations.

     
  16. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,552
    Gender:
    Male
    Location:
    MN
    You should get ahold of dsma_bell, who is from Germany, he has been providing some translations into German already, and thx for offering, and Welcome to CFC, and trying C2C
     
  17. Vokarya

    Vokarya Deity

    Joined:
    Mar 25, 2011
    Messages:
    6,159
    I have a question about the Diplomatic Wonders. Where in the code is it determined who is a member of the Apostolic Palace/United Nations? I would like to introduce a Congress of Vienna wonder that would basically act as a religion-neutral Apostolic Palace without Diplomatic Victory. It would be able to declare war, force peace, declare a trade embargo, reassign a city, sign Open Borders, and sign a Defensive Pact. I see how to do the voting code, but I can't figure out where in the code membership is assigned. Ideally, the members of the Congress would be anyone not at war with the OWNER of the Congress. Could someone point me to where that code is?
     
  18. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    27,397
    Gender:
    Male
    Location:
    Las Vegas
    I'm not sure entirely but I can say for sure that what its looking for is what cities have the Apostolic Palace's declared religion. Any nation that has even one city with that religion in it will be a member and the strength of their votes is dependent on the total population among a player's cities that are exposed to that religion.

    Surely it would be a calculation inside the dll I would think. Perhaps the city files.
     
  19. Vokarya

    Vokarya Deity

    Joined:
    Mar 25, 2011
    Messages:
    6,159
    I know how the membership gets expressed in the game, but I'm looking for where exactly in the code does it say "you must have the AP religion to be an AP member" or "you must exist and have cities to be a UN member". I discovered if you have "Require Complete Kills", AI civilizations without cities are not UN members.
     
  20. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,414
    Check CIV4VoteInfo.xml and CIV4VoteSourceInfos.xml.
     

Share This Page