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

Thread: A Beginner's Guide to Scripting & Scripting "How To"s

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

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Quote Originally Posted by Moros
    Does a campaign script loaded form the Descr_strat also need script at the start?
    No, that's a bit different. In that case the "script" command actually appears in descr_strat.txt. You should have something like this at the end:

    Code:
    script
    campaign_script.txt
    Sorry Moros, I don't see what the problem is, and as you're probably aware, the code looks very familiar.
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  2. #62
    Speaker of Truth Senior Member Moros's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    13,469

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Yes I know. It looks familiar. You gotta learn it and start with something simple and something you can compare, no? Also I have it like you have in the descr_strat.txt, that's why I had no script in the script itself.

    This is wierd, I guess I'll just restart completely maybe that'll help. Thanks for the help though!

  3. #63
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    kinda new to the TW scripting and more into M2 at the moment, but try this ...


    Code:
    if FactionType romans_senate

    G

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

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    No, Moros wishes to give this faction money only if it isn't controlled by the player. Substituting FactionType for I_LocalFaction won't make this distinction.
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  5. #65
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    yep, thats what I'm refering to, afaik you're not refering to a faction with just "[faction]", but need to use "FactionType [faction]".

    anyway thats what the docudemon files make me believe ...


    G

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

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    No. Here's the docudemon entry:

    Code:
    ---------------------------------------------------
    Identifier:              I_LocalFaction
    Trigger requirements:    
    Parameters:              faction
    Sample use:              I_LocalFaction romans_julii
    Description:             Is the faction the local faction?
    Battle or Strat:         Either
    Class:                   I_LOCAL_FACTION
    Implemented:             Yes
    Author:                  Guy
    In fact, the FactionType condition has a trigger requirement, so it's not useful in this situation.

    The thing is, this expression:

    Code:
    if not I_LocalFaction romans_julii
        console_command add_money romans_julii, 30000
    end_if
    is used in EB. I just tested it to make sure, and it's working.
    Last edited by Atilius; 08-09-2007 at 03:38.
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  7. #67
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    that'll teach me only reading 1/2 the stuff in the docudemon files ...

    I just read about this one ....
    Code:
    Identifier:              FactionType
    Trigger requirements:    faction
    Parameters:              faction type
    Sample use:              FactionType romans_julii
    Description:             Test the faction type

    Thanks for the correction ..;)
    (I was under the impression the I_LocalFaction flag was one without variables)


    G

  8. #68

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Hi just read the tutorial, great work. Its making me think I can add some features to my mod project I'd given up on. I have managed to get a mo money and a kill character script working.

    My only question is, a show-me script that runs in the background was mentioned earlier in the thread how can I construct one of these?

    Also it was mentioned that a show-me script could be activated by a campaign script again how?

    Thanks

  9. #69

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    OK may have worked out part of it myself Ive manage to create a loop in the script so it continues to run. Only I have made a new problem for myself
    What I'm trying to do is create a backgroung script which will trigger certain events ant certain dates. So I experimented with add_money because I could easily see what was going on. my script is as follows.

    script

    declare_counter mo_money

    set_counter mo_money 0

    while I_TurnNumber < 5

    if I_TurnNumber = 3
    and mo_money < 1

    console_command add_money 1000

    set_counter mo_money 1
    end_if

    end_while

    end_script

    I added the mo_money counter in an effort to make it happen only once on that turn. However when I get to turn three, the money just keeps going up.


  10. #70
    Finder of Little Oddities Senior Member Makanyane's Avatar
    Join Date
    Jan 2006
    Posts
    2,220

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    think your check of the counter is wrong try:

    and I_CompareCounter mo_money < 1
    Not used mods before? Looking for something small and fun?!
    Download the:

  11. #71
    Axebitten Modder Senior Member Dol Guldur's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,550

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Now here's a question no one will know the answer to

    When using the kill character command the game assumes the character to have died in battle - is there a way to do it so that it is categorized as a peaceful death? I appreciate that I could change the textual description but I would rather keep it if possible so that it draws a distinction...Thx.
    "One of the most sophisticated Total War mods ever developed..."

  12. #72

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Thanks Makanyane,
    thats the second time you've bailled me out when I've made a stupid mistake

    Sorry, but Ive got another question. Ive tested out the script and works fine now, however when I save the game and reload the script wont work. I figured I'd have to reload the script using show-me how but even then it does nothing

  13. #73

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Yes, the only way to relaunch the script after reloading the game is to use the show-me button.
    Depending on how did you implement the script and the show-me advice to launch it, sometimes it is not possible to reactivate the script until you restart the game. At least it happens to me, I'm not sure if other scripts have the same problem...

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

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Quote Originally Posted by Bardo
    Yes, the only way to relaunch the script after reloading the game is to use the show-me button.
    Depending on how did you implement the script and the show-me advice to launch it, sometimes it is not possible to reactivate the script until you restart the game. At least it happens to me, I'm not sure if other scripts have the same problem...
    AFAIK you cannot launch another script (for example in another campaign) or even the same script starting the same campaign with another faction, if you don't restart the game.

  15. #75

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Europa Barbarorum used a workarround in his previous version, that I have been using for long time, but I do not really recomend it since it is possible to duplicate the actived scripts, and after many tested, I still do not know how it acts exactly.
    The method is simple, just introduce the whole script inside a while loop. Then it is always possible to relaunch the script without exiting the game. But I recomend always to restart the game before starting a new campaign, as Monkwarrior said.

  16. #76

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    After looking at some historical battle scripts, I thought I'd do a little experimenting with the play_sound_event command. I added a bunch of new events to descr_sounds_narration.txt, plus the mp3s for them. It seems to work in the most basic form, but I ran into some strange behavior when trying to add a counter condition to the monitor.

    This works fine:
    Code:
    monitor_event SettlementSelected SettlementName Rome
        play_sound_event RomeSelected
    end_monitor
    This also works:
    Code:
    declare_counter PlaySpeech
    set_counter PlaySpeech 1
    
    monitor_event SettlementSelected SettlementName Rome
             and I_CompareCounter PlaySpeech = 1
        play_sound_event RomeSelected
    end_monitor
    This produces a "Sound event TEUTOBURG_SPEECH_00 not found." error when closing the game.
    Code:
    declare_counter PlaySpeech
    ;don't initialize or initilize to something other than 1
    ;set_counter PlaySpeech 1
    
    monitor_event SettlementSelected SettlementName Rome
             and I_CompareCounter PlaySpeech = 1
        play_sound_event RomeSelected
    end_monitor
    Ideally, rather than having them always on, I'd like to let the player toggle them on/off at any time, something along the lines of:

    Code:
    declare_counter PlaySpeech
    
    monitor_event ScrollAdviceRequested ScrollOpened helpScroll
        if I_CompareCounter PlaySpeech = 0
             set_counter PlaySpeech 1
        end_if
        if I_CompareCounter PlaySpeech = 1
             set_counter PlaySpeech 0
        end_if
    end_event
    
    monitor_event SettlementSelected SettlementName Rome
             and I_CompareCounter PlaySpeech = 1
        console_command
        play_sound_event RomeSelected
    end_monitor
    Any thoughts?
    RTR VII Developer

  17. #77

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Err... "Sound event RomeSelected not found."
    RTR VII Developer

  18. #78

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Did you try to initialize the counter in this lastest case?

    declare_counter PlaySpeech
    set_counter PlaySpeech 0

    monitor_event ScrollAdviceRequested ScrollOpened helpScroll
    if I_CompareCounter PlaySpeech = 0
    set_counter PlaySpeech 1
    end_if
    if I_CompareCounter PlaySpeech = 1
    set_counter PlaySpeech 0
    end_if
    end_event

    monitor_event SettlementSelected SettlementName Rome
    and I_CompareCounter PlaySpeech = 1
    play_sound_event RomeSelected
    end_monitor

  19. #79

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Yes, but that makes no difference anyways. It's initialized to 0 by default.
    RTR VII Developer

  20. #80

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Hi, Richard, I read your great guide, but still have a few questions.
    I made a script to spawn an army, but I do not know where to save it in the game files. Here it is:

    script

    monitor_event FactionTurnStart FactionType parthia
    and I_TurnNumber = 2

    if spawn_armyA=0

    spawn_army
    faction parthia
    character Thuxra, named character, command 5, influence 5, management 3, subterfuge 2, age 38, , x 256, y 80
    ancillaries galloper
    unit hillmen, exp 5 armour 0 weapon_lvl 2
    unit hillmen, exp 5 armour 0 weapon_lvl 2
    unit east camel cataphract, exp 5 armour 0 weapon_lvl 2
    unit east camel cataphract, exp 5 armour 0 weapon_lvl 0
    unit east onager, exp 4 armour 0 weapon_lvl 0
    unit eastern archers, exp 4 armour 0 weapon_lvl 0
    unit eastern archers, exp 4 armour 0 weapon_lvl 0
    unit eastern archers, exp 4 armour 0 weapon_lvl 0
    unit east slinger, exp 3 armour 0 weapon_lvl 0
    unit east slinger, exp 3 armour 0 weapon_lvl 0
    unit east slinger, exp 3 armour 0 weapon_lvl 0
    unit east archer, exp 3 armour 0 weapon_lvl 0
    unit east heavy cataphract, exp 3 armour 0 weapon_lvl 0
    unit east heavy cataphract, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    unit east infantry, exp 3 armour 0 weapon_lvl 0
    set_counter spawn_armyA 1
    end_if


    terminate_monitor
    end_monitor
    end_script

  21. #81
    Son of a Camel Member anelious phyros's Avatar
    Join Date
    Apr 2008
    Location
    Your freagin suitcase!
    Posts
    528

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    I think it's data/scripts, also here's another guide that might help you -
    How to:Script spawn...

  22. #82

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Do anyone know a solution to make the enemy AI army, to do as you wants it to? Like scripting, creating a historical battle etc etc. Maybe some editor program (like Caligula & Hadrian) wich make script for you, Is this possible?

  23. #83

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    This files are from folder Data\world\maps\battle\custom\"Gergovia"
    1 - bookmarks.rcb
    2 - map.rbm
    3 - map.wfc
    4 - descr_battle.txt
    5 - descr_script.txt
    6 - description.txt

    This is from same folder but my map

    1- bookmarks.rcb
    2- map.wfc
    3- descr_battle.txt
    4- editor_log.txt

    How to make descr_script for battle map? What program i must use for this?
    I use Battle editor to make battles, there is no tool to make command for AI.

  24. #84
    Anything that isn't 'member' Member Squid's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    596

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Any old text editor will do.

    -Trait/Ancillary/Building Editor

    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the universe." -----Albert Einstein

  25. #85

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    This might seem silly, but does a counter endure when the game is restarted, or do they have to be redefined each time the game is started? Ie. can they be used to store information through a game restart?

  26. #86

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    No, they can't store info.

    Norman Invasion - The fate of England lies in your hands...

    Viking Invasion II - Unite Britain in the best TW campaign ever!

    Gods and Fighting Men: Total War - Enter the Mists of Myth in Ancient Ireland

  27. #87
    Anything that isn't 'member' Member Squid's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    596

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    What some mods do to preserve the information, is they have a character who gets traits that correspond to the values of counters in the script. This is quite difficult, as the character has to be placed in a location that can't be reached so it can't interact with the rest of the game. It also has to be a specific character (not just any character) so the character name is known for the various script commands that refer to a character (i.e. spawn, give_trait, etc). This is also used in combination with an unreachable settlement where specific buildings can be built to signify the storing of specific script information.

    -Trait/Ancillary/Building Editor

    "Two things are infinite: the universe and human stupidity;
    and I'm not sure about the universe." -----Albert Einstein

  28. #88

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Is it possible to remove random units from an army if it reaches a certain point/region? (In RTW, no expansion)
    And if this is not possible, can you add an army to the slave and make it attack the army (and disappear afterwards)

  29. #89
    Finder of Little Oddities Senior Member Makanyane's Avatar
    Join Date
    Jan 2006
    Posts
    2,220

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Quote Originally Posted by JoristhePagan View Post
    Is it possible to remove random units from an army if it reaches a certain point/region? (In RTW, no expansion)
    not that I know of

    And if this is not possible, can you add an army to the slave and make it attack the army (and disappear afterwards)
    you can spawn a slave army - you can't make it attack unless you know the name of the general of the other army (which is unlikely) - but if you spawn it close to area and its big enough it probably will attack.

    Don't think you can make it disappear exactly - if its leader is still alive after battle you could try using the move character commands to send it off somewhere else... beware of using the non console_command move commands if you don't know if character is alive, trying to apply the other types of commands to a non-existent character can make game CTD

    if you know name of leader you can kill him and hence his bodyguard but I don't know of any way of killing other units by script.
    Not used mods before? Looking for something small and fun?!
    Download the:

  30. #90

    Default Re: A Beginner's Guide to Scripting & Scripting "How To"s

    Ok thanks, I'll have to find another way.

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