Results 1 to 6 of 6

Thread: Historical Battle Scripting

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Rt. Hon. Gentleman's Avatar Campidoctor
    Join Date
    Aug 2008
    Location
    Lincoln, Lincolnshire.
    Posts
    1,868

    Default Historical Battle Scripting

    Hello,

    I'll be brief: I've done Pharsalus and hope to get some more historic battles done prior to release. However, the enemy AI is making a right bloody pig's ear of things. Somehow, I don't think Cnaeus Pompey, one of the greatest generals of the ancient world, would go to so much trouble to move out of my conscientiously created manipular formation to move into a wonky line, then back into a few lines, then back to a single line, and so on for 15 MINUTES, if left to his own devices.

    What I really need is some way of scripting the battle, as all the vanilla historical battles are scripted. I need the infantry maniples to stay where the hell they were put unless to respond to player aggression, and I need Labienus's cavalry to attempt the destruction of Caesar's cavalry and subsequent envelopement.

    Can anyone help? I don't know much about scripting, and really need to have the battle scripted for it to be any fun at all...


    Thanks in advance

  2. #2

    Default Re: Historical Battle Scripting

    I can give you a script I made for Magnesia battle and start from there. What I managed to do was for the romans to stay in one place until the seleucids aproach, than gradually "release" the formation blocks (first the hastati, than the principes and then the triarii) as the battle progressed. The result of the script is that the seleucid right wing is routed 80% of the time because of the roman's cavalry attack combined with archers and a hoplite unit that results in the chariots running arround killing their own cavalry.
    Another nice thing is that the units were all set on fire at will and holding their ground so a lot of phalanx troops get destroyed as they approach (10-15% in my mod). You could use this code to script some other battles in this idea (gradually releasing units to the ai's control and scripting some cavalry charges). The bad part about using this approach is that if a unit is ordered to charge a certain other unit and the player moves that arround it can be caught by other untis and slain, this effect can be reduced by releasing the unit some time after the charge and calculating the time it takes for the two units to meet.
    Another thing to do is to order groups to aproach to missile range of other groups and then order manouvers.
    How far are you now in your script?

  3. #3

    Default Re: Historical Battle Scripting

    Sounds impressive


    Under patronage of Spirit of Rob; Patron of Century X, Pacco, Cherryfunk, Leif Erikson.

  4. #4

    Default Re: Historical Battle Scripting

    I've also modified the vanilla version of Raphia and it's now quite challenging. I lost two or three times before I could win it.
    As a general note, the ai is confused because of the way it has the unit formations built in the descr_formations. The workaround for this is to start a battle with the mix of units you want to use in the historical battle, look at how the ai positions them and then try to use as much of this as possible in the mod, this way, the AI won't have to break formations too much. The method described above overrides this formation placement by the simple idea that it takes control from the AI and lets the units stay in place.
    Both ways offer good results as I've been flanked more than once by the roman legions when using my phalanx at Pydna (no scripting there, just troop positioning).

  5. #5

    Default Re: Historical Battle Scripting

    As a general note, the ai is confused because of the way it has the unit formations built in the descr_formations
    When you're finished with the scripting you might want to give Faridus, who's just started doing some work on this, a few pointers as to where things are getting confused. Thanks!


    Under patronage of Spirit of Rob; Patron of Century X, Pacco, Cherryfunk, Leif Erikson.

  6. #6

    Default Re: Historical Battle Scripting

    So there is no confusion I meant the descr_formations_ai, not the descr_formations as that only affects what the player can do.

    Here's a copy of what I used for Magnesia script

    script

    prepare_for_battle

    label_unit 0 0 0 general
    label_unit 0 0 1 triarii
    label_unit 0 0 2 hastati
    label_unit 0 0 3 princeps
    label_unit 0 0 4 velite
    label_unit 0 0 5 swords
    label_unit 0 0 6 spears
    label_unit 0 0 7 cavalry
    label_unit 0 0 8 archer
    label_unit 0 0 9 skirm
    label_unit 0 0 10 elephant
    label_unit 0 0 11 samnite
    label_unit 0 0 12 equite
    label_unit 0 0 13 hastati1
    label_unit 0 0 14 princeps1
    label_unit 0 0 15 triarii1
    label_unit 0 0 16 spears1
    label_unit 0 0 17 spears2
    label_unit 0 0 18 swords1
    label_unit 0 0 19 hoplite

    label_unit 1 0 0 1elephant
    label_unit 1 0 1 1cata
    label_unit 1 0 2 1cata1
    label_unit 1 0 3 1general
    label_unit 1 0 4 1horse_archer
    label_unit 1 0 5 1silver
    label_unit 1 0 6 1silver1
    label_unit 1 0 7 1silver2
    label_unit 1 0 8 1galat
    label_unit 1 0 9 1bronze
    label_unit 1 0 10 1bronze1
    label_unit 1 0 11 1bronze2
    label_unit 1 0 12 1bronze3
    label_unit 1 0 13 1elephant1
    label_unit 1 0 14 1slinger
    label_unit 1 0 15 1archer
    label_unit 1 0 16 1agema
    label_unit 1 0 17 1elephant2
    label_unit 1 0 18 1elephant_armored

    label_unit 1 1 0 2general
    label_unit 1 1 1 2galat
    label_unit 1 1 2 2phalanx
    label_unit 1 1 3 2phalanx1
    label_unit 1 1 4 2archer
    label_unit 1 1 5 2slinger
    label_unit 1 1 6 2skirm
    label_unit 1 1 7 2chariot
    label_unit 1 1 8 2xysto
    label_unit 1 1 9 2cata
    label_unit 1 1 10 2galat_cav
    label_unit 1 1 11 2galat_cav1

    ai_active_set on

    while ! I_BattleStarted
    end_while

    ai_active_set off
    camera_restrictions_set off

    battle_wait 2
    define_unit_group romans general triarii hastati princeps velite swords spears cavalry archer skirm elephant samnite equite hastati1 princeps1 triarii1 spears1 spears2 swords1 hoplite

    define_unit_group seleucus 1elephant 1cata 1cata1 1general 1horse_archer 1silver 1silver1 1silver2 1galat 1bronze 1bronze1 1bronze2 1bronze3 1elephant1 1slinger 1archer 1agema 1elephant2 1elephant_armored

    unit_group_set_fire_at_will_mode romans on
    unit_group_set_fire_at_will_mode seleucus on

    unit_group_move_to_missile_range_of_group seleucus romans

    monitor_conditions I_UnitEnemyUnitInRadius hastati 80

    battle_wait 170

    release_unit hastati
    release_unit hastati1
    release_unit spears
    release_unit spears1

    battle_wait 30

    release_unit princeps
    release_unit princeps1
    release_unit swords
    release_unit swords1

    battle_wait 10

    release_unit triarii
    release_unit triarii1
    release_unit samnite
    release_unit spears2
    release_unit general

    end_monitor

    monitor_conditions I_UnitEnemyUnitInRadius velite 100
    battle_wait 50
    release_unit velite
    release_unit skirm
    release_unit archer
    end_monitor

    monitor_conditions I_UnitEnemyUnitInRadius cavalry 200
    battle_wait 180
    release_unit cavalry
    end_monitor

    monitor_conditions I_UnitEnemyUnitInRadius elephant 200
    battle_wait 200
    release_unit elephant
    end_monitor

    monitor_conditions I_UnitEnemyUnitInRadius equite 200
    battle_wait 180
    release_unit equite
    end_monitor

    release_unit 2general
    release_unit 2galat
    release_unit 2phalanx
    release_unit 2phalanx1
    release_unit 2archer
    release_unit 2slinger
    release_unit 2skirm

    unit_order_move_to_missile_range 2chariot archer
    unit_order_move_to_missile_range 2xysto archer
    unit_order_move_to_missile_range 2cata archer
    unit_order_move_to_missile_range 2galat_cav archer
    unit_order_move_to_missile_range 2galat_cav1 archer

    battle_wait 100

    unit_order_attack_unit skirm 2chariot run

    battle_wait 50

    unit_use_special_ability archer
    unit_order_attack_unit archer 2chariot run
    unit_set_skirmish_mode archer off
    unit_set_skirmish_mode skirm on

    battle_wait 30

    release_unit skirm

    unit_order_attack_unit 1cata hastati
    unit_order_attack_unit 1cata1 hastati
    unit_order_attack_unit 1agema hastati
    unit_order_attack_unit 1general hastati

    battle_wait 10

    release_unit 1elephant
    release_unit 1silver
    release_unit 1galat
    release_unit 1elephant1
    release_unit 1elephant2
    release_unit 1elephant_armored
    release_unit 2archer
    release_unit 2slinger
    release_unit 2skirm

    release_unit 1silver1
    release_unit 1silver2
    release_unit 1bronze
    release_unit 1bronze1
    release_unit 1bronze2
    release_unit 1bronze3

    unit_order_attack_unit 2chariot archer run
    unit_order_attack_unit 2cata archer run
    unit_order_attack_unit 2xysto archer run
    unit_order_attack_unit 2galat_cav archer run
    unit_order_attack_unit 2galat_cav1 archer run
    unit_order_attack_unit archer 2chariot run
    unit_order_attack_unit hoplite 2xysto run
    unit_order_attack_unit cavalry 2chariot run

    battle_wait 20

    unit_order_attack_unit cavalry 2xysto run
    unit_order_attack_unit archer 2xysto run
    unit_order_attack_unit hoplite 2xysto run

    battle_wait 5

    unit_order_attack_unit cavalry 2cata run
    unit_order_attack_unit archer 2cata run
    unit_order_attack_unit hoplite 2cata run

    battle_wait 5

    unit_order_attack_unit cavalry 2galat_cav run
    unit_order_attack_unit archer 2galat_cav run
    unit_order_attack_unit hoplite 2galat_cav run

    battle_wait 50

    unit_set_morale 2archer routing
    unit_set_morale 2slinger routing
    unit_set_morale 2skirm routing

    battle_wait 100

    unit_group_order_attack_group seleucus romans

    release_unit 2xysto
    release_unit 2cata
    release_unit 2galat_cav
    release_unit 2galat_cav1
    release_unit 2chariot

    release_unit cavalry
    release_unit archer
    release_unit hoplite

    release_unit 1cata
    release_unit 1cata1
    release_unit 1agema
    release_unit 1general
    release_unit 1horse_archer
    release_unit 1slinger
    release_unit 1archer

    end_script
    the commands used in this can be found in docudemon_commands.txt the file can be found on the forum somewhere, don't quite remember where though. If you don't have the commands files (the ones that explain the basic scripting commands, I can just send them to you).

    In short, what the script does is to slowly march the seleucids on the waiting romans and charge with the cataphracts in one flank while the other army tries to smash the other flank. Phalanx advances in the center. As for the romans, they stay put and wait for the seleucids to come their way, the exception is a unit of cretan archers backed-up by a heavy greek cavalry unit and some hoplites that aid that attack.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •