Now, something that reduces significantly the turn end times. It is a faction economy script. It is based on MWY G5 faction economy script for SSHIP as it has been implemented by Melooo182 in the bugfix compilation. This new script does exactly the same job, but in 45 monitors instead of 345. For my humble dual core Pentium E2200, this means more than 6 seconds less from LocalFaction's turn_end till its next PreTurnStart.
Step 1:
This part is not included in the attached file, as I use the monitors in "is the AI?" section.
I introduce a new counter, named ai_ec_id, which in each PreFactionTurnStart takes a value depending which faction's turn is "on".
Spoiler Alert, click show to read:
Step 2:
In the main section of the economy script and after the necessary declaration of the new counters, we have monitors that set the ai_ec_id the value we want.
Spoiler Alert, click show to read:
Step 3: For each economic level (in the appropriate order, of course), we have one quite large that checks which identifies which faction's turn is on and issues the corresponding commands. For example:
Spoiler Alert, click show to read:
Of course, there are some special monitors for slave_faction for the debt levels that are different from the "ranked" factions.
There are some other minor optimiztions too, but the big deal is the reduction of the total number of monitors.
Some considerations:
a) Slave_faction is treated always as AIControlled faction. So, if you want to take control of them and remove the bonus that script gives them, you'll have to add into "part 1" a new monitor.
b) In part 1, I 've commented out the condition "and IsFactionAIControlled" for all other unplayable factions of early campaign (that is, for papal_states, teutonic_order, mongols, timurids). So, if you want to take control of these, search for
; and IsFactionAIControlled ;always true, as this faction is unplayable
and change accordingly.
EDIT: Script updated, mainly to fix an error
Spoiler Alert, click show to read:
EDIT2: This can a better idea.
Last edited by gsthoed; August 03, 2014 at 04:54 AM. Reason: add comment
Wow thats impressive + rep
A little "break" for an optimisation not related directly to SS6.4's CSs, but about something I see quite often lately .
I know it has been discussed elsewhere, I' ve tried search for a relevant thread (ok, I didn't search the whole mod workshop) but I couldn't find any.
It's about scripted renaming of settlements.
Let's say we want Palanga to be renamed to Konigsberg when TOs take ownership of it.
One way is this:
There are these two alternative ways to do it without "monitor_conditions". Remove semicolons according to your liking.Code:monitor_conditions I_SettlementOwner Palanga = teutonic_order change_settlement_name Palanga Konigsberg terminate_monitor end_monitor
Proposal A: We use the OccupySettlement, SackSettlement and ExterminatePopulation events
Spoiler Alert, click show to read:
It's the "lighter" one, but it doesn't apply renaming if Palanga is gifted to teutonic order.
Proposal B: More resourceful than A and it doesn't apply renaming immediately (usually and if you play with fog_of_war off, you can't see the difference)
Spoiler Alert, click show to read:
Last edited by gsthoed; July 20, 2014 at 08:49 PM.
Genoese Reinforcement and Seljuk Reinforcement need tweaking, they part of the AI reinforcements script section, but instead of having a monitor each, they could be moved to the same monitor of the Startup reinforcements. (early era only has the Seljuk one)
This is how they are in late era campaign_script
It also has a wtf script part
Spoiler Alert, click show to read:
Here bellow we have the optimization with both armies spawn included in the startup reinforcement monitor
Spoiler Alert, click show to read:
Last edited by Melooo182; July 22, 2014 at 03:02 PM.
As I am reworking on "AI Reinforcements" part of the CS since yesterday
A "smart ass" fix that works:
Yep, no monitorCode:if I_LocalFaction byzantium and I_IsFactionAIControlled milan spawn_army faction milan character Francesco, general, age 28, x 329, y 170 unit Feudal Knights exp 2 armour 0 weapon_lvl 0 unit Armored Sergeants exp 1 armour 1 weapon_lvl 0 unit Armored Sergeants exp 0 armour 1 weapon_lvl 0 unit Urban Crossbow Militia exp 2 armour 2 weapon_lvl 0 unit Urban Crossbow Militia exp 2 armour 2 weapon_lvl 0 unit Urban Crossbow Militia exp 2 armour 2 weapon_lvl 0 unit Urban Crossbow Militia exp 1 armour 2 weapon_lvl 0 unit Feudal Knights exp 2 armour 0 weapon_lvl 0 unit Feudal Knights exp 2 armour 0 weapon_lvl 0 unit Dismounted Feudal Knights exp 2 armour 0 weapon_lvl 0 end add_money milan 18000 end_if
A, just for few seconds
I have something in mind in where the wtf part might work; I 'll check now
EDIT: Finally, I made it!
Add in your CS this:
and then start a hotseat campaign with Fatimids and Byzantium under your control.Code:console_command control egypt console_command control byzantium monitor_event FactionTurnStart FactionIsLocal and IsFactionAIControlled and I_TurnNumber = 0 and I_LocalFaction byzantium log wtf end_monitor
Quit in turn 2 and then check your log output
Last edited by gsthoed; July 25, 2014 at 03:27 PM. Reason: SUCCESS
About Genoese Reinforcement and Seljuk Reinforcement and the cash bonus: It seems like it is the support cost of that spawned army (until they get killed outside Constantinople's walls? ). I cannot answer if this cash bonus is necessary, as I don't know if this command works with that syntax; I think it would be ok with the comma if it was a console_command, but now?
One note, though, that might be useful: I see in my SS 6.1 installation (with BtR submod) that the equivalent script was this:
The bonusCode:;--------------GENOESE REINFORCEMENTS AT CAFFA----------------; monitor_event FactionTurnStart FactionIsLocal ;and IsFactionAIControlled and I_TurnNumber = 0 and I_LocalFaction byzantium spawn_army faction milan character Francesco, general, age 28, x 329, y 170 unit Armored Sergeants exp 1 armour 0 weapon_lvl 0 unit Armored Sergeants exp 0 armour 0 weapon_lvl 0 unit Genoese Crossbowmen exp 2 armour 0 weapon_lvl 0 unit Genoese Crossbowmen exp 2 armour 0 weapon_lvl 0 unit Genoese Crossbowmen exp 2 armour 0 weapon_lvl 0 unit Genoese Crossbowmen exp 1 armour 0 weapon_lvl 0 unit Feudal Knights exp 2 armour 0 weapon_lvl 0 unit Italian MAA exp 2 armour 0 weapon_lvl 0 unit Italian MAA exp 2 armour 0 weapon_lvl 0 unit Famiglia Ducale exp 2 armour 0 weapon_lvl 0 end add_money milan 10000 ; gsthoed note: without comma terminate_monitor end_monitor
Also, the faction's economic system was not so advanced and, if I remember well, Byzantines in late era were not starting at war with the Turks (so Caffa was an interesting target for a human player controlling Byzantines in early turns).
My opinion on the subject? Genoa starts with 8000 denarii and Turks with 16000. Those bonuses in v6.4 just seem too high. Maybe a bonus of 8000 or no bonus (similar to the bonus AI factions receive from the other spawned armies in the "AI reinforcements" section) should be more proper.
Last edited by gsthoed; July 24, 2014 at 04:44 PM. Reason: To write something more useful
Here is a reworked script of "Interactive Events". It is based on the discussion in posts #31-#33. Furthermore, I added the feature described in Withwnar's tutorial "Reload-safe Yes/No Events" in
http://www.twcenter.net/forums/showt...=Game+Reloaded for all these events, except Pirates.
Note, in early campaign the monitor about council_of_clermont was removed, as council_of_clermont is no longer an event.
In the EDCT file, replace from:
;============== Interactive Events ======================
to:
;-------- AI Bad Traits Remove ------------
with this:
Spoiler Alert, click show to read:
Campaign_script for early_campaign:
Spoiler Alert, click show to read:
Campaign_script for late_campaign:
Spoiler Alert, click show to read:
About "AI Reinforcement" section: I am thinking of combine the whole section (without the "No Heir Reinforcement") with "Great People Ancillaries" and "Merchant&Priest&Ship Support Spawn".
I have prepared a script, which I need to test.
Now, about the "No Heir Reinforcement": In "Bug Fixes for SS6.4" thread, posts #48 and #50, there is a general fix for a bug. There are two alternatives too:
a) We can use "status_venice" event_counters (post #8 of current thread) instead of the "I_FactionLeaderAttribute venice Command < 1000" conditions.
b) In post #42 of current thread, I present a faction's economy script. In what I describe as "Step 2", there are some versatile monitors in which we can do the spawning of "heirs" during their faction's turns. I 'll give an example for venice:
In "No Heir Reinforcement", we have this:
Spoiler Alert, click show to read:
That is, we spawn a venetian family member in slave_faction's turn if certain conditions are true.
In "Step 2" of the economy script, we have a monitor for AI-controlled venice:
If we say we 'll do the checks and the spawning during venice's turn instead of slave_faction's turn, then we could have:Code:; it's venice 's turn monitor_event PreFactionTurnStart FactionType venice and IsFactionAIControlled set_counter ai_ec_id 2 end_monitor
Spoiler Alert, click show to read:
If applied for every faction with family_tree, we avoid the "No Heir Reinforcement" monitor and we have less conditions to be checked per turn. Also, if "venice" is a destroyed or a not-emerged faction, we avoid running the "NoHeir" part altogether. This approach has the drawback that removing the "No Heir Reinforcement" feature is more difficult.
EDIT
About "alternative (b)": There might be a conflict with adopted generals etc that come to life in each faction's turn.
Last edited by gsthoed; July 25, 2014 at 10:46 AM.
I like this, i say go for it, the SMM can still manage it, as long as you put some commented out indicators in every "No Heir" part it can be done
i agree the cash bonus is excessive, also they have the economy script, so 8000 should do.My opinion on the subject? Genoa starts with 8000 denarii and Turks with 16000. Those bonuses in v6.4 just seem too high. Maybe a bonus of 8000 or no bonus (similar to the bonus AI factions receive from the other spawned armies in the "AI reinforcements" section) should be more proper.
Faction's Economy Script in Post #42 has been updated. There was an error which is now fixed. Those that have downloaded previous version are asked to apply the fix manually or download the newer version.
Fix is not save-game compatible.
In post #50, about "alternative (b)": There might be a conflict with adopted generals etc that come to life in each faction's turn.
gsthoed, I have tried implementing your "optimized" economy script through being a submod, but I think it is incompatible with BGR IV-E. I don't know if it is also not compatible with BGR II since I haven't played with it yet. I really, really like to have your economy script because it really improves turn times a lot.
Can you please make necessary adjustments so that it will be compatible with BGR IV-E?
I have completed testing a script that combines "AI Reinforcement" with "Great People Ancillaries" and "Merchant&Priest&Ship Support Spawn".
But it is the "Constantinople JIHAD garrison script" for which I have a dilemma.
There is this for the early campaign.
The "create_unit" command has a somehow peculiar function.Code:monitor_event SettlementTurnStart SettlementName Constantinople and not FactionIsLocal and I_SettlementUnderSiege Constantinople and IsJihadTarget Constantinople and I_SettlementOwner Constantinople = byzantium create_unit Constantinople, Contaratoi, num 3, exp 0, arm 0, wep 0 create_unit Constantinople, Toxotae, num 2, exp 0, arm 1, wep 0 create_unit Constantinople, Toxotae, num 2, exp 0, arm 1, wep 0 end_monitor
Since this monitor didn't contain a terminate_monitor, I tend to believe that the goal of the script was the continuous reinforcement of Constantinople's garrison if under siege by jihadists; if this is the case, then the "console_command create_unit" should be used. If the goal was to reinforce this garrison up until its garrison reached 20 units end then stop, then I 'm thinking of using the non console version of "create_unit" and terminate this monitor at the end of the jihad. So, what do you think?
gsthoed, thank you for still making improvements to the game!
But, can you please make your "optimized" economy script compatible with BGR IV-E? I think it's incompatible because if I use it along with BGR IV-E, BGR IV-E's ability to have popups, like enabling Scutage Tax, is gone. I really, really like to use your economy script because it really improves turn times by a lot.
I don't know why your script destroys some elements of BGR. I tried looking at the submod files of BGR IV-E, but I didn't see any changes to the economy script. Maybe, BGR is referencing some codes in the economy script. That's why enabling yours generates errors.
but terminate_monitor wouldnt prevent the monitor to fire again when another jihad is launched upon the same settlement many turns after?
also how will you count the garrison size?
You are right. I had to be more analytic and more careful
Before noticing Withwnar's post, I had prepared this script (for late era):
Spoiler Alert, click show to read:
Note that if Constantinople is under siege by jihadists for 2 sequential or almost sequential turns (which is quite possible), this monitor will give all that is has to give and then will run useless. So I came to consider these options:
a)The "console" version simply does this: As long as the conditions are true and there are free unit slots, it spawns garrison reinforcements. Actually, this was my impression of the "create_units" function, until proved wrong both by Withwnar's post and the results of relevant tests of my own.
If we want the repletion of the garrison slots take place once at most, the non-console command is to be preferred. But the drawback that after this event no more garrison reinforcements can be spawned -even if in the future there are available one or more free slots- is a significant one; it makes this monitor useless. Therefore, I believe the "non console" version should be used only in these cases:
b) Byzantine Constantinople starts a turn under siege by jihadists. All the "spawning" is done at once:
After the first time these commands have been executed, no additional units can be created by this monitor, therefore it can be safely terminated.Code:create_unit Constantinople, Contaratoi, num 8, exp 0, arm 0, wep 0 create_unit Constantinople, Toxotae, num 12, exp 0, arm 1, wep 0
c) We use the "nums" as there are in CSs. We provide the ability for the first Jihad. My personal estimate is that "create_units" commands will reach their "expiration date" during that period and after that the monitor will run useless; it will check at every SttlementTurnStart if SettlementName is Constantinople (or better if IsJihadTarget) without anything to do; thus, we terminate this monitor so as to not run uselessly.
My personal preference? I believe that giving Constantinople ballistra or cannons towers if they don't have it already, along with 2 militia spearmen and 3 archers for one time, is something that the AI can handle better as a defender and it is more "fair" for the attackers (the jihadists, especially the AIControlled ones). Whar I would do if I had to vote for a, b or c? I 'd ask someone else
hehe i had a bit of hard time understanding your post, but i think i got it
what about something like this?
Code:;---- Constantinople JIHAD garrison script declare_counter XXX monitor_event SettlementTurnStart IsJihadTarget and SettlementName Constantinople and I_SettlementOwner Constantinople = byzantium if I_LocalFaction byzantium and not I_HotseatEnabled terminate_monitor end_if if not I_SettlementUnderSiege Constantinople and I_CompareCounter XXX = 1 set_counter XXX 0 end_if if I_IsFactionAIControlled byzantium and I_SettlementUnderSiege Constantinople and I_CompareCounter XXX = 0 console_command create_unit Constantinople, Contaratoi, num 5, exp 0, arm 0, wep 0 console_command create_unit Constantinople, Toxotae, num 8, exp 0, arm 1, wep 0 set_counter XXX 1 end_if end_monitor
Me too . But I couldn't write it better without exhausting myself
hehe, giving the reinforcement once per siege was actually my first thought on this script; I didn't suggest it as it is surely a modification of the initial script. The only "bad" thing with this option is this:
Turn 0: 1st jihadist army starts sieging Constantinople.
Turn 1: Reinforcement garrison is spawned during byzantine turn. In 1st jihadist army's faction's turn, this army attacks Constantinople and loses. Jihadist army 2 start new siege.
Turn 2: No garrison reinforcements for Constantinople.
I see this scenario quite often in crusade targets. However, I don't consider this function of the garrisson script as "unfair". So, how about I start testing this script?
Spoiler Alert, click show to read:
EDIT: Since you have more experience than me in this: How about using the "SiegeEquipmentCompleted" event instead of "SettlementTurnStart"?
Last edited by gsthoed; July 31, 2014 at 02:26 PM.
the problem about SiegeEquimentCompleted would be that if by chance a jihad army has an artillery/siege unit already they can assault the walls immediately and there wont be time for a garrison to spawn...well this already happened with SettlementTurnStart xD...but if a player controlled jihad army for X reason didnt build siege equipment but rather got reinforced with cannons...the garrison would have spawn in byzantine's turn.
Well you said in the previous post that by using "console_command create_unit" once the settlement has its garrison full the command will be ignored, right?
we can simply forget about the counter XXX thing then...its not like it will be robbing much processing power anyway.
Also why removing and I_SettlementOwner Constantinople = byzantium from the monitor conditions? since this monitor is exclusively for byzantine controlled constantinople...why let it run if another factions holds it?
Last edited by Melooo182; July 31, 2014 at 01:44 PM.