Is it possible to spawn a stack in a region 1 or 2 turns after a battle occurred there?
Cheers
Is it possible to spawn a stack in a region 1 or 2 turns after a battle occurred there?
Cheers
Repeat for each region.Code:declare_counter battle_in_region_x declare_counter turns_to_region_x_spawn set_counter battle_in_region_x 0 set_counter turns_to_region_x_spawn -1 monitor_event FactionTurnStart FactionType slave set_counter battle_in_region_x 0 end_monitor monitor_event PreBattle IsRegionOneOf x set_counter turns_to_region_x_spawn 3 end_monitor monitor_event FactionTurnStart FactionType slave and I_CompareCounter turns_to_region_x_spawn == 0 spawn_army ;spawn army here end set_counter turns_to_region_x_spawn -1 end_monitor monitor_event FactionTurnStart FactionType slave and I_CompareCounter turns_to_region_x_spawn > 0 inc_counter turns_to_region_x_spawn -1 end_monitor
Last edited by Azim; September 05, 2008 at 03:59 PM.
Dominion of the Sword, a Medieval II: Total War Supermod
Under the patronage of Archaon. Proud member of the House of Siblesz
My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!
AFAIK, PreBattle doesn't work.
I think PreBattle fires while you are in the battle map, so you can't use strat map commands in a PreBattle monitor, but all we are doing here is setting counters, so it should be fine. (Please correct me if I am wrong)
Dominion of the Sword, a Medieval II: Total War Supermod
Under the patronage of Archaon. Proud member of the House of Siblesz
My friend died from chain letters. If you don't post this again 100 times, he will come and kill you in your sleep!
Azim, first, thank you for your help. Second, is there no way to functionise this? Do I really need to repeat this block of code for each region? If so, all I have to say is, Wow! Two years ago I wrote a terrain engine in C in less lines of code than it will take to add this script to my mod.
Cheers
Last edited by GrnEyedDvl; September 07, 2008 at 12:14 AM.
@Alpha
Check out the length of the 2 scripts in my sig, garrison script and recruitment limitations, both combined are about 100,000 lines of code. which is pretty resourceful of me considering the limits we have with this scripting engine and what each script manages to do! and both run without turn lag... but they give an idea of how much code you need to write to perform specific things, you can't use any kind of 'method' and have to script every individual event or condition you want monitored... there are no real short cuts like in a regular programming language such as Java...
Which is going to be your biggest issue if you are scripting this for the AI, every settlement or region you script will be completly dependant on whether it is the AI or players turn, which may end up meaning you will need to script each region\settlement twice (one for player turn one for AI turn)...
Depending on the aim of the mod you plan to write the script for, i would suggest targeting specific regions first. Until you know what kind of cost it will take on turn lag...
Good luck with it tho, sounds like an interesting idea for a script![]()
...longbows, in skilled hands, could reach further than trebuchets...
100,000 lines of code to do something that should take little more than a hundred. CA....
I'll add Azim's code for a few regions and see how it goes.
Cheers