View Full Version : [Help!] Scripting the appearance of Hannibal's army
QuintusSertorius
04-24-2008, 00:06
This is a follow on from the thread (https://forums.totalwar.org/vb/showthread.php?t=102177) in the general forum. In a nutshell I need some scripting and I'm clueless as to how you do it without wrecking the game. The limits of my modding skills are minor tinkering with the EDU and strat.txt.
Here's the situation. In 216BC I'm going to gift Capua to Qarthadast (roleplaying, it's after losing Cannae). I want Hannibal's stack to appear in Campania when this happens. I'm hoping that having some actual Qarthadastim territory to defend will prevent him trying to wander off to Spain.
What would also be nice to have is some "regeneration" of that stack in the form of Italians (Samnites, Bruttians, Lucanians). Possibly an army of Italians fighting for Qarthadast at various points too, to give me some battles I can actually win.
I like the composition from this post (https://forums.totalwar.org/vb/showpost.php?p=1891954&postcount=3) to start:
The army that Hannibal used for his campaign in Italy after recruiting some Gallic mercenaries in the north of Italy. A lot of soldiers from different nations.
10/ 12000 Africans (4000 light)
7/8000 Spania (4000 light)
10/15000 Celts
4000 Numidian cavalry
4000 Celtic heavy cavaly
2000 Spanish heavy cavalry
with EB units
1 General
Infantry
1 unit of Balearic light infantry
1 unit of Balearic slingers
1 unit of Iberian caetrati
1 unit of Iberian loricati scutari
2 units of Numidian skirmishers
2 unit of Gaesatae
3 units of Geroas
2 units of Aanatim Aloopim (Elite African pikemen)
1 unit of Dorkim Aloopim (Elite African swordsmen)
Cavalry
2 units of Numidian cavalry
2 units of Brhentin (Gallic noble cavalry)
1 unit of Iberi Lanceari
The Africans in particular should be in the 5-7 experience range, the Iberians in the 2-4 range. That should give them some survivability. Then hopefully the Italians appearing will reinforce the Gallic losses.
What also needs to happen is that on a specific cue (either date or taking a settlement) that army is teleported to Africa to defend the homeland.
As a nice to have, Hasdrubal's army in Spain:
Second Punic War – Hispania
Based on the army of Hasdrubal Gisgo and Magon Barca at the battle of Ilipa
50/70000 infantry
4000 cavalry
32 elephants
with EB units
1 General
Cavalry
1 unit of Numidian cavalry
1 unit of Iberi cavalry (lanceari, cursi, equites caetrati)
2 units of elephants
Infantry
1 units of Misteret Izrahim Tsarim (Phoenician citizen phalanx)
1 units of Dorkim Lubaim-Ponnim Mesoarianim (Liby-Phoenician heavy infantry)
2 units of Aanatim Lubim (Lybian spearmen)
4 units of Aanatim Aloopim (Elite African pikemen)
4 units of Iberi infantry
1 unit of Balearic light infantry
1 unit of Balearic slingers
1 unit of Numidian skirmishers
They don't need any regenerating units or anything, just to appear around 209BC.
Possibly some other reinforcements like those landed in Sicily, the ones that nearly got through to Tarentum and those in 215BC and 207BC (the latter resulting in Metaurus).
Alternatively, if it can be done via console command, I'd be appreciative of that.
Any help welcome!
King_Arthur
04-24-2008, 16:04
Ave Quintus
To follow from TWC to recreate Hannibal just patse this into your:
eb/data/scripts/show_me/EBBS_SCRIPT.txt
monitor_event CharacterTurnStart FactionType egypt
and I_TurnNumber = 224
spawn_army
faction egypt
character, Hannibal, named character, command 0, influence 0, management 0, subterfuge 0, age 31, , x ?, y ?
unit carthaginian cavalry generals bodyguard, exp 7 armor 1 weapon_lvl 1
unit iberian missile balearic slinger, exp 3 armor 0 weapon_lvl 0
unit iberian infantry light caetratii, exp 4 armor 1 weapon_lvl 1
unit iberian infantry loricati scutarii, exp 4 armor 1 weapon_lvl 1
unit african skirmisher javelinmen, exp 5 armor 0 weapon_lvl 0
unit african skirmisher javelinmen, exp 5 armor 0 weapon_lvl 0
unit celtic infantry gaesatae, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaesatae, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaeroas, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaeroas, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaeroas, exp 0 armor 0 weapon_lvl 0
unit carthaginian infantry aanatim afrikanim aloophim, exp 6 armor 1 weapon_lvl 1
unit carthaginian infantry aanatim afrikanim aloophim, exp 6 armor 1 weapon_lvl 1
unit carthaginian infantry dorkim afrikanim aloophim, exp 7 armor 1 weapon_lvl 1
unit celtic cavalry brihentin, exp 0 armor 1 weapon_lvl 1
unit celtic cavalry brihentin, exp 0 armor 1 weapon_lvl 1
unit iberian cavalry heavy lancearii, exp 4 armor 1 weapon_lvl 1
unit african missile cavalry numidian, exp 5 armor 0 weapon_lvl 0
unit african missile cavalry numidian, exp 5 armor 0 weapon_lvl 0
end
console_command give_trait Hannibal GoodTactician 3
end_monitor
You can give Hannibal further traits to reflect his prowess and recent victories.
You can not script in Italian replacements direct to Hannibal but you can script Italian Allied units around Capua to reflect this?
Just follow the above formula for Hasdrubal's army.
Hope this helps
Regards
KA
EDIT: make sure you obtain the correct x & y coordinates beforehand using the console command: show_cursorstat
QuintusSertorius
04-24-2008, 16:14
Brilliant, thanks for that King Arthur. Any thoughts on this business of having a condition that makes him teleport to Africa?
Does it matter where in the script I put it?
King_Arthur
04-24-2008, 16:27
Brilliant, thanks for that King Arthur. Any thoughts on this business of having a condition that makes him teleport to Africa?
You're welcome. Regarding sending Hannibal back too Africa, it is possible, either use a console command move_character "Hannibal" x? , y ? or you can script in conditions such as Rome besieging Capua etc to reflect the end of the war and when this condition is met Hannibal will move to Africa. I haven't actually tried this yet in EB so not 100% it will work, but in theory it should!!
Does it matter where in the script I put it?
Nope. I usually place all new additions at the bottom of the file so I know where to look for changes or problems. The engine will look for the faction turn command not script file location. Just make sure it sits above this:
end_script
this marker is the script ending
What I would do though is use a breaker to seperate your Punic War, I use:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Second Punic War: Hannibal in Italy;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
INSERT YOUR SCRIPT HERE
This way its easy to track your 'special events'
actually if you realy want italian replacements put...
monitor_event CharacterTurnStart FactionType egypt
and I_TurnNumber = 220
console_command create_unit Hanibal "BRUTTIAN INFANTRY INTERNAL NAME" 1 3 3 3
console_command create_unit Hanibal "SAMMINITE INFANTRY INTERNAL NAME" 1 3 3 3
That way if hanibal has any free slots in his army, they will spawn.
If you wish to return him, you can do it in the game, and use the move character command.
Also, be carefull to make sure there is not another character in the game called hanibal.
QuintusSertorius
04-24-2008, 17:01
That actually sounds like a simpler (and thus more elegant) solution, just moving him with a console command. Then I can decide when it happens, rather than getting all complicated with scripting.
I take it turn 224 means 56 years (56x4=224) into the game? Now I'm going to have to think about the other armies that need spawning...
I'm going to need to go away and re-read The Fall of Carthage for the major reinforcements to Italy, Sicily and Spain.
Could I script the appearance of a Makedonian army in Illyria? Would dumping an army there cause them to attack if they saw the settlement's garrison was weak?
How do I use the move character command? I'm tempted to use that to shunt some Hai stacks into Seleukid territory, and maybe speed up their reinforcements.
Now my mind is running away with me, has anyone though to scripting the appearance of Antiochos to revive the Seleukids?
King_Arthur
04-24-2008, 17:27
I take it turn 224 means 56 years (56x4=224) into the game?
Yep. Your formula is correct. However if you want armies to spawn in Winter add 3 as the X4 formula will take you into Qtr 1.
Could I script the appearance of a Makedonian army in Illyria? Would dumping an army there cause them to attack if they saw the settlement's garrison was weak?
It could well do, but it could also just turn around and head back to Macedonia.....
If the army is there just to offer you as the Romani a good battle for the Macedonian wars, you can give the spawned Macedonian General an 'Immovable' trait (I think that's in EB???) and he will stay put, but his army may break away. The only real solution would be to have the army of Macedon spawn on your Romani turn and have an army ready to attck it straight away (assuming this is what you want?). Otherwise you could script the army to attcak a settlement, but it all depends on how complicated you want to get.
How do I use the move character command? I'm tempted to use that to shunt some Hai stacks into Seleukid territory, and maybe speed up their reinforcements.
You would need to obtain the name of the General or Captain leading the Hai stack and then using the console type:
move_character "CHARACTER NAME" x?, y?
QuintusSertorius
04-24-2008, 17:34
That business with Makedonia might be getting a bit too tricksome. Perhaps easier to just wander down there and cause some havoc.
Thinking about reinforcements, there isn't a lot to do as it turns out.
In Italy there's three armies: Hannibal's to appear in 216BC in Campania; Reinforcements under Bomilkar to appear in Locri (ie Lucania) in 214BC; Hasdrubal's army marching through the alps in 208/7BC is another one. Then some Italian reinforcements and maybe the odd rebel Italian army wandering about.
In Spain we've got Gisgo/Hasdrubal's army there and Himilco and reinforcements in 216BC (I think the same one who then landed in Sicily in 213BC - so I could just move that stack).
In Sicily Himilco's army in 213BC near Syracuse (perhaps move the stack from Spain).
Could I script the appearance of a Makedonian army in Illyria? Would dumping an army there cause them to attack if they saw the settlement's garrison was weak?
There is no way to predict what the AI will do with a spawned army. AI factions' armies will usualy either move to the closest settlement of that faction or become pinned while rebel stacks will most of the time just stand around idle.
Is this for RTW, BI, Alex, or all of the above?
King_Arthur
04-25-2008, 08:21
Is this for RTW, BI, Alex, or all of the above?
It can be used for all the above.
QuintusSertorius
04-25-2008, 15:22
Seems like I'll need to get some spies over to Africa and check out who the family members are.
Or might this be easier if I made Hannibal a general, rather than family member? Or would he get a rubbish bodyguard if I did that?
Or might this be easier if I made Hannibal a general, rather than family member? Or would he get a rubbish bodyguard if I did that?
He would get whatever bodyguard you have as first unit in your spawned stack (that's how some Greek FMs get Spartiates as bodyguards in EB).
QuintusSertorius
04-25-2008, 15:41
He would get whatever bodyguard you have as first unit in your spawned stack (that's how some Greek FMs get Spartiates as bodyguards in EB).
Are there any advantages in making him a general, rather than family member?
King_Arthur
04-25-2008, 15:59
Are there any advantages in making him a general, rather than family member?
I would stick with him being a FM - you can give him some nice traits this way and Ancilliaries. Not sure if there are any benefits of just being a general. Also if he is a FM he can hire Mercs, generals can not.
QuintusSertorius
04-26-2008, 11:09
So turn 225 is summer 216BC, right? Turn 233 is summer 214BC. Turn 256 is Spring 208BC.
Would it be worth making the less important generals (like Himilco and Bomilkar) just Generals, rather than family members? There's a risk here if I put the other reinforcements in that I'mm ballooning up the Qarthadastim family tree.
Having generals won't mmake the duplicate name problem go away.
And spies are a waste of time.
In the game, just before you use the script, use the console and type, character_reset Hanibal (what ever surname you will give the scripted hanibal). If a error comes up saying he doesn't exist, then you know the name slot is free.
QuintusSertorius
04-26-2008, 11:52
If there is a character called Hannibal when I put the command in, what happens?
Oh, and how do I give him the trait related to knowledge of Logistics?
King_Arthur
04-26-2008, 11:59
Oh, and how do I give him the trait related to knowledge of Logistics?
Quintus, you may add traits underneath the army spawn script. So, too look back at page 2 of this thread:
monitor_event CharacterTurnStart FactionType egypt
and I_TurnNumber = 224
spawn_army
faction egypt
character, Hannibal, named character, command 0, influence 0, management 0, subterfuge 0, age 31, , x ?, y ?
unit carthaginian cavalry generals bodyguard, exp 7 armor 1 weapon_lvl 1
unit iberian missile balearic slinger, exp 3 armor 0 weapon_lvl 0
unit iberian infantry light caetratii, exp 4 armor 1 weapon_lvl 1
unit iberian infantry loricati scutarii, exp 4 armor 1 weapon_lvl 1
unit african skirmisher javelinmen, exp 5 armor 0 weapon_lvl 0
unit african skirmisher javelinmen, exp 5 armor 0 weapon_lvl 0
unit celtic infantry gaesatae, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaesatae, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaeroas, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaeroas, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaeroas, exp 0 armor 0 weapon_lvl 0
unit carthaginian infantry aanatim afrikanim aloophim, exp 6 armor 1 weapon_lvl 1
unit carthaginian infantry aanatim afrikanim aloophim, exp 6 armor 1 weapon_lvl 1
unit carthaginian infantry dorkim afrikanim aloophim, exp 7 armor 1 weapon_lvl 1
unit celtic cavalry brihentin, exp 0 armor 1 weapon_lvl 1
unit celtic cavalry brihentin, exp 0 armor 1 weapon_lvl 1
unit iberian cavalry heavy lancearii, exp 4 armor 1 weapon_lvl 1
unit african missile cavalry numidian, exp 5 armor 0 weapon_lvl 0
unit african missile cavalry numidian, exp 5 armor 0 weapon_lvl 0
end
console_command give_trait Hannibal GoodTactician 3
end_monitor
What you need too do is simply add:
console_command give_trait Hannibal LogisticalSkill 3
3 is the the higest level - this will appear as "Logistician" in game on his traits section. If you didn't want it this high simply change to either 1 or 2
The traits and the movement codes will affect the other hanibal.
QuintusSertorius
04-28-2008, 13:28
So the bit I'm going to chuck in is thus:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Second Punic War: Hannibal in Italy;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
monitor_event CharacterTurnStart FactionType egypt
and I_TurnNumber = 225
spawn_army
faction egypt
character, Hannibal, named character, command 0, influence 0, management 0, subterfuge 0, age 31, , x 105, y 124
unit carthaginian cavalry generals bodyguard, exp 7 armor 1 weapon_lvl 1
unit iberian missile balearic slinger, exp 3 armor 0 weapon_lvl 0
unit iberian infantry light caetratii, exp 4 armor 1 weapon_lvl 1
unit iberian infantry loricati scutarii, exp 4 armor 1 weapon_lvl 1
unit african skirmisher javelinmen, exp 5 armor 0 weapon_lvl 0
unit african skirmisher javelinmen, exp 5 armor 0 weapon_lvl 0
unit celtic infantry gaesatae, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaesatae, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaeroas, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaeroas, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaeroas, exp 0 armor 0 weapon_lvl 0
unit carthaginian infantry aanatim afrikanim aloophim, exp 6 armor 1 weapon_lvl 1
unit carthaginian infantry aanatim afrikanim aloophim, exp 6 armor 1 weapon_lvl 1
unit carthaginian infantry dorkim afrikanim aloophim, exp 7 armor 1 weapon_lvl 1
unit celtic cavalry brihentin, exp 0 armor 1 weapon_lvl 1
unit celtic cavalry brihentin, exp 0 armor 1 weapon_lvl 1
unit iberian cavalry heavy lancearii, exp 4 armor 1 weapon_lvl 1
unit african missile cavalry numidian, exp 5 armor 0 weapon_lvl 0
unit african missile cavalry numidian, exp 5 armor 0 weapon_lvl 0
end
console_command give_trait Hannibal GoodTactician 3
console_command give_trait Hannibal LogisticalSkill 2
end_monitor
I still need an exact location, which I'll work out. Can I add Traits to him with console commands? Any ideas on additional ones he should have? I'm thinking the one about being a skilled cavalry commander should be in there. Something to do with taking Eagles perhaps?
Any thoughts on the random Italian armies? Could they be spawned as rebels?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Second Punic War: Italian Rebel armies;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
monitor_event CharacterTurnStart FactionType slave
and I_TurnNumber = 228
spawn_army
faction slave
character, Figvlvs, named character, command 0, influence 0, management 0, subterfuge 0, age 30, , x ?, y ?
unit italic cavalry campanian, exp 3 armor 1 weapon_lvl 1
unit samnite infantry spearmen, exp 0 armor 0 weapon_lvl 0
unit samnite infantry spearmen, exp 0 armor 0 weapon_lvl 0
unit samnite infantry swordsmen, exp 0 armor 0 weapon_lvl 0
unit samnite infantry swordsmen, exp 0 armor 0 weapon_lvl 0
unit greek infantry lucanian spearmen, exp 0 armor 0 weapon_lvl 0
unit greek infantry lucanian spearmen, exp 0 armor 0 weapon_lvl 0
unit italic infantry bruttian, exp 0 armor 0 weapon_lvl 0
unit italic infantry bruttian, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaemile liguriae, exp 0 armor 0 weapon_lvl 0
unit celtic infantry gaemile liguriae, exp 0 armor 0 weapon_lvl 0
unit celtic missile ioasatae, exp 0 armor 0 weapon 0
unit greek smirmisher akontistai, exp 0 armor 0 weapon 0
unit celtic cavalry ligurian, exp 0 armor 0 weapon_lvl 0
end
end monitor
Or could I just do this with a console command whenever I feel the need to fight some Italian armies? Does spawn_army work as a console command?
Use "show cursorstat" to get the exact location.
Yes you can add traits when you want.
To spawn a rebel you can use create unit with a existing rebel captain.
Spawn army doesn't work in console.
QuintusSertorius
04-29-2008, 17:32
Haven't played any games for a few days, but I'll have some hours to kill in a bit so I'll get my co-ordinates, check that there's no Hannibal already, move some offending Hai family members away from the Sauromatae and possibly try out my Hannibal script. :)
Thanks everyone who's helped so far!
QuintusSertorius
04-30-2008, 23:27
I've put just the Hannibal script in. I'm tempted in the meantime to try out the spawn unit or whatever it's called to bolster the Qarthadast armies in Spain, which are presently pitiful.
Question :
Will spawn_army
faction spain
character, Figvlvs, named character, command 0, influence 0, management 0, subterfuge 0, age 30, , x ?, y ?
spawn a general, or a family member? does it all depend on the kind of unit which is the first to be selected?
QuintusSertorius
05-01-2008, 20:22
I think it depends on the kind of unit that's first underneath it.
How is this going? I'm trying to add a few army spawns cripts right now, and continue to get a CTD, without error message when the trigger turn hits.
QuintusSertorius
05-02-2008, 17:20
I haven't hit summer 216BC when he's supposed to appear, yet. I'm in winter 219BC.
Please let me know and I'll add it in my script as well. Actually, I might spawn Hanibal and a companion army of reinforcements, and a few years later one for Italians.
If you want to test the script just to see if it even works, set the turn number as needed.
FYI, some of my CTDs appear to be the result of using monitor_event CharacterTurnStart.
the EBSS scripts use monitor_event FactionTurnStart might work better.
In the EBSS script, I see the command "Kill Character" before spawning a character. I'm guessing you can't have two characters with the same name.
In some place it is mentioned twice. Are there any constraints around this? Hownecessary is it?
QuintusSertorius
05-02-2008, 22:28
You definitely can't have two with the same internal name, although sometimes they can appear to have the same name in the game.
QuintusSertorius
05-05-2008, 23:48
AAARGH!!!!
After all this effort, nothing happened, and I found out why:
https://img.photobucket.com/albums/v66/Kiero/EB%20screenshots/Hannibal.jpg
A Hannibal came of age a few years before the event. What's worse, I can't move him either, his internal name is not "Hannibal", I've no idea what it is.
I've got a save before the thing was supposed to go down; is there something I can put in the script to kill the existing one?
QuintusSertorius
05-06-2008, 00:12
I tried adding console_command kill_character "Hannibal", but it didn't do a thing.
Any ideas? It seems the script doesn't work at all, probably because of the aforementioned family member.
Is there a simpler way without turn-counters that just spawns him on the next turn, since I'm in summer 216BC anyway?
QuintusSertorius
05-06-2008, 14:44
I've given up on scripting his army, instead I transported a convenient FM with a small army and zinged him up to a full stack. Now I just have to give him some appropriate traits.
https://img.photobucket.com/albums/v66/Kiero/EB%20screenshots/NotHannibal.jpg
King_Arthur
05-08-2008, 22:26
Question :
Will spawn_army
faction spain
character, Figvlvs, named character, command 0, influence 0, management 0, subterfuge 0, age 30, , x ?, y ?
spawn a general, or a family member? does it all depend on the kind of unit which is the first to be selected?
Not sure if you've figured this out yet, but if you use the phrase "named character" you will spawn a family member. If you use "general" you will just get a captain.
When you spawn a Family Member you can assign him any unit allowed by his faction, foot or mounted. This has to be the first unit in the army section though.
So this goes in the EBBS?
And how do I set spawn coordinates?
MButcher
05-31-2008, 02:33
This has probably been thought of before, but if the problem is that there are too many hannibals, then why not just script in a guy named "Hannibal Barca", or "Hannibal son of Hamilcar"?
Bear in mind that I have no idea how the internal processes work or if this is even relevant.
So how do I add units to an army? And how do I input the Carthaginian FM's name into the console? I've done it with a Captain Mago, but it just tells me "character not found" with other FMs.
I hate to prematurely bump this, but anyone who knows the format of Carthaginian family names could really help me out... (i.e BalishekBurkadurr r whatever)
Edit- I see you viewing the topic, Quintus... help! :P
In the same manner as scripting Hannibal and his army, could you script the appearance of a rebel faction general with an army of roman troops, representing a civil war or the rebellion of an army?
where do you find the in-game names for units and family members?
QuintusSertorius
06-11-2008, 19:53
In-game names are all in the names.txt, which I think is in Data\text. That tells you what names are valid. I'm fairly certain you could script rebel armies for the civil war. I'm also thinking of doing that for "barbarian" migrations.
could you script a rebel army with roman legions
vBulletin® v3.7.1, Copyright ©2000-2025, Jelsoft Enterprises Ltd.