Page 1 of 2 12 LastLast
Results 1 to 20 of 36

Thread: Problems with new campaign script

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    julianus heraclius's Avatar The Philosopher King
    Join Date
    May 2006
    Location
    Australia
    Posts
    5,382

    Default Problems with new campaign script

    Hi folks,

    I need some help. I developed a campaign script for my 355AD Imerium Julianorum campaign but parts of it seem to not be working properly. It is the following section, when Julian gains the Italian Peninsula that I can't seem to get to wok properly

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Juliani Faction captures Verona - Gains Italian Peninsula
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    monitor_event FactionTurnStart FactionType empire_west
    and I_SettlementOwner Patavium = empire_west
    and I_LocalFaction empire_west
    console_command capture_settlement Ravenna
    console_command create_unit Ravenna "milites" 3 1 1 1
    console_command create_unit Ravenna "limitaneiA2-1" 4 1 1 1
    console_command create_unit Ravenna "western archer helmet" 2 1 1 1
    console_command create_unit Ravenna "arcuballistarii" 1 1 1 1
    console_command create_unit Ravenna "equites auxilia west" 4 1 1 1
    console_command capture_settlement Arretium
    console_command create_unit Arretium "milites" 2 1 1 1
    console_command capture_settlement Asculum
    console_command create_unit Asculum "milites" 2 1 1 1
    console_command capture_settlement Rome
    console_command create_unit Rome "scholae palatinae gentilium" 1 2 2 2
    console_command create_unit Rome "scholae palatinae" 2 2 2 2
    console_command create_unit Rome "domesticorum equitum" 1 2 2 2
    console_command create_unit Rome "domesticorum pedites" 1 2 2 2
    console_command create_unit Rome "milites" 3 1 1 1
    console_command create_unit Rome "limitaneiA2-1" 4 1 1 1
    console_command create_unit Rome "western archer helmet" 2 1 1 1
    console_command create_unit Rome "arcuballistarii" 1 1 1 1
    console_command create_unit Rome "equites auxilia west" 4 1 1 1
    console_command capture_settlement Neapolis
    console_command create_unit Neapolis "milites" 3 1 1 1
    console_command capture_settlement Tarentum
    console_command create_unit Tarentum "milites" 3 1 1 1
    console_command capture_settlement Croton
    console_command create_unit Croton "milites" 3 1 1 1
    console_command capture_settlement Syracuse
    console_command create_unit Syracuse "milites" 5 1 1 1
    console_command add_money empire_west, 200000
    advance_advice_thread Italian_Peninsula_Captured_Thread
    terminate_monitor
    end_monitor

    It does seem to work, but everytime the game is loaded the person gains the peninsula again!! with more troops and money. How can I fix it so that it only occurs when Patavium (Verona) has been captured.

    Oh, and I tried this:

    monitor_event GeneralCaptureSettlement FactionType empire_west
    and SettlementName Patavium

    as a substitute heading, but the script didn't activate.

    IJ is a BI mod.

    Any help would be appreciated.

    Thanks

    Avatar & Signature by Joar

  2. #2

    Default Re: Problems with new campaign script

    i think the terminate_monitor doesn't "terminate" whenever you re-load the game .. Maybe with some counters ? try this :

    Code:
    script
    
    declare_counter reset
    set_counter reset 0
    
    monitor_event GameReloaded TrueCondition
      and I_SettlementOwner Patavium = empire_west
    
    set_counter reset 1
    
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Juliani Faction captures Verona - Gains Italian Peninsula
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    monitor_event FactionTurnStart FactionType empire_west
    and I_SettlementOwner Patavium = empire_west
    and I_LocalFaction empire_west
    and I_CompareCounter reset = 0
    
    console_command capture_settlement Ravenna
    console_command create_unit Ravenna "milites" 3 1 1 1
    console_command create_unit Ravenna "limitaneiA2-1" 4 1 1 1
    console_command create_unit Ravenna "western archer helmet" 2 1 1 1
    console_command create_unit Ravenna "arcuballistarii" 1 1 1 1
    console_command create_unit Ravenna "equites auxilia west" 4 1 1 1
    console_command capture_settlement Arretium
    console_command create_unit Arretium "milites" 2 1 1 1
    console_command capture_settlement Asculum
    console_command create_unit Asculum "milites" 2 1 1 1
    console_command capture_settlement Rome
    console_command create_unit Rome "scholae palatinae gentilium" 1 2 2 2
    console_command create_unit Rome "scholae palatinae" 2 2 2 2
    console_command create_unit Rome "domesticorum equitum" 1 2 2 2
    console_command create_unit Rome "domesticorum pedites" 1 2 2 2
    console_command create_unit Rome "milites" 3 1 1 1
    console_command create_unit Rome "limitaneiA2-1" 4 1 1 1
    console_command create_unit Rome "western archer helmet" 2 1 1 1
    console_command create_unit Rome "arcuballistarii" 1 1 1 1
    console_command create_unit Rome "equites auxilia west" 4 1 1 1
    console_command capture_settlement Neapolis
    console_command create_unit Neapolis "milites" 3 1 1 1
    console_command capture_settlement Tarentum
    console_command create_unit Tarentum "milites" 3 1 1 1
    console_command capture_settlement Croton
    console_command create_unit Croton "milites" 3 1 1 1
    console_command capture_settlement Syracuse
    console_command create_unit Syracuse "milites" 5 1 1 1
    console_command add_money empire_west, 200000
    advance_advice_thread Italian_Peninsula_Captured_Thread
    set_counter reset 1
    
    end_monitor
    dunno if it'll work though ..

    Some explanation : the first time you capture Patavium , this script will fire , and the 'reset' counter will be set to 1 , so the script can't fire (it requires the counter to be 0) However , if the script has fired once , and you're not in control of Patavium , and you retake the city , you'll egt the whole event refiring .. It's because RTW can't "remember" the values how they were the last time you played ..
    Last edited by Killerbee; July 01, 2009 at 05:24 PM.

  3. #3
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: Problems with new campaign script

    Create an indestructible building in that settlement when the monitors fires and add a condition that it must not exist.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  4. #4

    Default Re: Problems with new campaign script

    Yea , i was waiting for HouseofHam's backup that is idd a nice workaround .. i assume an indestructable building could be like a farm type of building ?

  5. #5
    julianus heraclius's Avatar The Philosopher King
    Join Date
    May 2006
    Location
    Australia
    Posts
    5,382

    Default Re: Problems with new campaign script

    Quote Originally Posted by KingTheoden1 View Post
    Yea , i was waiting for HouseofHam's backup that is idd a nice workaround .. i assume an indestructable building could be like a farm type of building ?
    Thanks Guys, but who would you include the farm building in the script?

    Thanks

    Avatar & Signature by Joar

  6. #6
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: Problems with new campaign script

    Doesn't have to be a farm. Any building with the "hinterland_" prefix in its name is indestructible (though, the number of such buildings is limited). Ideally, you'd create a special new building to serve as a marker for your script, and make it so player cannot build it. Then, if that building is present in the settlement, you'll know for sure it was created by the script. To make it so it can't be built by player, add hidden resource nowhere at the top of EDB, and add requires hidden_resource nowhere to that building construction conditions.

    To spawn the building itself, use this command:
    Code:
     create_building 
      Availability:  campaign 
      Usage:  create_building <settlement_name> <building_level_id> : creates a building of the specified type in a settlement; for building level id's see export_descr_building.txt
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  7. #7
    julianus heraclius's Avatar The Philosopher King
    Join Date
    May 2006
    Location
    Australia
    Posts
    5,382

    Default Re: Problems with new campaign script

    Sorry for my ignorance, but I can't how this prevents the reoccurance. Are you saying that to prevent the trigger from happening more than once in the game you include a spawn "hinterland_building" that cannot be constructed by any faction? How does that work and how would it be included in my script at my first posting??

    Thanks

    Avatar & Signature by Joar

  8. #8

    Default Re: Problems with new campaign script

    Well , because counters aren't remembered when you exit the game in RTW , you need another way to find out how if script works .. there are some ways : traits/ancillaries (although the character that holds them can die , so the script wil refire) , indestroyable buildings (best way) , .. For instance , if you added this is your script :

    Code:
    script
    
    monitor_event FactionTurnStart FactionIsLocal
      and not FactionwideAncillaryExists <new_ancillary> 
    
    console_command add_money romans_julii 5000
    console_command give_ancillary <Character> <new_ancillary>
    
    end_monitor
    end_script
    So , when a character gets this ancillary , the script can't fire , cause the conditions require that the ancillary doesn't exist . unfortuantely , you made a mod for BI , and not Alex (cause in Alex , you can hide a character , make him immortal , and give him the ancillary , so he can't die)

    But , you made it for BI , so you'll need to work with buildings .. principle is the same Check the docudemons for info .

    You should use this :

    Code:
    console_command create_building
    Docudemon info :
    Code:
      Usage:  create_building <settlement_name> <building_level_id> : creates a building of the specified type in a settlement; for building level id's see export_descr_building.txt
    And this condition :

    Code:
    Identifier:              SettlementBuildingExists
    Trigger requirements:    settlement
    Parameters:              building description, logic token, test level
    Sample use:              SettlementBuildingExists = governors_house
    better sample use :

    Code:
    monitor_event SettlementTurnStart SettlementName Patavium
      and not SettlementBuildingExists <new_building>
    
    -commands-
    
    end_monitor
    Cheers
    Last edited by Killerbee; July 03, 2009 at 03:38 AM.

  9. #9
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Problems with new campaign script

    Code:
    and FactionwideAncillaryExists <new_ancillary> false ; could also be true
    The above is incorrect FactionwideAncillaryExists takes a single parameter, the ancillary to check, if you want to check for the existence of the ancillary use:

    Code:
    and FactionwideAncillaryExists <new_ancillary>
    If you want to check for the lack of the ancillary use:

    Code:
    and not FactionwideAncillaryExists <new_ancillary>
    EDIT: You're best bet to keep state when loading is to script hidden traits that keep track of counters onto the faction leader of the human faction when the game is saved, and then read and remove them when the save game is loaded.
    Last edited by Squid; July 02, 2009 at 01:49 PM.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  10. #10

    Default Re: Problems with new campaign script

    Ah , thx for correcting me Squid

  11. #11

    Default Re: Problems with new campaign script

    Linked to HoH's suggestion, here is a sample piece of what I use in my campaigns:

    Code:
    monitor_event SettlementTurnStart SettlementName Sinope
    and not SettlementBuildingExists = monument_victory_minor
    and I_LocalFaction romans_julii
    and I_SettlementOwner Amisos = romans_julii
    and I_SettlementOwner Amaseia = romans_julii
    and I_SettlementOwner Sinope = romans_julii
    and I_SettlementOwner Heraklia = romans_julii
    and I_SettlementOwner Trapezus = romans_julii
    				advance_advice_thread Season_Year_Turn30_Thread
    				wait 1
    				select_ui_element advisor_portrait_button
    				simulate_mouse_click lclick_down
    				simulate_mouse_click lclick_up
    console_command create_building Sinope monument_victory_minor
    console_command add_money romans_julii, 20000
    	suspend_unscripted_advice true
    terminate_monitor
    Hope this helps.

  12. #12

    Default Re: Problems with new campaign script

    Is the 'terminate_monitor' necessary ? Cause it can only run once , since it will create a building the first time it launches , and it requires that the building doesn't exist ..

  13. #13

    Default Re: Problems with new campaign script

    Well, I like to make sure of things.

    Besides, the "terminate" word is such a lovely one. I wish it could be used in RL too...

  14. #14

    Default Re: Problems with new campaign script

    lol Terminate school would be nice idd

  15. #15
    HouseOfHam's Avatar Primicerius
    Join Date
    Apr 2007
    Location
    Minnesota, USA
    Posts
    3,030

    Default Re: Problems with new campaign script

    Unless it's M2TW, the wait command would freeze the script when used inside monitor_event.
    RTR website/SVN admin

    - Settlement coordinate locator -for RTW/M2TW
    - EDB Validator v1.2.8 (Oct 16, 2012) - for RTW/M2TW
    - RTW scripting tutorials
    - n-turns per year script generator

  16. #16

    Default Re: Problems with new campaign script

    Thanks for the tip, HoH. Although I have used it this way in every mod, without having adverse effects.

  17. #17
    julianus heraclius's Avatar The Philosopher King
    Join Date
    May 2006
    Location
    Australia
    Posts
    5,382

    Default Re: Problems with new campaign script

    Thanks Guys, I'll try the suggestions and report back.

    Cheers

    Avatar & Signature by Joar

  18. #18
    julianus heraclius's Avatar The Philosopher King
    Join Date
    May 2006
    Location
    Australia
    Posts
    5,382

    Default Re: Problems with new campaign script

    OK Guys,

    I tried your suggestion with the following:

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Declare Counters
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    declare_counter settlementowner_Patavium
    monitor_event GameReloaded TrueCondition
    and I_SettlementOwner Patavium = empire_west
    set_counter settlementowner_Patavium 1
    end_monitor

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Juliani Faction captures Verona - Gains Italian Peninsula
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    monitor_event FactionTurnStart FactionType empire_west
    and I_SettlementOwner Patavium = empire_west
    and I_LocalFaction empire_west
    and I_CompareCounter settlementowner_Patavium = 0
    console_command capture_settlement Ravenna
    console_command create_unit Ravenna "milites" 3 1 1 1
    console_command create_unit Ravenna "limitaneiA2-1" 4 1 1 1
    console_command create_unit Ravenna "western archer helmet" 2 1 1 1
    console_command create_unit Ravenna "arcuballistarii" 1 1 1 1
    console_command create_unit Ravenna "equites auxilia west" 4 1 1 1
    console_command capture_settlement Arretium
    console_command create_unit Arretium "milites" 2 1 1 1
    console_command capture_settlement Asculum
    console_command create_unit Asculum "milites" 2 1 1 1
    console_command capture_settlement Rome
    console_command create_unit Rome "scholae palatinae gentilium" 1 2 2 2
    console_command create_unit Rome "scholae palatinae" 2 2 2 2
    console_command create_unit Rome "domesticorum equitum" 1 2 2 2
    console_command create_unit Rome "domesticorum pedites" 1 2 2 2
    console_command create_unit Rome "milites" 3 1 1 1
    console_command create_unit Rome "limitaneiA2-1" 4 1 1 1
    console_command create_unit Rome "western archer helmet" 2 1 1 1
    console_command create_unit Rome "arcuballistarii" 1 1 1 1
    console_command create_unit Rome "equites auxilia west" 4 1 1 1
    console_command capture_settlement Neapolis
    console_command create_unit Neapolis "milites" 3 1 1 1
    console_command capture_settlement Tarentum
    console_command create_unit Tarentum "milites" 3 1 1 1
    console_command capture_settlement Croton
    console_command create_unit Croton "milites" 3 1 1 1
    console_command capture_settlement Syracuse
    console_command create_unit Syracuse "milites" 5 1 1 1
    console_command add_money empire_west, 200000
    advance_advice_thread Italian_Peninsula_Captured_Thread
    set_counter settlementowner_Patavium 1
    end_monitor

    The script worked, but every time I reloaded the game I would gain the Italian peninsula again. When I tried including the and not SettlementBuildingExists =farms+1, the script wouldn't activate.

    Any suggestions.

    Thanks

    Avatar & Signature by Joar

  19. #19

    Default Re: Problems with new campaign script

    If there are any building trees left, make a new tree and call it something like hinterland_marker or hinterland_monument and make a level maker or monument. Leave out everything about the counters. Then try this:
    Code:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;Juliani Faction captures Verona - Gains Italian Peninsula
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    monitor_event FactionTurnStart FactionType empire_west
    and I_SettlementOwner Patavium = empire_west
    and I_LocalFaction empire_west
    and not SettlementBuildingExists = monument
    console_command create_building Patavium monument
    then the rest

    Expand your borders, a mod based on XGM 5.

  20. #20

    Default Re: Problems with new campaign script

    Yep , as i said earlier , counters aren't remembered when you exit and reload the game (unless you're modding M2:TW) You should have buildings , and if you don't have any traits , try some kind of trait system ?

Page 1 of 2 12 LastLast

Posting Permissions

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