Results 1 to 30 of 116

Thread: An Intermediate Guide to Scripting

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: An Intermediate Guide to Scripting

    Hi all. I want to write a script to achieve this result: Every time I press the "disband unit" button, it will create a certain unit in a certain city.



    Code:
    script
    
    declare_counter loop
    set_counter loop 1
     
    monitor_event ButtonPressed ButtonPressed disband_unit
    console_command create_unit  Bordeaux "Dismounted Feudal Knights80" 1
    end_monitor
     
    while I_CompareCounter loop = 1
    end_while
    
    end_script
    As you can see, the problem is I don't know what the real button ID of "disband unit". The CA docudemon says it can be found in a file called available_ui_elements.txt. But where can I find it?

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

    Default Re: An Intermediate Guide to Scripting

    You were very close: it's disband_unit_button. Jerome Grasdyke from CA was kind enough to post the contents of this file here.
    The truth is the most valuable thing we have. Let us economize it. - Mark Twain



  3. #3

    Default Re: An Intermediate Guide to Scripting

    Thank u so much! It helps a lot!

  4. #4

    Default Re: An Intermediate Guide to Scripting

    Hello everyone. I m'essaye scripting and hope poster to the right place. That is my problem.
    I managed (with the help of another modder of TWcenter) to a script that damages the shrine battleforge and built a shrine fun when you take the city of genua. Here is the script

    script
    declare_counter loop
    set_counter loop 0

    monitor_event GeneralCaptureSettlement SettlementName Genua
    and CharacterIsLocal
    and not SettlementBuildingExists = shrine_fun

    console_command set_building_health Genua battleforge 0
    console_command create_building Genua shrine_fun

    end_monitor
    while I_compareCounter loop = 0
    end_while
    end_script

    I wish now that the shrine battleforge damage and fun shrine built for all cities that I will take. Do you have any idea?

    Sorry for my English, I am french

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

    Default Re: An Intermediate Guide to Scripting

    Replacing the condition SettlementName Genua with TrueCondition should do the trick. You do realise that the script as currently written will give you a shrine_fun even if a settlement doesn't have a battleforge shrine?
    Last edited by Squid; 11-17-2007 at 13:57.

    -Trait/Ancillary/Building Editor

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

  6. #6

    Default Re: An Intermediate Guide to Scripting

    Yes, I know and that troubles me. But in console_command I replaces genua by what?

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