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

Improved Python Event System (Quests for Unit numbers)

Discussion in 'Civ4Col - We The People' started by raystuttgart, Feb 17, 2020.

  1. raystuttgart

    raystuttgart Civ4Col Modder

    Joined:
    Jan 24, 2011
    Messages:
    5,975
    Gender:
    Male
    Location:
    Stuttgart, Germany
    Hi guys,

    just to let you know.

    Last week I have improved Python Event System (in DLL) a bit.
    (I did it when creating the new Governor Event.)

    --------

    For some reason, the Python Event System did not allow to trigger "City Events / City Quests" considering specific Units working inside a City.

    Or generally specific Units (simply owned by the player anywhere without caring about a specific plot).
    (We could trigger a "Plot Event" considering Units on the specific Event Plot though - but it was that Event Plot only.)

    I did consider this a bug or at least a strange limitation not suited for Civ4Col thus changed it.
    (The Python Event System was originally adapted from Civ4 BTS where there is only a "population" and no different Expert Units working in the cities.)

    So now we have both possibilities (without needing to code additional Pyhton functions):
    A) Specific amount (could also be just 1) of owned specific Units plot unspecific (new)
    B) Specific amount (could also be just 1) of a set of possible specific Units on a specific Event Plot (old)

    Difference:
    A) Simply own X Units of Type A (new) --> Event will trigger for your Nation or one of your Cities.
    B) Have 1 (or X) Unit(s) of Type A on a Plot of Type B (old) --> Event will trigger for the Plot or one of the Units on the Plot.

    --------

    This is now fixed / improved. :)
    (XML configuration does allow it now without coding specific Pyhton functions.)

    Thus we can create Events/ Quests based on specific Unit Numbers e.g. like this by XML configuration:
    • Be the first to acquire 3 Wagon Trains to get a reward (e.g. a Pioneer to build their roads) --> IMPLEMENTED
    • Be the first to acquire 6 African Slaves to get a reward (e.g. a Militia Units to guard them) --> IMPLEMENTED
    • Be the first to acquire 5 Expert Fur Trapers to get a reward (e.g. a free Fur Trader or Production Bonus to a fur Trading Post) --> IMPLEMENTED
    • Be the first to acquire 3 Small Coastal Transport Ships to get a reward (e.g. an Upgrade or a Production Bonus to one of your Harbour Buildings) --> IMPLEMENTED
    • ...
    These Units can be working in one or several Cities or just run around on the map.
    (They do not have to be on a specific plot where the event itself shall be triggered.)

    There will also be an Announcement Event that will inform you about the Quest.
    (Quest can only be won if Announcement Event already triggered.)

    Only the first Player to achieve the Quest will get the reward.
    (All other Players will just get a message that it was achieved by another Player.)

    When the Quest is won the Quest Achievement Event will pop-up.
    (There you can then choose between different reward options.)

    --------

    Summary:

    This could be used to create a complete series of more Quests with small rewards.
    (It is technically really easy to do but it does still cost time to write e.g. the texts and test it.)

    I am looking forward to ideas and suggestions for such events. :)
    We would also appreciate if we found somebody interested to support us and create such events.

    I do take suggestions for Events / Quests and will create them for you. (If I like them.)
    Of course you could create them yourself as supporter of the team as well. ;)

    --------

    So what do I need:
    • Brief explanation of the Announcement Event (Conditions to start Quest) and Quest Achievement Event (Conditions to win Quest).
    • Brief explanation of the possible alternative reward choices.
    • If possible already the texts to use for the Announcement Event, Quest Achievement Event and its reward options.
    Please keep in mind:

    1. The Quests should not be much more complicated than the examples given above.
    (Really simple: "Precondition to start Quest" + be the first to "get X Units of Type A" + "choose your reward B or C".)

    2. The texts for Annoucenement Event / Quest Achievement Event need to stay relatively short.
    (About 5 sentences most. Otherwise the text will not fit into the window.)

    3. The Quest reward choice texts need to stay relatively short as well.
    (About 3 sentences most. Otherwise the text will not fit into the window.)

    4. Other Trigger conditions (for Annoucenement Event to start the Quest) can be applied additionally as well.
    (E.g. having specific buildings, having specific population, having specific amount of gold ...)
     
    Last edited: Feb 18, 2020
  2. raystuttgart

    raystuttgart Civ4Col Modder

    Joined:
    Jan 24, 2011
    Messages:
    5,975
    Gender:
    Male
    Location:
    Stuttgart, Germany
    Hi guys,

    I have implemented 4 new (Unit number based) Quests to test the small new enhancement I have implemented for the Python Event System.

    With writing all the text and doing the XML setup and testing, it took me about 30mins for each. :)
    Really easy!

    There is almost nothing that can go wrong and no Python coding needed at all.
    (It is really all just XML.)

    By the way, do not wonder that the screenshots all look so similar.
    (I had just set up a test scenario to test them all at once and to test the texts and rewards.)
     

    Attached Files:

    Last edited: Feb 18, 2020
    AnAmericanCommunist likes this.
  3. Tugboatspotter

    Tugboatspotter Warlord

    Joined:
    Dec 19, 2019
    Messages:
    211
    Very nice. The new quests are good and the text looks very polished.

    I did notice a couple of typos.

    In the slaves quest "We have acuqired" and plantation is misspelled as "planation" a few times. Also "work force we delivered them" should be "work force we delivered to them"

    In the wagon trains done: "using out wagon traings"

    Also, in the fur trapper quest "if we achieve to be the first nation to do so, his Majesty offers a reward" could possibly read better as "if we are the first nation to do so, his Majesty will offer a reward".

    Sorry if I am coming across as pedantic with some of these suggestions. I certainly am not criticizing your level of English which is first class.
     
    Last edited: Feb 21, 2020
  4. Mr. ZorG

    Mr. ZorG Warlord

    Joined:
    Feb 13, 2020
    Messages:
    167
    Gender:
    Male
    Location:
    Russia, Vladimir
    @raystuttgart, tell me where to write about script suggestions: here or in private messages? ..
     
  5. raystuttgart

    raystuttgart Civ4Col Modder

    Joined:
    Jan 24, 2011
    Messages:
    5,975
    Gender:
    Male
    Location:
    Stuttgart, Germany
    Thanks, I corrected them. :)
    (It was just a bit tired after work.)
     
  6. raystuttgart

    raystuttgart Civ4Col Modder

    Joined:
    Jan 24, 2011
    Messages:
    5,975
    Gender:
    Male
    Location:
    Stuttgart, Germany
    Here in this thread is perfectly fine. :)
     
  7. Mr. ZorG

    Mr. ZorG Warlord

    Joined:
    Feb 13, 2020
    Messages:
    167
    Gender:
    Male
    Location:
    Russia, Vladimir
    in this case, I have a question)

    the game has a message: "the disease spreads among the Indians" (this is an approximate description). it appears at the top of the screen and can be tracked in the message log. the question is: what is the mechanic of the appearance of this message and can it appear several times in one player? if this message can appear only once, then I would suggest an event for it)
     
  8. raystuttgart

    raystuttgart Civ4Col Modder

    Joined:
    Jan 24, 2011
    Messages:
    5,975
    Gender:
    Male
    Location:
    Stuttgart, Germany
    This is the Python Event "Diseased Natives". (It already exists since RaR 2.4)
    I believe it is "non-reocurring" (meaning it triggers only once per game).

    This event can trigger for any European Nation (including AI) that has borders to a Native Player.
    Other Trigger Conditions are applied as well. One of the possible choices is related to the feature Health.

    That is the "Worldtext" that informs players that an event was triggered for another player.
    (Basically it tells you: "Do not wait for this event anymore. The event was already triggered.")

    It already is an event, but not all events will / can trigger for Human Player only.
    (Some can trigger for AI European Colonies as well, and a few can also trigger for Natives.)

    It would simply become unfair for AIs if all the Events would be Human only because these events usually have higher rewards than risks.
    It could also become quite annoying if the same Event triggers several times in game - we would most likely get bug reports.
    Some events are also really rare to trigger because they are not active every game or their trigger conditions might not fit your play style.

    Summary:
    You will not trigger all events yourself every game because some will be triggered by other Nations and can trigger only once per game.
    You might need to have several full play throughs with varying play styles until you have seen almost all of the existing events.
    Worldtexts will just inform you that an event was triggered for another Nation.

    Remark:
    In EventTriggerInfos.xml the conditions can easily be changed.
    (It is also a good way to "cheat" by reading the trigger conditions to know how to purposely trigger an event - if you want to play that way.)
     
    Last edited: Feb 24, 2020
  9. Mr. ZorG

    Mr. ZorG Warlord

    Joined:
    Feb 13, 2020
    Messages:
    167
    Gender:
    Male
    Location:
    Russia, Vladimir
    then for me, as a player, this event has never occurred. I saw only a pop-up message. in this case my offer is canceled ...
     
  10. raystuttgart

    raystuttgart Civ4Col Modder

    Joined:
    Jan 24, 2011
    Messages:
    5,975
    Gender:
    Male
    Location:
    Stuttgart, Germany
    @Mr. ZorG

    You can check Civ4EventTriggerInfos.xml for more information about the event.
    It is this one here: EVENTTRIGGER_DISEASED_NATIVES

    It is non-recurring.
    (Meaning it can only trigger once per game.)

    And every European Nation (including AIs) can get it.

    It is pretty much the same with most events. You will need several games until you have discovered most of them.
    (We purposely designed it that way so the "replaying factor" would be a bit higher since every game you can discover some small new events.)
     
  11. Mr. ZorG

    Mr. ZorG Warlord

    Joined:
    Feb 13, 2020
    Messages:
    167
    Gender:
    Male
    Location:
    Russia, Vladimir
    thanks, I'll see today
     
  12. rah

    rah Deity Supporter

    Joined:
    Sep 12, 2005
    Messages:
    10,119
    Location:
    Chicago

    +1, that is how it should be.
     
  13. Mr. ZorG

    Mr. ZorG Warlord

    Joined:
    Feb 13, 2020
    Messages:
    167
    Gender:
    Male
    Location:
    Russia, Vladimir
    I looked at the requirements for the trigger to work and realized only that the colony should be at least 10 and should border the native camp. Unfortunately, I did not understand the rest of the requirements ...:dunno:
    that an event occurs once for all is a good and correct principle. who first came - he have a slippers)))
     
  14. AnAmericanCommunist

    AnAmericanCommunist Chieftain

    Joined:
    Mar 26, 2020
    Messages:
    8
    An idea for an event. "Education for the Masses" Precondition: build your first education building. Event: "His majesty is anxious for you to expand your education system in your colony. He sees that a well-educated workforce is a productive and profitable workforce. Be the first to educate 10 units in your schools and you shall be rewarded by his majesty, the King." Reward: A) "His majesty is amazed by your progress and wishes to give you more subjects to educate!" (+4 free colonists), B) "His majesty now wishes to see your education system equal that of the homeland." (+4 education per turn in the largest city)

    It may need some balancing, and I do not know if the script can be made to read that. If it is possible, other variants of this quest revolving around indentured servants being educated, or colonists in general going to native villages to learn may also readily written.
     
    Mr. ZorG likes this.
  15. AnAmericanCommunist

    AnAmericanCommunist Chieftain

    Joined:
    Mar 26, 2020
    Messages:
    8
    Another Idea. "Costal defense force" Precondition: have 2 Galleons. Event: "Congratulations, now that you have a robust trade back to Europe, the King is asking that protect it from pirates. He asks that you be the first to assemble five frigates to guard your coasts and he will reward you." Reward: A) "His Majesty is pleased by your robust naval production and offers to send naval engineers to further your industry" (scaled production boost to naval buildings, +3 to drydock and increasing) B) "His Majesty wishes that you become the bulwark against any naval threat to the homeland! He sends naval officers to join you." (gain a great admiral)
     
    Mr. ZorG likes this.
  16. raystuttgart

    raystuttgart Civ4Col Modder

    Joined:
    Jan 24, 2011
    Messages:
    5,975
    Gender:
    Male
    Location:
    Stuttgart, Germany
    @AnAmericanCommunist

    Quest "Education for the Masses":
    It can currently not be implemented because the current Python Event System (incl. DLL methods it uses) has nothing to count how often you educated in Schools. :c5unhappy:
    (It would be a lot of effort to enhance the Python Event System for a single event like this - and I currently cannot imagine the enhacement to be used for something else like that.)

    Quest "Costal defense force":
    This one is no problem and little effort to implement using the current Python Event System. :thumbsup:
    (When I have a little more time to do so, I can implement something similar to this.)
     
    Last edited: Mar 27, 2020
    AnAmericanCommunist and Mr. ZorG like this.
  17. ConjurerDragon

    ConjurerDragon Prince Supporter

    Joined:
    Dec 13, 2012
    Messages:
    353
    Gender:
    Male
    Location:
    Rhineland-Palatinate
    However there are already events that tel you to build e.g. 5 Abbeys after you have built you first chapel building, same as for most other buildings.

    The naval event does not make sense - if you (the colony) becomes the bulwark against naval threats to the homeland - on the other side of the ocean, then the King should not send naval officers to you, but you should be asked to detach some units to actually do what he expects,namely securing european coasts instead of american coasts...
     
  18. Lord Chambers

    Lord Chambers Emperor

    Joined:
    Nov 23, 2001
    Messages:
    1,004
    Quest "Balancing the powers"

    1. Condition to start quest: Build one plantation
    Announcement text: "The King notes that you are developing your colony in order to provide economic benefits to the homeland. 'As it should be. When you contain 5 plantations in <New England>'s borders, I will reward you with an unknown benefit, if it's before other nations. For now, just a vague promise to stoke your fire!'"


    2. Quest achievement Event: Be the first to have 5 plantations in your borders
    Reward text "Aha, your careful consideration and expert governance have led you to achieve my conditions. You seem surprised. Didn't you know you were competing, and just won the race? Behold, you may choose a reward for doing something you were going to do anyway."
    Reward A "Inspired by your governance, a Petty Criminal stands on the docs of Europe with a sign reading "will work 4 food"
    Reward B "Never one to care about balance, the King offers you use of a Man O War in perpetuity.


    This is my contribution. It's criticism of the existing quests, which I find capricious and usually arbitrary. I get the gesture--there was a race for a direct route to the orient, so having you compete makes sense. However, the idea of racing Spain for 5 markets seems arbitrary. More importantly, the game offers the player no feedback to know where they are in the "race."
    When I'm issued the quest, only my meta-knowledge lets me know what the reward may be, and thus what sacrifices I should make to complete it. I usually find myself surprised to discover I'm receiving an award, since eventually i'm going to build 5 of most things. I don't recall the rewards being well-balanced, though the only reward I can remember is for settling your second colony. Guns or 10 things for an Oxcart. I choose the things for the Oxcart every time since they may add value on a conceivable timescale. The guns are going to tax my storage space for tens of turns, and when they become useful, they'll be inconsequential. Overall, I never find myself racing to do any quest, and when I get the benefits it feels like touching gum under a table. Who put this here? Why is my economic simulation offering quests without tradeoffs?
     

Share This Page