Page 3 of 4 FirstFirst 1234 LastLast
Results 61 to 90 of 116

Thread: An Intermediate Guide to Scripting

  1. #61
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: An Intermediate Guide to Scripting

    diplomatic_stance
    Availability: campaign
    Usage: diplomatic_stance <faction_a> <faction_b> <allied/neutral/war>:
    Set the diplomatic stance between the two factions
    So the usage in a script would look like this:

    Code:
         console_command diplomatic_stance romans_brutii parthia neutral
         console_command diplomatic_stance romans_julii parthia neutral
         console_command diplomatic_stance romans_scipii parthia neutral
         console_command diplomatic_stance romans_senate parthia neutral
    That makes all the roman factions "Neutral" toward Parthia, whether they were are war or allied. Note that only allied, neutral and war are available - there does not appear to be a way to force protectorates (I only mention this since that's what people usually seem to be looking for).

  2. #62
    Member Member Piko's Avatar
    Join Date
    Dec 2004
    Location
    Belgium,Bredene
    Posts
    59

    Default Re: An Intermediate Guide to Scripting

    Thanks, that was easier than I thought it was.
    (BTW I'm Piko on the RTR forums, that was the only thing I wasn't able to locate in your TFT files, thanks again!)

    Yet another question, can you force ownership?
    Last edited by Piko; 04-29-2006 at 19:15.

  3. #63

    Default Re: An Intermediate Guide to Scripting

    Can you count how many battles the player has fought in the campaign so far?

    For the glory of Rome

  4. #64
    Bibliophilic Member Atilius's Avatar
    Join Date
    Oct 2005
    Location
    America Medioccidentalis Superior
    Posts
    3,837

    Post Re: An Intermediate Guide to Scripting

    Is this what you're looking for? It doesn't actually return a number unfortunately.

    Code:
    ---------------------------------------------------
    Identifier:              BattlesFought
    Trigger requirements:    faction
    Parameters:              logic token, quantity
    Sample use:              BattlesFought = 6
    Description:             How many battles has the player fought so far during this campaign?
    Battle or Strat:         Either
    Class:                   BATTLES_FOUGHT
    Implemented:             Yes
    Author:                  Guy
    ---------------------------------------------------
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  5. #65

    Default Re: An Intermediate Guide to Scripting

    What do you mean?
    Does it work for IF and WHILE statements?

    For the glory of Rome

  6. #66

    Default Re: An Intermediate Guide to Scripting

    Nope, it has an import - the only conditions that work with if and while statements are prefixed with I_
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  7. #67
    Member Member Piko's Avatar
    Join Date
    Dec 2004
    Location
    Belgium,Bredene
    Posts
    59

    Default Re: An Intermediate Guide to Scripting

    Can you force ownership of a city? If so can I have the code please?

  8. #68
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: An Intermediate Guide to Scripting

    console_command take_settlement i think, take a look at the docudemon

  9. #69
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by shadowstar
    Can you force ownership of a city? If so can I have the code please?
    Hey Piko-

    As an example, on turn #100 at the start of the Julii turn, this will give the Senate control of Antioch and then create two units of Hastati in Antioch.

    Code:
    monitor_event FactionTurnStart FactionType romans_julii
    and I_TurnNumber = 100
    
    console_command control romans_senate
    console_command capture_settlement Antioch
    console_command create_unit Antioch "roman hastati" 2
    console_command control romans_julii
    
    terminate_monitor
    end_monitor
    This assumes the player is playing romans_julii. If not, the code gets more complicated because you'll need some sort of variable to return control of the correct faction to the player.
    Last edited by Stuie; 05-03-2006 at 20:00.

  10. #70

    Default Re: An Intermediate Guide to Scripting

    Hi all!

    I have a question about assassination and whether it's possible to script it?

    My idea involes the assassination a faction leader that i don't know the name of i.e a spawned character, has anyone tried this?

    Cheers!
    Fall of the Republic - Rise of the Empire (FRRE)
    Late Roman Republic mods for B.I

  11. #71

    Default Re: An Intermediate Guide to Scripting

    To my knowledge, no one's had any luck in scripting agent missions. The kill_character command, which could be used instead, as you say needs to know the character's name.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  12. #72
    Member Member Piko's Avatar
    Join Date
    Dec 2004
    Location
    Belgium,Bredene
    Posts
    59

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by Stuie
    Hey Piko-

    As an example, on turn #100 at the start of the Julii turn, this will give the Senate control of Antioch and then create two units of Hastati in Antioch.

    Code:
    monitor_event FactionTurnStart FactionType romans_julii
    and I_TurnNumber = 100
    
    console_command control romans_senate
    console_command capture_settlement Antioch
    console_command create_unit Antioch "roman hastati" 2
    console_command control romans_julii
    
    terminate_monitor
    end_monitor
    This assumes the player is playing romans_julii. If not, the code gets more complicated because you'll need some sort of variable to return control of the correct faction to the player.
    Thanks, I needed this for RTR: under the eagle, hereby promoting it, please visit us at: http://forums.rometotalrealism.org/i...?showforum=157 . We're only just starting out but I'm sure this information's all going to help.

  13. #73

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by Epistolary Richard
    To my knowledge, no one's had any luck in scripting agent missions. The kill_character command, which could be used instead, as you say needs to know the character's name.
    Ah, oh well - back to the drawing board. Thank you anyway.
    Fall of the Republic - Rise of the Empire (FRRE)
    Late Roman Republic mods for B.I

  14. #74

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by Stuie
    So the usage in a script would look like this:

    Code:
         console_command diplomatic_stance romans_brutii parthia neutral
         console_command diplomatic_stance romans_julii parthia neutral
         console_command diplomatic_stance romans_scipii parthia neutral
         console_command diplomatic_stance romans_senate parthia neutral
    That makes all the roman factions "Neutral" toward Parthia, whether they were are war or allied. Note that only allied, neutral and war are available - there does not appear to be a way to force protectorates (I only mention this since that's what people usually seem to be looking for).
    I wonder, is there a way to detect the event of one faction becoming a protectorate?
    If so, there might be a way to work around the annoying alliance issue with protectorates (You can´t attack allies of your protectorate without losing the protectorate), simply by setting the relations of the protectorate to all other factions to neutral.

  15. #75

    Default Re: An Intermediate Guide to Scripting

    No, there's no way that I'm aware of to detect the existence or creation of a protectorate.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  16. #76
    Member Member Piko's Avatar
    Join Date
    Dec 2004
    Location
    Belgium,Bredene
    Posts
    59

    Default Re: An Intermediate Guide to Scripting

    Here I have learned how to script changing a city's ownership, but now I wish to change a family_members ownership, ex. G M from romans_julii to romans_brutii. I know his name.

  17. #77
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by shadowstar
    Here I have learned how to script changing a city's ownership, but now I wish to change a family_members ownership, ex. G M from romans_julii to romans_brutii. I know his name.
    As far as I know, you will need to kill_character him from the original faction and then spawn him in the new faction. No other way to force a change of allegiance that I know of.

  18. #78
    Member Member Piko's Avatar
    Join Date
    Dec 2004
    Location
    Belgium,Bredene
    Posts
    59

    Default Re: An Intermediate Guide to Scripting

    Well maybe trigger rebelling in BI? Is that possible? Where are these docudemon files BTW?

  19. #79

    Default Re: An Intermediate Guide to Scripting

    No, as far I know there's no change allegiance command.

    The docudemon files are linked in the first post of this topic. They can be found here:
    https://forums.totalwar.org/vb/showthread.php?t=54299
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  20. #80
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by shadowstar
    Well maybe trigger rebelling in BI? Is that possible? Where are these docudemon files BTW?
    If you're using loyalty in BI, you could always give the character a huge negative to loyalty using a trait. I haven't messed around much with loyalty though, so I'm not so sure how predictable it is.

  21. #81
    Member Member Piko's Avatar
    Join Date
    Dec 2004
    Location
    Belgium,Bredene
    Posts
    59

    Default Re: An Intermediate Guide to Scripting

    Thanks for the replies, it sucks you have to kill the character though, makes scripting Roman civil war MUCH harder...

  22. #82
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: An Intermediate Guide to Scripting

    Has anyone found a way to script a keystroke? For instance, making the game peform a quick save in the script by having "Ctrl-S" invoked? I know there are ways to get UI elements activatedd, but I'm specifically trying to do something that has a shortcut, but no UI element. Probably not possible but I thought I'd ask.

  23. #83
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: An Intermediate Guide to Scripting

    Shortcuts can be called using a scripting command. I made a post about it somewhere, I'll see if I can dig it up.

  24. #84
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by Myrddraal
    here is a neat scripting command which I found whilst working on the MP campaign:

    call_object_shortcut

    Here is an example of the syntax:

    call_object_shortcut strat_ui speedup_ai

    the strat_ui bit is the category of the shortcut. If you open data\text\descr_shortcuts.txt and scroll to the bottom end, you'll find a list of the shortcuts with their categories to the right.
    ...

  25. #85
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: An Intermediate Guide to Scripting

    Ok - I thought I tried that and it didn't work. Guess I'll try again.

    Edit: Forgot my manners! Thanks for the quick response!
    Edit2: Looks like I had the wrong category for the shortcut I was trying to invoke. I'll test the new one when I get home...
    Last edited by Stuie; 05-19-2006 at 15:50.

  26. #86
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: An Intermediate Guide to Scripting

    Were you trying the save game one?

    I use it in the mp campaign script and it works.

  27. #87
    Member Member Stuie's Avatar
    Join Date
    Aug 2001
    Location
    Upper Gwynedd, PA
    Posts
    406

    Default Re: An Intermediate Guide to Scripting

    Quote Originally Posted by Myrddraal
    Were you trying the save game one?

    I use it in the mp campaign script and it works.
    No - something else. If/when I get it to work I'll report back.

  28. #88
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: An Intermediate Guide to Scripting

    Hi to all the scripters.

    I've been "fighting" against some script commands, and I've revised the old thread about commands working or not working (or not tested).

    As that thread was hidden in the ancient times (last year ), I prefer to post here my doubts and commments, and perhaps somebody could update the list.

    suspend_unscripted_advice true
    I thought that this command disables all the advices, except those launched in the script.
    If so, then I'm doing something wrong, as I put this at the beginning of the script and I receive advices about ships, armies and so on.
    I'm studying the scripts from other mods and in one case (I don't remember if it was TFT) this command was repeated in all the turns of the 4tpy script.
    As I'm not using 4tpy, I need a loop to keep the script monitoring events and conditions. Thus the structure of the script is this:

    Code:
    script
    suspend_unscripted_advice true
    while I_TurnNumber < 500
    here the whole script
    end_while
    terminate_script
    Should I include the suspend_unscripted advice inside the loop? I think I did it, but the advices keep on being launched.
    Should I put some repetition for this command in every turn? I'm thinking in something like this:

    Code:
    monitor_event FactionTurnStart FactionType carthage
    and I_TurnNumber < 500
    suspend_unscripted_advice true
    terminate_monitor
    select_ui_element
    I'm trying that the scripted advices will be shown directly. For this purpose I tried this structure:

    Code:
    advance_advice_thread MyNewAdvice_Thread no_dismiss
    select_ui_element advisor_portrait_button
    simulate_mouse_click lclick_down
    simulate_mouse_click lclick_up
    But I must click on the portrait manually.
    Is the ui_element advisor_portrait_button wrong? I think I saw it in some list of ui elements.

    test_message
    This is the most intriguing problem for me. I've been trying to launch different types of message, such as historic events, wonder captured, civil war... with no success.
    Just in case it was a problem of the conditions or event, I tried to launch it at the start and the end of the faction turn, at the start and the end of a character turn, but no way.
    And all those conditions or events were functional for other commands such as advices, creation of buildings or training of units.
    If the campaign must fullfil the requirements for the event, then the command test_message is useless.
    What am I doing wrong?

    senate_mission
    About the possible update of the list of working commands, I tried several of them related with senate missions:
    Code:
    senate_mission_help_player (with money or units)
    senate_mission_declare_war
    senate_mission_take_city
    The three are working, with some limitations: only for roman factions as LocalFaction, and the mission is not authomatically assigned, only the message appears.

    Cheers.

  29. #89
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: An Intermediate Guide to Scripting

    select_ui_element
    I'm trying that the scripted advices will be shown directly. For this purpose I tried this structure:

    ... ...

    But I must click on the portrait manually.
    Is the ui_element advisor_portrait_button wrong? I think I saw it in some list of ui elements.
    I used this once after automatically running a show me script at the start of a campaign, I wanted to dismiss the advisor. Only problem is I can't remember if it worked or not...

  30. #90
    EB2 Baseless Conjecturer Member blacksnail's Avatar
    Join Date
    Jan 2006
    Posts
    3,074

    Default Re: An Intermediate Guide to Scripting

    I can't find this anywhere else so I'll ask here.

    Say there's a building in a settlement and I want the script to open the building info scroll for that particular building (ie, the equivalent of "right-clicking" the building in the city scroll). How would I go about this? IE, assume I have the "if building X exists in settlement Y" setup correct, what command could I use to open the scroll for that particular building?

Page 3 of 4 FirstFirst 1234 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO