Log in

View Full Version : need a bit of help with scripting



king hannibal
07-28-2008, 17:19
hi

I'm just messing around trying to script a battle and I've made my script the same as the EB ones and it CTD on the time of activation

script below:


script

prepare_for_battle


; *********************************************************************************************
; Carthage - Alliance 0
; *********************************************************************************************

;Hannibal Barce
label_unit 0 0 0 carthaginian cavalry generals bodyguard
label_unit 0 0 1 african missile cavalry numidian
label_unit 0 0 2 celtic cavalry brihentin
label_unit 0 0 3 celtic cavalry brihentin1
label_unit 0 0 4 iberian cavalry light curisii
label_unit 0 0 5 iberian cavalry light curisii1
label_unit 0 0 6 celtic cavalry brihentin2
label_unit 0 0 7 celtic cavalry brihentin3
label_unit 0 0 8 african missile cavalry numidian1


; *********************************************************************************************
; Rome - Alliance 1
; *********************************************************************************************

;Caivs
label_unit 1 0 0 roman cavalry eqvites consvlares
label_unit 1 0 1 roman infantry auxilia peditesextraordinarii
label_unit 1 0 2 roman infantry auxilia peditesextraordinarii1
label_unit 1 0 3 roman infantry polybian triarii
label_unit 1 0 4 roman infantry polybian triarii1
label_unit 1 0 5 roman infantry principes
label_unit 1 0 6 roman infantry principes1
label_unit 1 0 7 roman infantry hastati
label_unit 1 0 8 roman infantry hastati1
label_unit 1 0 9 roman infantry hastati2
label_unit 1 0 10 roman infantry hastati3
label_unit 1 0 11 roman skirmisher velites
label_unit 1 0 12 roman skirmisher velites1
label_unit 1 0 13 roman infantry principes2
label_unit 1 0 14 roman infantry principes3


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

while ! I_BattleStarted ; Wait for deployment
end_while
ai_active_set off
camera_restrictions_set off


; *********************************************************************************************


while I_InBattle

if I_LocalFaction seleucid

battle_wait 100
release_unit carthaginian cavalry generals bodyguard
release_unit african missile cavalry numidian
release_unit celtic cavalry brihentin
release_unit celtic cavalry brihentin1
release_unit iberian cavalry light curisii
release_unit iberian cavalry light curisii1
release_unit celtic cavalry brihentin2
release_unit celtic cavalry brihentin3
release_unit african missile cavalry numidian1



end_if




if I_LocalFaction egypt

battle_wait 100

release_unit roman cavalry eqvites consvlares
release_unit roman infantry auxilia peditesextraordinarii
release_unit roman infantry auxilia peditesextraordinarii1
release_unit roman infantry polybian triarii
release_unit roman infantry polybian triarii1
release_unit roman infantry principes
release_unit roman infantry principes1
release_unit roman infantry hastati
release_unit roman infantry hastati1
release_unit roman infantry hastati2
release_unit roman infantry hastati3
release_unit roman skirmisher velites
release_unit roman skirmisher velites1
release_unit roman infantry principes2
release_unit roman infantry principes3


end_if


end_while

end_script

I've also put in the bit at the bottom of the descr-battle

does anyone know what I'm doing wrong or might be up

any help would be much appreciated

V.T. Marvin
07-29-2008, 10:14
I do know next to nothing about scripting battles, but I have noticed that there might be an unwanted exclamation mark in the code line just after the "initialization" asterixes:

while ! I_BattleStarted ; Wait for deployment

this could be the cause of your problem, otherwise I do not know. :shrug:

Tellos Athenaios
07-29-2008, 13:26
Ah I guess you tried to use the logical negation operator? Usually it's !, I know but in this case (RTW scripting doesn't feature non-binary operators AFAIK, and the negation operator is unary) it should be the function not.

king hannibal
08-05-2008, 19:26
first of all sorry for not posting back sooner something came up and I've been away for a few days


Quote: Ah I guess you tried to use the logical negation operator? Usually it's !, I know but in this case (RTW scripting doesn't feature non-binary operators AFAIK, and the negation operator is unary) it should be the function not.

logical negation operator - not sure what you mean by this, is it a modding helping tool?

and I've tried the ! in the scripting but still CTDs