PDA

View Full Version : Battle scripting



Jemburula
04-08-2005, 03:58
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!

thelordskinner
04-08-2005, 04:04
Wow You can script battels! :duel:

Jemburula
04-08-2005, 05:32
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

Myrddraal
04-08-2005, 12:37
If you want an example of a scripted battle, look at the introduction to the prologue first battle...

Jemburula
04-09-2005, 02:07
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

Enrique Orduno
04-10-2005, 19:40
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.