Results 1 to 8 of 8

Thread: Lession 3 - EDB and Religion

  1. #1

    Default Lession 3 - EDB and Religion

    Event scripting linked to the EDU

    DO not read this lesson untill you have finished the other two or may have difficulty's in progressing and getting things working, at this point you should have the basics of Events and conditions, but Events and conditions does not just end with the campaign script other files can be tied in such as the export_descr_buildings.txt (EDB) for instance if i wanted to write a script allowed me to build a unit but i must be holding London i would go about it like this...

    Code:
        monitor_conditions not I_SettlementOwner London = england
            and I_EventCounter holding_london == 1
    
            set_event_counter holding_london 0
    
        end_monitor
    
    
        monitor_conditions I_SettlementOwner London = england
            and I_EventCounter holding_london == 0
    
            add_events
                event    counter    holding_london
                 date    0
             end_add_events
    
         end_monitor
    so lets start by opening a fresh copy of our campaign_script.txt and copy the about copy in.

    this script monitors a condition called I_SettlementOwner and compares it to a faction testing if London is not owned by england

    this sets our event counter holding_london to 0 once this is set to zero the unit "peasent" is no longer recruitable think of this as a switch to toggle the event.

    Now to link the event to the EDB open your export_descr_buildings.txt

    to link this you will need include the event counter using this line of code

    Code:
    and event_counter holding_london 1
    this should be placed at the end of the units bracket.

    place this line under the garrison_quarters

    Code:
    recruit_pool "Peasants"  1   0.5   4  0  requires factions { england, }    and event_counter holding_london 1
    

    and remove england from the code below
    Code:
    recruit_pool "Peasants"  1   0.7   6  0  requires factions {  england,     france, hre, denmark, spain, portugal, milan, venice, papal_states, Normans, Saxons, }
    Spoiler Alert, click show to read: 






    The campaign

    The peasant unit is no longer available due to England losing London

    Spoiler Alert, click show to read: 




    Recapturing the settlement

    Spoiler Alert, click show to read: 




    England recaptures London and on the next turn the unit is available

    Spoiler Alert, click show to read: 





    Religion scripting( changing a Factions Religion during a campaign)

    so this part of the lesson we are going to look at how to change a faction religion and i don't mean just changing one line of the descr_sm_factions.txt

    Code:
    monitor_event FactionTurnStart
        
            add_events
                event    counter    byzantium_conversion_accepted
                event    counter    byzantium_conversion_declined
                 date    0
       end_add_events
        
      terminate_monitor
    end_monitor
    first thing to set up is an event counter this is acting as our yes or no this we be set up on a the first turn start once and never again hence the terminate_monitor.

    Code:
        
        monitor_event FactionTurnStart FactionType byzantium
            
            if I_NumberOfSettlements byzantium < 10
        
                historic_event byzantium_conversion true factions { byzantium, }
            
                terminate_monitor
        
            end_if
            
        end_monitor
    now we monitor Byzantium's turn start giving the condition of faction type inside this monitor we have an IF statement setup to check the amount of settlements the Byzantines have, and we check for less then 10 this is just a number i decided on you could chose any but this where convenient fro testing purposes, and as the more settlement this faction loses to its catholic neighbors the more likely the faction will convert to save them self's.

    anyway inside this if statement we have the call to the historic_events file and creates a YES/NO event for the faction Byzantium notice the keyword true this is needed for the event to display.

    Code:
        monitor_conditions I_EventCounter byzantium_conversion_accepted = 1
    
                set_religion byzantium catholic
                retire_characters byzantium priest
                change_population_religion byzantium catholic 75 orthodox
                
            terminate_monitor
        
        end_monitor
    now to monitor what our player select yes or no if yes the counter called byzantium_conversion_accepted receives a value of 1 and triggers the condition this monitor handles the command to change the faction over

    set_religion [target faction][target religion]
    retire_characters [target faction] [label]
    change_population_religion [target faction] [target religion] [amount] [religion]

    also the following code is needed when setting up add_events place this into historic_events.txt or you will receive a ctd just before the campaign finishes loading.

    Code:
    {BYZANTIUM_CONVERSION_BODY} some conversion text here
    {BYZANTIUM_CONVERSION_TITLE} Will the byzantines convert?
    Check Religion before conversion

    Spoiler Alert, click show to read: 




    the add_events box for yes or no

    Spoiler Alert, click show to read: 




    Check Religion after conversion

    Spoiler Alert, click show to read: 




    and now the Byzantines can crusade

    Spoiler Alert, click show to read: 




    now with this working you can create and add a new unit into the game using the counter byzantium_conversion_accepted 1 in the EDB, Byzantines could have access to new units after converting think of this as an extra bonus.
    Last edited by J@mes; September 10, 2008 at 06:40 AM.


  2. #2
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Lession 3 - EDB and Religion

    Just noticed this, nice walkthrough there and welcome back. I'll try to get to this in a few days after I get some more of the work on my mod out of the way. The due date is 1 week or 2 after today?

    Cheers,
    Augustus

  3. #3

    Default Re: Lession 3 - EDB and Religion

    Quote Originally Posted by Augustus Lucifer View Post
    Just noticed this, nice walkthrough there and welcome back. I'll try to get to this in a few days after I get some more of the work on my mod out of the way. The due date is 1 week or 2 after today?

    Cheers,
    Augustus
    Hope you enjoy yes i will sort the detail out tomorrow afew more things i need to cover on this.


  4. #4
    Y_filip's Avatar Tiro
    Join Date
    Mar 2008
    Location
    in the galaxy far-far away
    Posts
    212

    Default Re: Lession 3 - EDB and Religion

    great tutorial
    [SIGPIC][/SIGPIC]

  5. #5

    Default Re: Lession 3 - EDB and Religion

    I'm expecting those scripts in from lesson 2 if anybody now wants to be considered for the TWC-U degree. if you are having problem PM me and i can help.


  6. #6

    Default Re: Lession 3 - EDB and Religion

    ok i pmed you it

  7. #7
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Lession 3 - EDB and Religion

    Sorry for my ignorance, but what perchance is the assignment for this week? I've read through the lesson and understand how all of it works just peachy keen, but am not sure what I'm supposed to submit for Lesson 3.

    Cheers,
    Augustus

  8. #8

    Default Re: Lession 3 - EDB and Religion

    Quote Originally Posted by Nakharar View Post
    ok i pmed you it
    thanks nakharar i have yours


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •