Results 1 to 10 of 10

Thread: Power Centers

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    King Siegfried's Avatar Semisalis
    Join Date
    Feb 2009
    Location
    Savannah, GA
    Posts
    474

    Default Power Centers

    I tried searching for "power centers" and didn't find what I was looking for, and unfortunately I didn't know what else to look up... So I'm posting here.

    So I wanted to emulate the Crusades campaign some more and bring back the "Power Centers" - especially for Antioch. Now, I copied and pasted the script they used in Crusades, and just replaced it with the relevant settlements and factions. It doesn't work. The units never show up for recruitment, despite me having the settlements. Here is my current script:
    Spoiler Alert, click show to read: 
    ;Detect if settlement has been lost
    ;Decrement event counter

    monitor_conditions not I_SettlementOwner Jerusalem = jerusalem
    and I_EventCounter holds_jerusalem == 1
    and I_NumberOfSettlements jerusalem > 0
    set_event_counter holds_jerusalem 0
    end_monitor

    monitor_conditions not I_SettlementOwner Antioch = knights_templar
    and I_EventCounter holds_antioch == 1
    and I_NumberOfSettlements knights_templar > 0
    set_event_counter holds_antioch 0
    end_monitor

    monitor_conditions not I_SettlementOwner Edessa = knights_templar
    and I_EventCounter holds_edessa == 1
    and I_NumberOfSettlements knights_templar > 0
    set_event_counter holds_edessa 0
    end_monitor

    ;Detect if settlement has been taken
    ;Increment event counter

    monitor_conditions I_SettlementOwner Jerusalem = jerusalem
    and I_EventCounter holds_jerusalem == 0
    add_events
    event counter holds_jerusalem
    date 0
    end_add_events
    end_monitor

    monitor_conditions I_SettlementOwner Antioch = knights_templar
    and I_EventCounter holds_antioch == 0
    add_events
    event counter holds_antioch
    date 0
    end_add_events
    end_monitor

    monitor_conditions I_SettlementOwner Edessa = knights_templar
    and I_EventCounter holds_edessa == 0
    add_events
    event counter holds_edessa
    date 0
    end_add_events
    end_monitor

    Am I doing this correctly? I could have sworn that I got this working before, so I haven't touched the script since, but I started play-testing KoH and now it is clearly not working lol.

    Any help is greatly appreciated!

    Creator of Kingdoms of Heaven

  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: Power Centers

    Try replacing the add_events with:

    set_event_counter holds_antioch 1

    and similar things. It's much more straightforward. You also need to make sure you have the unit lines in the EDB. The way that script works is extremely simple, it sets an event counter to 1, and then various recruit pool lines in the EDB check for that counter.

  3. #3
    King Siegfried's Avatar Semisalis
    Join Date
    Feb 2009
    Location
    Savannah, GA
    Posts
    474

    Default Re: Power Centers

    Should look like this, yes?
    Spoiler Alert, click show to read: 
    recruit_pool "Knights of Edessa" 1 0.4 2 1 requires factions { knights_templar, } and event_counter holds_edessa 1

    Creator of Kingdoms of Heaven

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

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

    Default Re: Power Centers

    That should work.

  5. #5
    King Siegfried's Avatar Semisalis
    Join Date
    Feb 2009
    Location
    Savannah, GA
    Posts
    474

    Default Re: Power Centers

    custom_script ::
    Spoiler Alert, click show to read: 
    ;Detect if settlement has been lost
    ;Decrement event counter

    monitor_conditions not I_SettlementOwner Jerusalem = jerusalem
    and I_EventCounter holds_jerusalem == 1
    and I_NumberOfSettlements jerusalem > 0
    set_event_counter holds_jerusalem 0
    end_monitor

    monitor_conditions not I_SettlementOwner Antioch = knights_templar
    and I_EventCounter holds_antioch == 1
    and I_NumberOfSettlements knights_templar > 0
    set_event_counter holds_antioch 0
    end_monitor

    monitor_conditions not I_SettlementOwner Edessa = knights_templar
    and I_EventCounter holds_edessa == 1
    and I_NumberOfSettlements knights_templar > 0
    set_event_counter holds_edessa 0
    end_monitor

    ;Detect if settlement has been taken
    ;Increment event counter

    monitor_conditions I_SettlementOwner Jerusalem = jerusalem
    and I_EventCounter holds_jerusalem == 0
    set_event_counter holds_jerusalem 1
    end_monitor

    monitor_conditions I_SettlementOwner Antioch = knights_templar
    and I_EventCounter holds_antioch == 0
    set_event_counter holds_antioch 1
    end_monitor

    monitor_conditions I_SettlementOwner Edessa = knights_templar
    and I_EventCounter holds_edessa == 0
    set_event_counter holds_edessa 1
    end_monitor

    export_descr_buildings ::
    Spoiler Alert, click show to read: 
    recruit_pool "Knights of Jerusalem" 1 0.4 3 1 requires factions { jerusalem, } and event_counter holds_jerusalem 1
    recruit_pool "Knights of Antioch" 1 0.34 3 1 requires factions { knights_templar, } and event_counter holds_antioch 1
    recruit_pool "Knights of Edessa" 1 0.4 2 1 requires factions { knights_templar, } and event_counter holds_edessa 1

    It's not working, but I don't see why it wouldn't... :\

    Creator of Kingdoms of Heaven

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

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

    Default Re: Power Centers

    Is your script working in general? When something stops working for me, I usually split it off into a new script called test_script.txt and change the referenced file in the descr_strat at the bottom. Then I include only that script, and include in each monitor a command like:
    Code:
    log Jerusalem doesn't own Jeruslam FIRED
    Or
    Code:
    historic_event jerusalem_not_owned
    Since those let you insure the script is working as intended.

  7. #7
    King Siegfried's Avatar Semisalis
    Join Date
    Feb 2009
    Location
    Savannah, GA
    Posts
    474

    Default Re: Power Centers

    Only that script? So the only script in the entire game is my power center ones?

    Creator of Kingdoms of Heaven

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

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

    Default Re: Power Centers

    Quote Originally Posted by King Siegfried View Post
    Only that script? So the only script in the entire game is my power center ones?
    Yeah, just make a new file with:
    Code:
    ;
    ; Test Script
    ;
    script
    
    ;Detect if settlement has been lost
    ;Decrement event counter
    
    monitor_conditions not I_SettlementOwner Jerusalem = jerusalem
    and I_EventCounter holds_jerusalem == 1
    and I_NumberOfSettlements jerusalem > 0
    set_event_counter holds_jerusalem 0
    log MONITOR #1 WORKS
    end_monitor
    
    monitor_conditions not I_SettlementOwner Antioch = knights_templar
    and I_EventCounter holds_antioch == 1
    and I_NumberOfSettlements knights_templar > 0
    set_event_counter holds_antioch 0
    log MONITOR #2 WORKS
    end_monitor
    
    monitor_conditions not I_SettlementOwner Edessa = knights_templar
    and I_EventCounter holds_edessa == 1
    and I_NumberOfSettlements knights_templar > 0
    set_event_counter holds_edessa 0
    log MONITOR #3 WORKS
    end_monitor
    
    ;Detect if settlement has been taken
    ;Increment event counter
    
    monitor_conditions I_SettlementOwner Jerusalem = jerusalem
    and I_EventCounter holds_jerusalem == 0
    set_event_counter holds_jerusalem 1
    log MONITOR #4 WORKS
    end_monitor
    
    monitor_conditions I_SettlementOwner Antioch = knights_templar
    and I_EventCounter holds_antioch == 0
    set_event_counter holds_antioch 1
    log MONITOR #5 WORKS
    end_monitor
    
    monitor_conditions I_SettlementOwner Edessa = knights_templar
    and I_EventCounter holds_edessa == 0
    set_event_counter holds_edessa 1
    log MONITOR #6 WORKS
    end_monitor
    
    ;;;;end
        wait_monitors
    
    end_script
    Call it test_script.txt and change the last line in the descr_strat:
    Code:
    script
    test_script.txt
    This is a good method to try out new things that aren't contingent on other scripting factors or to isolate errors. I have a scripts folder where I keep a few miscellaneous scripts like this. The descr_strat reference line accepts paths, so:
    Code:
    script
    scripts/test_script.txt
    works fine.

  9. #9
    King Siegfried's Avatar Semisalis
    Join Date
    Feb 2009
    Location
    Savannah, GA
    Posts
    474

    Default Re: Power Centers

    Well that's weird. I plugged it in like you said to see if that would work and... works fine! I think
    Code:
    ;
    ; Test Script
    ;
    script
     
    ;Detect if settlement has been lost
    ;Decrement event counter
    made all the difference in the world. So now my power centers are working! Hooray! If that made no difference, then I don't know what made it decide to work, but it's working, so... yeah.

    Thank you so much for all your patience and help, Augustus. I feel so bad because, for the most part, scripting goes right over my head. I can mod this game in just about every other aspect, but I just can't seem to wrap my head around scripting. So again... thank you SO much for your help! +rep

    Creator of Kingdoms of Heaven

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

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

    Default Re: Power Centers

    Good to hear.

    script is the initializer, it couples with end_script to make the file valid.

Posting Permissions

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