This thread is for the development of the Unique Victory Conditions Script.
The current script:
This is what I sent GED via PM about what it is supposed to do:Code:declare_counter unique_victory_conditions declare_counter can_win declare_counter victory_countdown declare_counter victory_points_1 declare_counter victory_points_2 declare_counter victory_points_3 declare_counter victory_points_risk set_counter unique_victory_conditions 1 ;initialize unique victory conditions ;------------------------------------------------ ;-- Sub-Section 1D - Unique Victory Conditions -- ;------------------------------------------------ ;**********Script 1D-1 - Victory Conditions Setup********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;Sets faction-based counter for usage in other commands monitor_event FactionTurnStart FactionIsLocal and I_CompareCounter unique_victory_conditions == 1 and FactionType song set_event_counter unique_vc_song 1 ; if FactionType song ; set_event_counter unique_vc_song 1 ; end_if ; if FactionType jin ; set_event_counter unique_vc_jin 1 ; end_if ; if FactionType goryeo ; set_event_counter unique_vc_goryeo 1 ; end_if ; if FactionType dali ; set_event_counter unique_vc_dali 1 ; end_if ; if FactionType xixia ; set_event_counter unique_vc_xixia 1 ; end_if ; if FactionType tibet ; set_event_counter unique_vc_tibet 1 ; end_if ; if FactionType khitans ; set_event_counter unique_vc_khitans 1 ; end_if ; if FactionType mongols ; set_event_counter unique_vc_mongols 1 ; end_if ; if FactionType pagan ; set_event_counter unique_vc_pagan 1 ; end_if ; if FactionType khmer ; set_event_counter unique_vc_khmer 1 ; end_if ; if FactionType minamoto ; set_event_counter unique_vc_minamoto 1 ; end_if ; if FactionType taira ; set_event_counter unique_vc_taira 1 ; end_if ; if FactionType daiviet ; set_event_counter unique_vc_daiviet 1 ; end_if ; if FactionType champa ; set_event_counter unique_vc_champa 1 ; end_if ; if FactionType ghurid ; set_event_counter unique_vc_ghurid 1 ; end_if inc_counter unique_victory_conditions 1 end_monitor ;Shows user ways to win with their faction monitor_event FactionTurnStart FactionIsLocal and I_CompareCounter unique_victory_conditions == 2 if I_EventCounter unique_vc_song == 1 historic_event unique_vc_song_prompt inc_event_counter unique_vc_song 1 end_if if I_EventCounter unique_vc_jin == 1 historic_event unique_vc_jin_prompt inc_event_counter unique_vc_jin 1 end_if if I_EventCounter unique_vc_goryeo == 1 historic_event unique_vc_goryeo_prompt inc_event_counter unique_vc_goryeo 1 end_if if I_EventCounter unique_vc_dali == 1 historic_event unique_vc_dali_prompt inc_event_counter unique_vc_dali 1 end_if if I_EventCounter unique_vc_xixia == 1 historic_event unique_vc_xixia_prompt inc_event_counter unique_vc_xixia 1 end_if if I_EventCounter unique_vc_tibet == 1 historic_event unique_vc_tibet_prompt inc_event_counter unique_vc_tibet 1 end_if if I_EventCounter unique_vc_khitans == 1 historic_event unique_vc_khitans_prompt inc_event_counter unique_vc_khitans 1 end_if if I_EventCounter unique_vc_mongols == 1 historic_event unique_vc_mongols_prompt inc_event_counter unique_vc_mongols 1 end_if if I_EventCounter unique_vc_pagan == 1 historic_event unique_vc_pagan_prompt inc_event_counter unique_vc_pagan 1 end_if if I_EventCounter unique_vc_khmer == 1 historic_event unique_vc_khmer_prompt inc_event_counter unique_vc_khmer 1 end_if if I_EventCounter unique_vc_minamoto == 1 historic_event unique_vc_minamoto_prompt inc_event_counter unique_vc_minamoto 1 end_if if I_EventCounter unique_vc_taira == 1 historic_event unique_vc_taira_prompt inc_event_counter unique_vc_taira 1 end_if if I_EventCounter unique_vc_daiviet == 1 historic_event unique_vc_daiviet_prompt inc_event_counter unique_vc_daiviet 1 end_if if I_EventCounter unique_vc_champa == 1 historic_event unique_vc_champa_prompt inc_event_counter unique_vc_champa 1 end_if if I_EventCounter unique_vc_ghurid == 1 historic_event unique_vc_ghurid_prompt inc_event_counter unique_vc_ghurid 1 end_if inc_counter unique_victory_conditions 1 end_monitor ;**********Script 1D-2 - Song Dynasty VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Defines ways for Song Dynasty player to win. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;Set Victory Point Counters monitor_event FactionTurnEnd FactionIsLocal and FactionType song and I_CompareCounter unique_victory_conditions == 3 and I_CompareCounter can_win == 0 and I_EventCounter unique_vc_song == 2 set_counter can_win 1 set_counter victory_points_1 0 set_counter victory_points_2 0 set_counter victory_points_3 0 set_counter victory_points_risk 0 end_monitor ;Decrease timer until victory monitor_event FactionTurnEnd FactionIsLocal and I_CompareCounter victory_countdown > 0 inc_counter victory_countdown -1 end_monitor ;Prompt Player about achieving victory for Victory Type 1 monitor_event FactionTurnStart FactionIsLocal and FactionType song and I_CompareCounter can_win == 1 and I_CompareCounter victory_points_1 > 100 and I_CompareCounter victory_countdown == 0 add_events event counter victory1_accepted event counter victory1_declined date 0 end_add_events historic_event victory1 true end_monitor ;Victory Conditions Fulfilled monitor_event EventCounterType victory1_accepted if I_EventCounter victory1_accepted == 1 give_everything_to_faction scripting song false end_if end_monitor ;Player wants to wait monitor_event EventCounterType victory1_declined set_counter victory_countdown 10 end_monitor ;Prompt Player about achieving victory for Victory Type 2 monitor_event FactionTurnStart FactionIsLocal and FactionType song and I_CompareCounter can_win == 1 and I_CompareCounter victory_points_2 > 100 and I_CompareCounter victory_countdown == 0 add_events event counter victory2_accepted event counter victory2_declined date 0 end_add_events historic_event victory2 true end_monitor ;Victory Conditions Fulfilled monitor_event EventCounterType victory2_accepted give_everything_to_faction scripting song false end_monitor ;Player wants to wait monitor_event EventCounterType victory2_declined set_counter victory_countdown 10 end_monitor ;Prompt Player about achieving victory for Victory Type 3 monitor_event FactionTurnStart FactionIsLocal and FactionType song and I_CompareCounter can_win == 1 and I_CompareCounter victory_points_3 > 100 and I_CompareCounter victory_countdown == 0 add_events event counter victory3_accepted event counter victory3_declined date 0 end_add_events historic_event victory3 true end_monitor ;Victory Conditions Fulfilled monitor_event EventCounterType victory3_accepted give_everything_to_faction scripting song false end_monitor ;Player wants to wait monitor_event EventCounterType victory3_declined set_counter victory_countdown 10 end_monitor ;Prompt Player about achieving victory for Victory Type Risk monitor_event FactionTurnStart FactionIsLocal and FactionType song and I_CompareCounter can_win == 1 and I_CompareCounter victory_points_risk > 100 and I_CompareCounter victory_countdown == 0 add_events event counter victoryR_accepted event counter victoryR_declined date 0 end_add_events historic_event victoryR true end_monitor ;Victory Conditions Fulfilled monitor_event EventCounterType victoryR_accepted give_everything_to_faction scripting song false end_monitor ;Player wants to wait monitor_event EventCounterType victoryR_declined set_counter victory_countdown 10 end_monitor ;;;Victory Type 1 - Hold 50 Settlements including Heian-kyo ;Reset Settlement Value to prevent accumulation monitor_event FactionTurnEnd FactionIsLocal and I_CompareCounter victory_points_1 > 0 set_counter victory_points_1 0 end_monitor ;Check settlement ownership at slave turn end monitor_event FactionTurnEnd FactionType slave and I_EventCounter unique_vc_song == 2 if I_SettlementOwner Lin-an song inc_counter victory_points_1 1 end_if if I_SettlementOwner Jiankang song inc_counter victory_points_1 1 end_if if I_SettlementOwner Heian-kyo song inc_counter victory_points_1 100 end_if end_monitor ;;;Victory Type 2 ;;;Victory Type 3 ;;;Victory Type Risk ;Reset Risk Value to prevent accumulation monitor_event FactionTurnEnd FactionIsLocal and I_CompareCounter victory_points_risk > 0 set_counter victory_points_risk 0 end_monitor ;Check settlement ownership at slave turn end monitor_event FactionTurnEnd FactionType slave and I_EventCounter unique_vc_song == 2 if I_SettlementOwner Lin-an song inc_counter victory_points_risk 100 end_if if I_SettlementOwner Jiankang song inc_counter victory_points_risk 3 end_if end_monitor ;**********Script 1D-3 - Jin Dynasty VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-4 - Goryeo VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-5 - Kingdom of Dali VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-6 - Xi Xia VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-7 - Tibetan Kingdoms VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-8 - Kara Khitan Khanate VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-9 - Mongol Khanate VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-10 - Pagan Kingdom VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-11 - Khmer Empire VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-12 - Kingdom of Champa VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-13 - Dai Viet VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-14 - Taira Clan VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-15 - Minamoto Clan VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer ;**********Script 1D-16 - Ghurid Sultanate VC********** ; ;|Author| Augustus Lucifer ;|Purpose| Counters and other requisite global monitors for the unique victory conditions. ;|Changelog| ; o Script Created 12-31-08 ~ Augustus Lucifer
Some of the current problems occurring involve the map, and obviously there's a lot of filling in to do. As you can see on the first part of the counter setting, I commented a lot of that out. Reason for that is it wasn't transferring the faction export to the if statements for some reason and would never set. Solution will be to just replicate it for every faction in the 'and' statements unless it can be determined why the 'if' statements weren't working.I'm working on our script which will allow us to dictate unique victory conditions for each faction. I've included part of the shell of the script to get your thoughts on the implementation. Keep in mind there's a ton of duplicating still to do, and some of the outrageous values are for testing purposes only.
I think you'll get the gist of it from looking at the script, but this is what it does:
* First, it sets an event counter based on the faction chosen.
* Then it uses that counter to pop up a prompt which explains to the player what the courses to victory are for the faction they chose.
* Then it initializes the counters at 0 and sets a can_win counter so that winning can be disabled if desired in the future.
* The next part checks the point totals for each victory condition to see if it is met and whether the player can win, then triggers an accept/decline to allow the player to choose if they want to end the game or not.
(The reason for this is the unseen portion, all factions actual win conditions require possession of an inaccessible province controlled by our scripting faction, which is given to them when unique conditions are achieved. The scripting faction is frozen for our Wonders, so if a player "wins" but then stays longer, the buildings will be under their control and age, etc.)
* If the player accepts, the give_everything_to_faction command supplies them with the province the game internally considers necessary to victory.
* If the player declines, a 10-turn timer is set so the player isn't prompted every turn about victory.
* Lastly it splits into the ways in which points are accumulated towards each victory.
There will be 4 ways to win for each faction.
The first for all factions will be the normal way to win, which is to hold X provinces including certain other provinces. This will be achieved quite simply by requiring [(X*200)+Y-X] points; where X is the number of required settlements, and Y is the number of total settlements. Each required region will increase the counter by 200, and each other region by 1. This insures the only way to win is by owning the required regions, since all the other regions combined don't add up to the points.(Example: Song Condition 1 = Hold 50 Regions including Nara, Seoul. Nara and Seoul ownership both increase counter by 200. All others increase counter by 1. Required points for victory = [(2*200)+50-2] = 448; a fairly simple formula)
The next two ways to win will be faction-specific, and the possibilities are vast, so not a lot has been decided in regards to these conditions yet. In eventuality I want the other two ways to win to reflect the aspirations of the respective nation. A peaceful nation could win through cultural development that increases the counter for high-level buildings present. A nation that just wants to be a regional power could achieve victory by holding all the settlements in a region consistently for X turns and X turns in a row. There's a lot of possibility in this regard.
The last way is risk-style. Or perhaps Hearts of Iron style, but anyways. Each province is worth a certain amount of victory points, so key provinces and national capitals are worth much more than outlying provinces. When you get enough victory points, you win, pretty simple.
What the script does is reset the counter to 0 on the turn end of the player faction, and re-tally all of it on the turn end of the slave faction. Then the results are presented on the turn start of the player faction. Ideally if I conceived this correctly, this makes it so that the counter will not constantly increase for the same feat since it is always being reset, and have it rebuilt at the most opportune time to check in a collective turn.
As well, there's an issue that is recurring in this script and in the other script, which is that it doesn't seem to be recognizing the accept/decline counters for usage in the counter checking events, so clicking accept/decline does nothing. It seems to be the case for the shinobi script right now as well, and I haven't been able to find the reason.
I've made a thread in the history area on regions to figure out the importance of regions for usage in the RISK part of the victory script.






Reply With Quote




