Results 1 to 6 of 6

Thread: Battle scripting

  1. #1

    Default Battle scripting

    Hey there, I have been trying to script a battle (AKA Simulate completely so no user interaction except to look and then later I will put it into movie editor) but I can't seem to move any of my armies from the scripts, it just jumps straight to the user controlled battle.
    My project is at http://rhovanion.unleashed.ws/REALZAMA.rar

    Here is my descr_script.txt snippet...


    script

    ; ************************************************************ *********************************
    ; SCRIPTING EXAMPLE
    ; ************************************************************ *********************************

    ; ************************************************************ *********************************
    ; INITIALISATION
    ; ************************************************************ *********************************

    prepare_for_battle ; This must be *before* defining labels
    while ! I_BattleStarted ; Wait for deployment
    end_while
    ai_active_set off
    camera_restrictions_set off

    ; ************************************************************ *********************************
    ; DEFINE UNIT LABELS
    ; ************************************************************ *********************************

    ; label_unit ALLIANCE ARMY UNIT
    label_unit 0 0 0 ROMAN_GENERAL
    label_unit 0 0 1 ROMAN_HAS1
    label_unit 0 0 2 ROMAN_HAS2
    label_unit 0 0 3 ROMAN_HAS3
    label_unit 0 0 4 ROMAN_HAS4
    label_unit 0 0 5 ROMAN_HAS5
    label_unit 0 0 6 ROMAN_HAS6
    label_unit 0 0 7 ROMAN_HAS7
    label_unit 0 0 8 ROMAN_HAS8
    label_unit 0 0 9 ROMAN_HAS9
    label_unit 0 0 10 ROMAN_PRIN1
    label_unit 0 0 11 ROMAN_PRIN2
    label_unit 0 0 12 ROMAN_PRIN3
    label_unit 0 0 13 ROMAN_PRIN4
    label_unit 0 0 14 ROMAN_PRIN5
    label_unit 0 0 15 ROMAN_PRIN6
    label_unit 0 0 16 ROMAN_PRIN7
    label_unit 0 0 17 ROMAN_PRIN8
    label_unit 0 0 18 ROMAN_TRI1
    label_unit 0 0 19 ROMAN_TRI2

    ; Roman Numidians
    label_unit 2 0 0 NUMID_GENERAL
    label_unit 2 0 1 NUMID_MEDCALV1
    label_unit 2 0 2 NUMID_MEDCALV2
    label_unit 2 0 3 NUMID_NUMID1
    label_unit 2 0 4 NUMID_NUMID2

    ; Carthage
    label_unit 1 0 0 CARTH_ELEP1
    label_unit 1 0 1 CARTH_ELEP2
    label_unit 1 0 2 CARTH_ELEP3
    label_unit 1 0 3 CARTH_GENERAL
    label_unit 1 0 4 CARTH_INF1
    label_unit 1 0 5 CARTH_INF2
    label_unit 1 0 6 CARTH_INF3
    label_unit 1 0 7 CARTH_MEDINF1
    label_unit 1 0 8 CARTH_MEDINF2
    label_unit 1 0 9 CARTH_PEA1
    label_unit 1 0 10 CARTH_PEA2
    label_unit 1 0 11 CARTH_SACRED1

    ; Slave
    label_unit 4 0 0 SLAVE_GENERAL
    label_unit 4 0 1 SLAVE_NUMID1
    label_unit 4 0 2 SLAVE_NUMID2


    set_camera_bookmark 1, -536.298, -242.253, 78

    ; ************************************************************ *********************************
    ; BEGIN BATTLE
    ; ************************************************************ *********************************

    disable_cursor ;prevent the player clicking
    suspend_unscripted_advice true
    disable_shortcuts true
    disable_entire_ui
    inhibit_camera_input true
    declare_counter intro_sequence


    ;BATTLE SCRIPT

    while ! I_BattleStarted ; WAIT FOR DEPLOYMENT
    end_while

    ai_active_set off

    camera_restrictions_set off

    camera_default_mode_set tw

    battle_default_camera

    hide_ui

    monitor_conditions I_CompareCounter intro_sequence = 1

    camera_position_at_bookmark 1
    battle_wait 10

    unit_order_move_relative ROMAN_GENERAL 0, 200


    end_script

    Help on this would be greatly appreciated!

  2. #2

    Default Re: Battle scripting

    Wow You can script battels!
    Hi The Lords Skinner Here


  3. #3

    Default Re: Battle scripting

    Have been working on it now... Still doesn't work but makes more sense than what I had before so try this:

    script

    ; *********************************************************************************************
    ; SCRIPTING EXAMPLE
    ; *********************************************************************************************

    ; *********************************************************************************************
    ; INITIALISATION
    ; *********************************************************************************************

    prepare_for_battle ; This must be *before* defining labels

    ; label_unit ALLIANCE ARMY UNIT
    label_unit 0 0 0 ROMAN_GENERAL
    label_unit 0 0 1 ROMAN_HAS1
    label_unit 0 0 2 ROMAN_HAS2
    label_unit 0 0 3 ROMAN_HAS3
    label_unit 0 0 4 ROMAN_HAS4
    label_unit 0 0 5 ROMAN_HAS5
    label_unit 0 0 6 ROMAN_HAS6
    label_unit 0 0 7 ROMAN_HAS7
    label_unit 0 0 8 ROMAN_HAS8
    label_unit 0 0 9 ROMAN_HAS9
    label_unit 0 0 10 ROMAN_PRIN1
    label_unit 0 0 11 ROMAN_PRIN2
    label_unit 0 0 12 ROMAN_PRIN3
    label_unit 0 0 13 ROMAN_PRIN4
    label_unit 0 0 14 ROMAN_PRIN5
    label_unit 0 0 15 ROMAN_PRIN6
    label_unit 0 0 16 ROMAN_PRIN7
    label_unit 0 0 17 ROMAN_PRIN8
    label_unit 0 0 18 ROMAN_TRI1
    label_unit 0 0 19 ROMAN_TRI2

    ; Roman Numidians
    label_unit 2 0 0 NUMID_GENERAL
    label_unit 2 0 1 NUMID_MEDCALV1
    label_unit 2 0 2 NUMID_MEDCALV2
    label_unit 2 0 3 NUMID_NUMID1
    label_unit 2 0 4 NUMID_NUMID2

    ; Carthage
    label_unit 1 0 0 CARTH_ELEP1
    label_unit 1 0 1 CARTH_ELEP2
    label_unit 1 0 2 CARTH_ELEP3
    label_unit 1 0 3 CARTH_GENERAL
    label_unit 1 0 4 CARTH_INF1
    label_unit 1 0 5 CARTH_INF2
    label_unit 1 0 6 CARTH_INF3
    label_unit 1 0 7 CARTH_MEDINF1
    label_unit 1 0 8 CARTH_MEDINF2
    label_unit 1 0 9 CARTH_PEA1
    label_unit 1 0 10 CARTH_PEA2
    label_unit 1 0 11 CARTH_SACRED1

    ; Slave
    label_unit 4 0 0 SLAVE_GENERAL
    label_unit 4 0 1 SLAVE_NUMID1
    label_unit 4 0 2 SLAVE_NUMID2

    declare_counter intro_sequence

    disable_cursor ;prevent the player clicking
    suspend_unscripted_advice true
    disable_shortcuts true
    disable_entire_ui
    inhibit_camera_input true

    set_camera_bookmark 1, -536.298, -242.253, 78 -506.298, -242.253, 78

    ;BATTLE SCRIPT

    set_counter intro_sequence 1 ; kicks off intro sequence

    ai_active_set off

    camera_restrictions_set off

    camera_default_mode_set tw

    battle_default_camera

    hide_ui



    ; *********************************************************************************************
    ; ********************* BEGINNING INTRO SEQUENCE MONITOR **************************************
    ; *********************************************************************************************


    monitor_conditions I_CompareCounter intro_sequence = 1


    camera_position_at_bookmark 1
    unit_order_move_relative ROMAN_GENERAL 10 110 run
    battle_wait 20

    terminate_monitor
    end_monitor


    end_script

    If someone could just give me a simple example such as making the general march forward and the camera moving around a bit I would be very thankfull

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

    Default Re: Battle scripting

    If you want an example of a scripted battle, look at the introduction to the prologue first battle...

  5. #5

    Default Re: Battle scripting

    Yeah I just tried that, I noticed one thing was that I had "scripts" instead of "script" in descr_battle.txt so changed that but it still does not do anything. I think it has something to do with my labelling but I don't know what! Could someone please check it for me

  6. #6

    Default Re: Battle scripting

    I'd suggest looking at the Historical battles instead of the prologue one. Look at the intro movie of Carrhae since it's a pretty good example of scripting. You can also run a few quick tests..see if the UI is hidden, mess with some easy lines(hide_ui, show_ui, hiding the advisor, showing the advisor and so on) to know where the script stops working right.

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