Page 3 of 6 FirstFirst 123456 LastLast
Results 41 to 60 of 119

Thread: How-to: Add a background script to your mod

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

    Default Re: How-to: Add a background script to your mod

    Looks like you didn't read my note about what happens if you try to use wait in a monitor_event block.
    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

  2. #42

    Default Re: How-to: Add a background script to your mod

    Agh , sorry HouseofHam .. Then i'll try this instead :

    Spoiler Alert, click show to read: 
    Code:
    monitor_event FactionTurnStart FactionIsLocal
       and I_CompareCounter SettlementOwner_Sparta = 2
       and RandomPercent < 100
    
       console_command toggle_fow
    
    end_monitor
    
    wait 5
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_CompareCounter SettlementOwner_Sparta = 2
       and RandomPercent < 100
    
       console_command toggle_fow
    
    end_monitor


    Again , thx

  3. #43

    Default Re: How-to: Add a background script to your mod

    Let me know what happens, but I don't think it'll apply the wait between monitors -

    it doesn't exactly read everything in order, as far as I can understand, it'll go through all the things not in monitors first unless they have a turn based 'if' clause, then will look up monitors when it gets to
    something with
    monitor_.... FactionTurnEnd
    monitor_... SettlementTurnStart etc type trigger in the order the game normally processes them between turns - eg. you'll get all the FactionTurnEnd's in order you've written them, but whilst it's doing that it won't be processing anything you've written inbetween like FactionTurnStart..

    if you use monitor_conditions you can get away with wait commands, but a lot of open monitor_conditions can make game lag

    unless you're just testing I'm curious; what you're hoping console_command toggle_fow
    will do, I've got a little hitch in my mod that after using reveal_tile, I can't get to hide it again, tried toggle_fow twice and that didn't help.

    P.S.
    waits anywhere the player can bugger it up - by pressing End Turn etc, whilst script is still waiting to do next bit also get you in a mess - if you need to stall script until message or something is cleared a while might be better

  4. #44

    Default Re: How-to: Add a background script to your mod

    Didn't seem to work ~ As you stated .. Let me try the following :

    Spoiler Alert, click show to read: 
    Code:
    monitor_event FactionTurnStart FactionIsLocal
       and I_CompareCounter SettlementOwner_Sparta = 2
       and RandomPercent < 100
    
       console_command toggle_fow
       console_command move_character Kleomenes of Sparta, 139,46
    
    end_monitor
    
    if I_CharacterTypeNearTile greek_cities family, 1 138,46
    
    wait 5
    
    console_command toggle_fow
    console_command move_character Kleomenes of Sparta, 138,46
    
    end_if
    Last edited by Killerbee; May 04, 2009 at 02:16 PM.

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

    Default Re: How-to: Add a background script to your mod

    Try something like this:

    Code:
    declare_counter isFowToggled
    
    monitor_event FactionTurnStart FactionIsLocal
                 and I_CompareCounter SettlementOwner_Sparta = 2
                 and RandomPercent < 100
    
       console_command move_character Kleomenes of Sparta, 139,46
       console_command toggle_fow
       set_counter isFowToggled 1
    end_monitor
    
    monitor_conditions I_CompareCounter isFowToggled = 1
        wait 5
        console_command toggle_fow
        set_counter isFowToggled 0
    end_if
    
    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

  6. #46

    Default Re: How-to: Add a background script to your mod

    Thx , I'll try it out .. The script i posted above yours worked the first time , but didn't work later .. Does the 'I_Compare_Counter' "erase" the counter ? So it's brought to 0 again ?

    Alright , if thos doesn't try , I'll try yours

    Spoiler Alert, click show to read: 
    Code:
    script
    
    if I_SettlementOwner Sparta = greek_cities
    
    set_counter SettlementOwner_Sparta 1
    end_if
    
    if I_SettlementOwner Thermon = greek_cities
    
    inc_counter SettlementOwner_Sparta 1
    end_if
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_CompareCounter SettlementOwner_Sparta = 2
       and RandomPercent < 100
    
       console_command toggle_fow
       console_command move_character Kleomenes of Sparta, 139,46
    
    end_monitor
    
    if I_CharacterTypeNearTile greek_cities family, 1 138,46
    
    wait 5
    
       console_command toggle_fow
       console_command move_character Kleomenes of Sparta, 138,46
       declare_counter SettlementOwner_sparta
       set_counter SettlementOwner_Sparta 1
       inc_counter SettlementOwner_Sparta 1
    
    end_if
    end_script


    Edit : All tries failed .. Now gonna test yours

    Edit 2 : looks like your script did it Awesome HoH ! Well , you are best RTW scripter , or not
    Last edited by Killerbee; May 05, 2009 at 01:18 PM.

  7. #47
    Ramashan's Avatar Artifex
    Join Date
    Apr 2007
    Location
    Los Angeles, CA
    Posts
    4,991

    Default Re: How-to: Add a background script to your mod

    Hey, there may be something existing already, but in the three major scripting tutorials I've read I don't see anywhere where it is broken down like one of the 'complete guides' would be.

    I mean, if I read it enough times I can 'guess' what all the parts of the advicethread section do, but it seems as though these tutorial throw it out there are though you already know it. I'm a bit dense when I first wade into something new and the parts of the Advice thread part like verbosity are completely meaningless to me. Are these important, and if so, is there any tutorial or post that breaks them down as to what each part does?

    Thanks
    Under the Patronage of Lord Condormanius

  8. #48

    Default Re: How-to: Add a background script to your mod

    To be honest , the advice stuff with the treshold and all is the part in scripting that i don't know .. i'd like to learn it too , althoguh i don't think it's very hard .. It's pretty much like traits i guess

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

    Default Re: How-to: Add a background script to your mod

    Yes, it is expected that you already know quite a bit about modding other things before you try scripting. Some of them, like advice threads, you don't really need to know in great detail, since you do it once, and then it's pretty much just cut and paste.

    Code:
    0. ;------------------------------------------
    1. AdviceThread BackgroundScriptThread
    2.    GameArea Campaign
    3.    Item BackgroundScriptItem1
    4.        Uninhibitable
    5.        Verbosity  0
    6.        Threshold  1
    7.        MaxRepeats  0
    8.        RepeatInterval  1
    9.        Attitude Normal
    10.        Presentation Default
    11.        Title BackgroundScriptTitle1
    12.        On_display scripts\show_me\background_script.txt
    13        Text BackgroundScriptText1
    0 - Anything after a semicolon is a comment. Optional.
    1 - Name of the advice thread. Referenced in triggers and/or scripts. Required.
    2 - Where this advice can be seen, ie. Campaign or Battle. Required.
    3 - Name of the advice item block. An advice thread can have multiple of these, each with its own settings and message. Required.
    4 - Not sure, but all advice threads seem to have it. Theoretically, it may have something to do with whether other events in the UI could force it not to display or hide after being displayed without user closing it manually.
    5 - Can be 0-3. 0 - show at any adviser verbosity setting, 1 - high, 2 - medium, 3 - low. Required (in this case). Not sure what the default is.
    6 - How many times the advice thread must be "advanced" (triggered) before the message will actually show. Required (in this case)
    7 - The number of times this message can repeated after the threshold has been reached. Required.
    8 - I think this is the mimimum amount of time that must pass before this advice message would show again. Only makes sense to use if MaxRepeats > 0.
    9 - Ignored. Can also be Angry/Concerned/Excited/Normal, but it doesn't seem to have any effect.
    10 - Ignored.
    11 - Index of the advice title in export_advice.txt. Required.
    12 - On_Display tells it to run the script without waiting for the player to press the "Show me how" button. Can also be Script, then you have to press the button to start the script. The rest is the path to the script. Only present when a thread is used to start a script.
    13 - Index of the advice text in export_advice.txt. Required. There may be multiple Text lines per Item block.

    The Item section can also contain these lines (search EDA for examples):
    - Suppressible y/n - if set to y, will allow the player to click x, then that advice will never show again. Delete the preferences/advice file to reset all.
    - Parameter object - Object can be CharacterName/SettlementName/TargetCharacterName/RegionName/TargetSettlementName and possibly other
    - PauseBattle - pauses the battle when it shows up
    Last edited by HouseOfHam; May 20, 2009 at 10:42 AM.
    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

  10. #50
    Ramashan's Avatar Artifex
    Join Date
    Apr 2007
    Location
    Los Angeles, CA
    Posts
    4,991

    Default Re: How-to: Add a background script to your mod

    Thank you HousofHam.

    I'm actually pretty familiar with most of the other documents in the game just the scripting stuff seemed overly complicated to me, or I just made it seem that way, so I was hoping someone could make it idiot proof for me, which you certainly helped to do. So, thanks again.

    It might be a good idea to add that list to one of the beginning scripting guides floating around here.

    Now to attempt to make my first script.
    Under the Patronage of Lord Condormanius

  11. #51

    Default Re: How-to: Add a background script to your mod

    Believe me Rama , scripting isn't as though as it looks (before you want to start learning it ..) You just need to start off basic , and slowly build your skills up .. Then , try some more complicated stuff .

    A must-download are the RTW docudemons , for both scripting and traits

    Good luck with your scripting-project !

    Btw , i would add the list to my tutorial , but it's HouseOfHam's ; copyright issues and stuff

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

    Default Re: How-to: Add a background script to your mod

    Feel free to quote.
    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

  13. #53

    Default Re: How-to: Add a background script to your mod

    Thx HouseOfHam i'll add an export_descr_advice section soon

    Although i have a problem atm .. I have made a custom mission , and all went well , except for 1 thing : When you have captured the settlement within the right time , you get a message .. however , wehn you don't have it , there should be a message about failure at turn 10 (=9 in-game)

    Here are scripts :


    background_script (setup)
    Spoiler Alert, click show to read: 
    Code:
    script
    
    .. some stuff
    
    ;; Mission setup ;;
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_LocalFaction romans_julii
       and I_TurnNumber = 2
    
    advance_advice_thread first_mission
    
    end_monitor
    
    while I_TurnNumber < 99999
      suspend_unscripted_advice true
    end_while
    end_script


    First mission.txt (in show_me folder)
    Spoiler Alert, click show to read: 
    Code:
    script
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Patavium = romans_julii
       and I_TurnNumber < 10
    
       console_command add_money 50000
       advance_advice_thread first_missions
    
    terminate_monitor
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and not I_SettlementOwner Patavium = romans_julii
       and I_TurnNumber = 10
    
       advance_advice_thread first_missionf
    
    end_monitor
    
    while I_TurnNumber < 99999
    end_while
    
    end_script



    export_descr_advice
    Spoiler Alert, click show to read: 
    Code:
    ;------------------------------------------ 
    AdviceThread first_mission
            GameArea Campaign
    
            Item First_Mission_Text_01
                    Uninhibitable
                    Verbosity  0
                    Threshold  1
                    MaxRepeats  0
                    RepeatInterval  1
                    Attitude Excited
                    Presentation Default
                    Title First_Mission_Text_01_Title
                    Script scripts\show_me\first_mission.txt
                    Text First_Mission_Text_01_Text1
    
    
    
    ;------------------------------------------ 
    AdviceThread first_missions
            GameArea Campaign
    
            Item First_Missions_Text_01
                    Uninhibitable
                    Verbosity  0
                    Threshold  1
                    MaxRepeats  0
                    RepeatInterval  1
                    Attitude Excited
                    Presentation Default
                    Title First_Missions_Text_01_Title
                    Script scripts\show_me\first_mission.txt
                    Text First_Missions_Text_01_Text1
    
    
    
    ;------------------------------------------ 
    AdviceThread first_missionf
            GameArea Campaign
    
            Item First_Missionf_Text_01
                    Uninhibitable
                    Verbosity  0
                    Threshold  1
                    MaxRepeats  0
                    RepeatInterval  1
                    Attitude Excited
                    Presentation Default
                    Title First_Missionf_Text_01_Title
                    Script scripts\show_me\first_mission.txt
                    Text First_Missionf_Text_01_Text1


    and export_advice (in text folder)
    Spoiler Alert, click show to read: 
    HTML Code:
    {First_Mission_Text_01_Title}Your first mission !
    {First_Mission_Text_01_Text1}Your lord has given you your first mission ! He will reward you richely , if you do as he pleases . Capture the settlement 'Patavium'. 
    
    {First_Missions_Text_01_Title}Congratulations !
    {First_Missions_Text_01_Text1}Congratulations ! You have succesfully conquered Patavium within the given time !
    
    {First_Missionf_Text_01_Title}Failure !
    {First_Missionf_Text_01_Text1}You have failed ! Now all we can do is wait for a new mission
    ...



    When the settlement is captured , i egt a 'congratulations' message .. However , when it is not captured , i don't get a 'Failure' message ..

    Any suggestions ?

    Thx in advance ,
    KingTheo

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

    Default Re: How-to: Add a background script to your mod

    The 'not' doesn't work with conditions that use logical operators. Remove the 'not' and use '!=' (not equal) instead of '='.

    Btw, there is no need to run it in a separate script. In fact, it might cause problems. I'd recommend that you move the monitors from First mission.txt into your background script and remove the script line from the first_mission thread.
    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

  15. #55

    Default Re: How-to: Add a background script to your mod

    ahh, I'd realised by experimentation that:
    and not I_CompareCounter counterName = 2
    didn't work but had been getting around it with
    two monitors one for
    and I_CompareCounter counterName > 2
    and one
    and I_CompareCounter counterName < 2

    presumeably
    and I_CompareCounter counterName != 2
    would be the correct solution? I never knew that code option existed!

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

    Default Re: How-to: Add a background script to your mod

    *nod*
    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

  17. #57

    Default Re: How-to: Add a background script to your mod

    Quote Originally Posted by HouseOfHam View Post
    The 'not' doesn't work with conditions that use logical operators. Remove the 'not' and use '!=' (not equal) instead of '='.

    Btw, there is no need to run it in a separate script. In fact, it might cause problems. I'd recommend that you move the monitors from First mission.txt into your background script and remove the script line from the first_mission thread.
    Alright , thanks for your help

  18. #58

    Default Re: How-to: Add a background script to your mod

    Does it matter in wich order your script is set up ? ause i'm getting a CTD , and i have no idea what could be the cause ..

    in background_script.txt

    Spoiler Alert, click show to read: 
    Code:
    ;;;;;;;;;;;;;;;;;;;;;
    ;;;; Mission setup ;;
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_LocalFaction romans_julii
       and I_TurnNumber = 2
    
    advance_advice_thread first_mission
    
    end_monitor
    
    monitor_event FactionturnStart FactionIsLocal
       and I_TurnNumber = 11
       and I_CompareCounter Mission1 = 1
    
       advance_advice_thread second_mission
    
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;
    ;;;; Mission completed ;;;
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Patavium = romans_julii
       and I_TurnNumber < 10
       and I_LocalFaction romans_julii
    
       set_counter Mission1 1
       console_command add_money 50000
       advance_advice_thread first_missions
    
    terminate_monitor
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Patavium != romans_julii
       and I_TurnNumber = 10
    
       advance_advice_thread first_missionf
       set_counter Mission1 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Thermon = romans_julii
       and I_CharacterTypeNearTile romans_julii admiral, 2 139,52
       and I_TurnNumber < 27
    
       set_counter Mission2 1
       advance_advice_thread second_missions
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Thermon != romans_julii
       and I_TurnNumber = 16
    
       set_counter Mission2 1
       advance_advice_thread second_missionf
    
    end_monitor
    
    while I_TurnNumber < 99999
      suspend_unscripted_advice true
    end_while
    end_script


    In EDA :

    Spoiler Alert, click show to read: 
    Code:
    ;------------------------------------------ 
    AdviceThread first_mission
            GameArea Campaign
    
            Item First_Mission_Text_01
                    Uninhibitable
                    Verbosity  0
                    Threshold  1
                    MaxRepeats  0
                    RepeatInterval  1
                    Attitude Excited
                    Presentation Default
                    Title First_Mission_Text_01_Title
                    Script scripts\show_me\background_script.txt
                    Text First_Mission_Text_01_Text1
    
    
    
    ;------------------------------------------ 
    AdviceThread first_missions
            GameArea Campaign
    
            Item First_Missions_Text_01
                    Uninhibitable
                    Verbosity  0
                    Threshold  1
                    MaxRepeats  0
                    RepeatInterval  1
                    Attitude Excited
                    Presentation Default
                    Title First_Missions_Text_01_Title
                    Script scripts\show_me\background_script.txt
                    Text First_Missions_Text_01_Text1
    
    
    
    ;------------------------------------------ 
    AdviceThread first_missionf
            GameArea Campaign
    
            Item First_Missionf_Text_01
                    Uninhibitable
                    Verbosity  0
                    Threshold  1
                    MaxRepeats  0
                    RepeatInterval  1
                    Attitude Excited
                    Presentation Default
                    Title First_Missionf_Text_01_Title
                    Script scripts\show_me\background_script.txt
                    Text First_Missionf_Text_01_Text1
    
    
    
    ;------------------------------------------ 
    AdviceThread second_mission
            GameArea Campaign
    
            Item Second_Mission_Text_01
                    Uninhibitable
                    Verbosity  0
                    Threshold  1
                    MaxRepeats  0
                    RepeatInterval  1
                    Attitude Excited
                    Presentation Default
                    Title Second_Mission_Text_01_Title
                    Script scripts\show_me\background_script.txt
                    Text Second_Mission_Text_01_Text1
    
    
    
    ;------------------------------------------ 
    AdviceThread second_missions
            GameArea Campaign
    
            Item Second_Missions_Text_01
                    Uninhibitable
                    Verbosity  0
                    Threshold  1
                    MaxRepeats  0
                    RepeatInterval  1
                    Attitude Excited
                    Presentation Default
                    Title Second_Missions_Text_01_Title
                    Script scripts\show_me\background_script.txt
                    Text Second_Missions_Text_01_Text1
    
    
    
    ;------------------------------------------ 
    AdviceThread second_missionf
            GameArea Campaign
    
            Item Second_Missionf_Text_01
                    Uninhibitable
                    Verbosity  0
                    Threshold  1
                    MaxRepeats  0
                    RepeatInterval  1
                    Attitude Excited
                    Presentation Default
                    Title Second_Missionf_Text_01_Title
                    Script scripts\show_me\background_script.txt
                    Text Second_Missionf_Text_01_Text1


    And in export_advice (in text folder)

    Spoiler Alert, click show to read: 
    Code:
    {First_Mission_Text_01_Title}Your first mission !
    {First_Mission_Text_01_Text1}Your lord has given you your first mission ! He will reward you richely , if you do as he pleases . Capture the settlement 'Patavium'. 
    
    {First_Missions_Text_01_Title}Congratulations !
    {First_Missions_Text_01_Text1}Congratulations ! You have succesfully conquered Patavium within the given time !
    
    {First_Missionf_Text_01_Title}Failure !
    {First_Missionf_Text_01_Text1}You have failed ! Now all we can do is wait for a new mission ...
    
    {Second_Mission_Text_01_Title}New Mission !
    {second_Mission_Text_01_Text1}Another new mission ! Capture Thermon within the given time , and blockad the port of corinth ..
    
    {Second_Missions_Text_01_Title}Succes !
    {second_Missions_Text_01_Text1}Succes .
    
    {Second_Missionf_Text_01_Title}failure !
    {second_Missionf_Text_01_Text1}failure .


    Notes :

    I am using a modfolder .
    I want to make a first mission , and after that is done , give a new mission (that's the reason for the counters) The first mission works great (i get a message before the mission is completed , and after , and they're both correct)

    But then , at the time the advisor should pop up for the secodn mission , it CTD's ..

    Any help ?

  19. #59

    Default Re: How-to: Add a background script to your mod

    it's probably the advisor thread/text set up causing the problem
    you've got
    Second_Mission_Text_01_Text1
    in EDA
    and
    second_Mission_Text_01_Text1
    in EA
    make them exactly the same including the CAPS by copying and pasting and see if that helps.

  20. #60

    Default Re: How-to: Add a background script to your mod

    Edit : Ah , thanks makanyane , that is probably the problem

    i'll try it out now

Page 3 of 6 FirstFirst 123456 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
  •