Page 5 of 6 FirstFirst 123456 LastLast
Results 81 to 100 of 119

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

  1. #81

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

    Scripts causing CTDs when starting up your game ?

  2. #82
    Arbitrary Crusader's Avatar Praefectus
    Join Date
    Oct 2009
    Location
    In his own delusional mind
    Posts
    6,876

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

    Yes...

    ♪ Now it's over, I'm dead and I haven't done anything that I want, or I'm still alive and there's nothing I want to do

  3. #83

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

    If you disable the script (out-comment the line that references your background script) the game still crashes?

  4. #84
    Arbitrary Crusader's Avatar Praefectus
    Join Date
    Oct 2009
    Location
    In his own delusional mind
    Posts
    6,876

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

    umm,It when I've put a new trigger,then when I've load up the game It crash.
    Sorry if that not enough,I'm new to modding...

    ♪ Now it's over, I'm dead and I haven't done anything that I want, or I'm still alive and there's nothing I want to do

  5. #85

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

    To create a script more things in more than one files are needed than just the trigger, so could you please post here which file(s) you edited and what exactly you did, so that people can better help you?

  6. #86
    Arbitrary Crusader's Avatar Praefectus
    Join Date
    Oct 2009
    Location
    In his own delusional mind
    Posts
    6,876

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

    I've edit the export_descr_advice

    The text folder export_advice(for {BackgroundScriptTitle1}Background Script {BackgroundScriptText1}Script started).

    descr_strat(to add the years, and the the line ;script
    ;campaign_script.txt at the bottom.)

    made the campaign_script.txt.

    And finally made a background_script.txt( which contain 4TPY from SQPR mod.).
    .

    ♪ Now it's over, I'm dead and I haven't done anything that I want, or I'm still alive and there's nothing I want to do

  7. #87

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

    Please post the actual code? Put it in [code] tags, if you don't mind, more readable.

    It's probably an error in descr_strat...

  8. #88
    Arbitrary Crusader's Avatar Praefectus
    Join Date
    Oct 2009
    Location
    In his own delusional mind
    Posts
    6,876

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

    Quote Originally Posted by Aradan View Post
    Please post the actual code? Put it in [code] tags, if you don't mind, more readable.

    It's probably an error in descr_strat...
    Code:
    background_script.txt
    Code:
     export_descr_advice
    Code:
    export_advice
    Code:
    descr_strat
    Code:
    made the campaign_script.txt
    Code:
    background_script.txt

    ♪ Now it's over, I'm dead and I haven't done anything that I want, or I'm still alive and there's nothing I want to do

  9. #89

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

    Sorry, should have explained better. I meant like this:

    Code:
    ; >>>> start of regions section <<<<
    
    [...]
    blablabla - code
    [...]
    
    
    script
    campaign_script.txt
    etc, not the names of the files, or your text. The actual in-game code near the sections of the file that you edited.

  10. #90
    Arbitrary Crusader's Avatar Praefectus
    Join Date
    Oct 2009
    Location
    In his own delusional mind
    Posts
    6,876

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

    Quote Originally Posted by Aradan View Post
    Sorry, should have explained better. I meant like this:

    Code:
    ; >>>> start of regions section <<<<
    
    [...]
    blablabla - code
    [...]
    
    
    script
    campaign_script.txt
    etc, not the names of the files, or your text. The actual in-game code near the sections of the file that you edited.
    Ok.

    export_descr_advice
    Code:
    ;------------------------------------------
    ;AdviceThread BackgroundScriptThread
    ;    GameArea Campaign
    ;
    ;    Item BackgroundScriptItem1
    ;        Uninhibitable
    ;        Verbosity  0
    ;        Threshold  1
    ;        MaxRepeats  0
    ;        RepeatInterval  1
    ;        Attitude Normal
    ;        Presentation Default
    ;        Title BackgroundScriptTitle1
    ;        On_display scripts\show_me\background_script.txt
    ;        Text BackgroundScriptText1
    Code:
    Trigger background_script_trigger_1
        WhenToTest ButtonPressed
    
        Condition ButtonPressed faction_button
    
        AdviceThread BackgroundScriptThread  1
    
    ;------------------------------------------
    Trigger background_script_trigger_2
        WhenToTest ButtonPressed
    
        Condition ButtonPressed construction_button
    
        AdviceThread BackgroundScriptThread  1
    
    ;------------------------------------------
    Trigger background_script_trigger_3
        WhenToTest ButtonPressed
    
        Condition ButtonPressed recruitment_button
    
        AdviceThread BackgroundScriptThread  1
    
    ;------------------------------------------
    Trigger background_script_trigger_4
        WhenToTest SettlementSelected
    export_advice
    Code:
    ¬***********************************************************
    ¬*                                                         *
    ¬* CAMPAIGN ADVICE                                         *
    ¬*                                                         *
    ¬***********************************************************
    
    
    ¬-------------------
    
    {BackgroundScriptTitle1}Background Script
    {BackgroundScriptText1}Script started.
    descr_strat
    Code:
    ; >>>> start of regions section <<<<
    ;script
    ;campaign_script.txt
    
    start_date    -215 summer
    end_date    260 summer
    campaign_script.txt
    Code:
    script
    
    wait 1
    advance_advice_thread BackgroundScriptThread
    wait 1
    select_ui_element advisor_portrait_button
    simulate_mouse_click lclick_up
    
    end_script
    background_script.txt
    Code:
    script
        console_command date -215
        console_command season summer
        while I_TurnNumber = 0
        end_while
    
        console_command date -215
        console_command season summer
        while I_TurnNumber = 1
        end_while
    
        console_command date -215
        console_command season summer
        while I_TurnNumber = 2
        end_while
    
        console_command date -215
        console_command season winter
        while I_TurnNumber = 3
        end_while
    
        console_command date -214
        console_command season summer
        while I_TurnNumber = 4
        end_while
    
        console_command date -214
        console_command season summer
        while I_TurnNumber = 5
        end_while
    
        console_command date -214
        console_command season summer
        while I_TurnNumber = 6
        end_while
    
        console_command date -214
        console_command season winter
        while I_TurnNumber = 7
        end_while
    
        console_command date -213
        console_command season summer
        while I_TurnNumber = 8
        end_while
    etc etc etc.It go on for long time
    At the end:
        console_command date 260
        console_command season summer
        while I_TurnNumber = 1900
        end_while
    end_script

    ♪ Now it's over, I'm dead and I haven't done anything that I want, or I'm still alive and there's nothing I want to do

  11. #91

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

    Need help trying to work a script that will deleat 1 unit and then create a new 1

    This will hopefully work for upgrading units with better weapons acuracy anything ie RTW once hastati get 3 ceverons they could be replaced by princieps or ETW once a unit reaches a certain level it could be replaced with a simular unit with longer range and better acuracy.

    i thought something like this may work

    script

    declare_counter loop
    set_counter loop 0
    monitor_event FactionTurnStart FactionIsLocal
    and Rome "roman hastati" 1 exp3
    console_command strat_disband_unit Rome "roman hastati" 1 exp 3
    console_command create_unit Rome "roman princeps" 1
    end_monitor
    while I_CompareCounter loop = 0
    end_while

    the unit to be deleated would probably have to be in a city or outside on its own to get the named charactor for the captain and then Kill_charactor could be used?

    Mayby disband_unit_button could work.

    the recruting seems straight forward but deleation is hard.

    Any sugestions/help welcome thx
    Last edited by FB_Bob; March 22, 2010 at 01:15 PM.

  12. #92
    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

    There is no way to disband a unit in RTW/BI, short of killing it off during battle.

    @EvilNelson666:

    The 2 lines that are supposed to fire up the campaign script are commented out in descr_strat.txt. Uncomment them by removing the semicolons at the beginning of the lines, and move them to the very end of the file.
    Last edited by HouseOfHam; March 22, 2010 at 04:01 PM.
    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. #93

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

    i was thinking that if a unit was in a city it could be scripted someway to check the city for units via army selection or similar, then maybe set_cards_selectable true/false to find the unit your after and disband_unit_button, may need simulate_mouse_click, this mite work.

    What do you think?

    thx for replie

  14. #94
    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

    I've tried it before, but could never get it to work. Maybe you'll have better luck (but I wouldn't bet on it). Also, AI factions don't use the UI.
    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. #95

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

    what about sometyhing like

    script

    declare_counter loop
    set_counter loop 0
    monitor_event FactionTurnStart FactionIsLocal

    console_command select_settlement Rome
    console_command set_cards_selectable
    console_command call_object_shortcut army_overview_button
    console_command simulate_mouse_click
    console_command UnitType "roman hastati" 1 exp 3
    console_command simulate_mouse_click
    console_command disband_unit_button
    console_command simulate_mouse_click
    console_command create_unit Rome "roman princeps" 1
    end_monitor
    while I_CompareCounter loop = 0
    end_while


    what do you think? any sugestions that could help thx in advance

  16. #96
    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

    - Only commands listed in console_command.txt need to be prefixed with console_command
    - I would suggest narrowing down the monitor to Rome and checking the owner before you try to do anything there
    - For the call_object_shortcut command, you may need to add strat_ui before the button name
    - Not sure if you need the mouse click commands if you use call_object_shortcut. In any case, the proper syntax is simulate_mouse_click lclick_down|lclick_up
    - Not sure how to select a specific unit (not the way you tried)

    Code:
    script
    
    declare_counter loop
    set_counter loop 0
    
    monitor_event SettlementTurnStart SettlementName Rome
                  and SettlementIsLocal
    
        e_select_settlement
        set_cards_selectable true
        call_object_shortcut army_overview_button
    
        ; select unit to disband
    
        call_object_shortcut disband_unit_button
        console_command create_unit Rome "roman princeps" 1
    end_monitor
    
    while I_CompareCounter loop = 0
    end_while
     
    end_script
    Last edited by HouseOfHam; March 23, 2010 at 10:58 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

  17. #97

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

    Theres Unit_info_scroll or hud_show_units_tab
    or maybe if the unit was at a pos on map it could be pointed at with cursor and then clicked on
    or maybe it could be done via a keyboard macro
    For disbanding ui_flash_start disband_unit_button could help

    thx for taking a look HoH
    Last edited by FB_Bob; April 10, 2010 at 02:50 AM.

  18. #98

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

    Hello Can someone help me, because my script does not seem to work
    if everything is okay?

    Spoiler Alert, click show to read: 


    script

    declare_show_me

    suspend_during_battle on
    suspend_unscripted_advice true

    ;;;;;;;;;;;;;;;;ONE AI BONUS

    monitor_event FactionTurnStart FactionType romans_julii
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money romans_julii, 40000
    console_command add_money romans_julii, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; egypt

    monitor_event FactionTurnStart FactionType egypt
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money egypt, 40000
    console_command add_money egypt, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; seleucid

    monitor_event FactionTurnStart FactionType seleucid
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money seleucid, 40000
    console_command add_money seleucid, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; carthage

    monitor_event FactionTurnStart FactionType carthage
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money carthage, 40000
    console_command add_money carthage, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; parthia

    monitor_event FactionTurnStart FactionType parthia
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money parthia, 40000
    console_command add_money parthia, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; gauls

    monitor_event FactionTurnStart FactionType gauls
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money gauls, 40000
    console_command add_money gauls, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; germans

    monitor_event FactionTurnStart FactionType germans
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money germans, 40000
    console_command add_money germans, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; britons

    monitor_event FactionTurnStart FactionType britons
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money britons, 40000
    console_command add_money britons, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; greek_cities

    monitor_event FactionTurnStart FactionType greek_cities
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money greek_cities, 40000
    console_command add_money greek_cities, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; macedon

    monitor_event FactionTurnStart FactionType macedon
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money macedon, 40000
    console_command add_money macedon, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; pontus

    monitor_event FactionTurnStart FactionType pontus
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money pontus, 40000
    console_command add_money pontus, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; armenia

    monitor_event FactionTurnStart FactionType armenia
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money armenia, 40000
    console_command add_money armenia, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; dacia

    monitor_event FactionTurnStart FactionType dacia
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money dacia, 40000
    console_command add_money dacia, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; numidia

    monitor_event FactionTurnStart FactionType numidia
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money numidia, 40000
    console_command add_money numidia, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; scythia

    monitor_event FactionTurnStart FactionType scythia
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money scythia, 40000
    console_command add_money scythia, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; spain

    monitor_event FactionTurnStart FactionType spain
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money spain, 40000
    console_command add_money spain, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; thrace

    monitor_event FactionTurnStart FactionType thrace
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money thrace, 40000
    console_command add_money thrace, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; romans_scipii

    monitor_event FactionTurnStart FactionType romans_scipii
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money romans_scipii, 40000
    console_command add_money romans_scipii, 40000
    suspend_unscripted_advice true
    end_monitor


    ;; romans_brutii

    monitor_event FactionTurnStart FactionType romans_brutii
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money romans_brutii, 40000
    console_command add_money romans_brutii, 40000
    suspend_unscripted_advice true
    end_monitor

  19. #99

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

    it seems to me that you forgot to actually end your script

  20. #100

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

    Quote Originally Posted by Mr.Blackadder View Post
    it seems to me that you forgot to actually end your script
    uppsss sorry but this isn't all

    Spoiler Alert, click show to read: 

    ;;;;;;;;;;;;;;;;;;;;;
    ;; AI Money script ;;
    ;;;;;;;;;;;;;;;;;;;;;

    script

    declare_show_me

    suspend_during_battle on
    suspend_unscripted_advice true

    ;;;;;;;;;;;;;;;;ONE AI BONUS

    monitor_event FactionTurnStart FactionType romans_julii
    and not FactionIsLocal
    and I_TurnNumber = 0
    console_command add_money romans_julii, 40000
    console_command add_money romans_julii, 40000
    suspend_unscripted_advice true
    end_monitor


    ;;;;;;;;;;;;;;;;AI BONUS

    monitor_event FactionTurnStart Treasury < -50000
    and FactionType romans_julii
    and not FactionIsLocal
    console_command add_money romans_julii, 40000
    console_command add_money romans_julii, 40000
    console_command add_money romans_julii, 30000
    end_monitor
    monitor_event FactionTurnStart Treasury < -10000
    and FactionType romans_julii
    and not FactionIsLocal
    console_command add_money romans_julii, 40000
    console_command add_money romans_julii, 10000
    end_monitor
    monitor_event FactionTurnStart Treasury < -2000
    and FactionType romans_julii
    and not FactionIsLocal
    console_command add_money romans_julii, 12000
    end_monitor
    monitor_event FactionTurnStart Treasury < -500
    and FactionType romans_julii
    and not FactionIsLocal
    console_command add_money romans_julii, 6000
    end_monitor
    monitor_event FactionTurnStart Treasury < 0
    and FactionType romans_julii
    and not FactionIsLocal
    console_command add_money romans_julii, 5000
    end_monitor


    end_script


    Why are fractions, not receive money?

    Last edited by Tiberius Caesar Augustus; March 28, 2010 at 07:00 AM.

Page 5 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
  •