Post feature RSS Scripts

Description of the main scripts and instructions for them.

Posted by on

Three types of scripts work in parallel in the mod: regular med2 scripts, advisor scripts, Lua scripts.
Basically, everything is written in lua, which expands the possibilities of scripting in copper and reduces the speed of the transition. Now it is from 15 seconds to 2 minutes - it depends on the number of characters on the strat map. Here's how the turn transition time changes:

  • 2 move - 00:15
    34 move - 00:37
    121 move - 01:58
    159 move - 01:25
    186 move - 02:01
    199 move - 01:35
    229 move - 02:05
  • 343 move - 02:34

In the next version I will try to speed up the transitions even more.

So, in fact, some scripts:


Units above the limit
Implementation of hiring units above the limit as mercenaries.


Auto merge AI armies
AI armies will automatically merge into one full stack if they are in the same region and are not in a siege, fleet, city or fort. Fleets merge into one if they stand side by side. Transported armies in them are also combined into one stack.


Forts will now be of two types
-stationary - spelled out from the start and indestructible, stone walls on the strat map and on tactics.
-field forts - destroyed, wooden walls on the strat map and on tactics, cost = 2000.

imp1678282461 3


View tactics(program feature)
Now you can view any tile on tactics. You need to select a tile and click with the mouse wheel, in the window that appears, click on "View tactical map". Do not press the second button - this is for hot-seats.

imp1680904600 1


Dismounting units
A script that allows you to dismount mounted crossbowmen immediately before the battle (one unit per click) (the army must be under the leadership of the general), and after the battle or when you press "Avoid battle", the units will climb back on the horse. :) I plan to do the same for assaults, but a little later.
After opening the prebattle scroll, you need to click on the adviser button (question mark) in the upper right corner of the scroll.



Generation of objects on tactics
Cities, forts, fleets and some objects from the start map are now displayed on tactics.


Faction inheritance through dynastic marriage
A script with which it will be possible to inherit a faction through a royal marriage.
How does it work:
- a log is kept (table in lua) with a list of royal children:
- at the start of the campaign, all minor sons are entered in the table
-when new children are born, their gender and father's trait for royal blood (dynasty) are checked and also entered in the table
-at the age of majority, the corresponding children are deleted from the table
-the script itself is activated at the time of the death of the ruler of the faction:
-if the new ruler is not of royal blood
-if the faction ran out of members of the royal blood family (the trait "French blood", English, etc. - the dynasty that was the ruler from the start), then
-the table with children of this faction is checked and if they are not there, then
- it checks if there is a married princess (of royal blood, of course: :) and for which faction and if there is one, then
-This faction completely becomes part of the one where the princess is. For the husband of this princess, most likely, I will make anchi "ruler of France", etc.
-AI can also inherit the faction of the AI, but not the player. The player can inherit all factions except the rebels, the Pope, the Aztecs, the Mughals, and the Timurids.


Piracy and boarding script
Boarding script. Here I removed the randomness to immediately show how it works, in mod is a very low percentage of the probability of capturing an enemy ship. Any admirals can do this.


Only the ships "Corsair Cog", "Corsair Galley" and "Pirate Ship" are involved in the piracy script. Only with them you can get the trait of the first level, and the second level can be obtained for defeating enemy admirals and for blockades of ports. As soon as the holds are full (the second level of the trait), you will need to sail to any point, meet your merchant there on the shore and click on the fleet - we will make a deal (transfer the trait) and get money from 1000 to 5000 gold. Or you can sail to your port and unload there.


The script for the surrender of the besieged settlement
In the first option of handing over the city to the AI, the player may not even have siege equipment, but for each attempt to "negotiate" a random amount of money will be withdrawn from the treasury. The city's garrison survives.
In the second option, you need to torture through a "false assault", but for this you can get negative traits. The garrison does not survive - conditionally, surrenders.


Vassal Control
If a player has a vassal, then he can turn on the transfer of moves to his vassal, i.e. during the transition of the move, it will be possible to make moves also for them. Disabled by default. You can turn it on by pressing the "Set control over vassals" button in the settlement recruitment menu. If there are too many vassals and you do not want to make moves for each of them, then you can enable / disable the transfer of the move individually for each of them - the F5 button.

imperial1661723115 1

imperial1661723139 2
Do not declare war on an ally or vassal in the same turn and do not immediately make him a vassal - the script may not work for this faction. I also do not recommend getting rejected in diplomatic negotiations while playing as a vassal - the script may stop working for this faction. This is another feature of the engine. Looks like this has been fixed.


Character dismissal
The mod has the ability to fire (kill) some agents. To do this, you need to open the character's scroll, it must be out of the city, etc., click on the question button, and then follow the instructions


imperial1661723626 1 1

imperial1661723642 2



Change of heir
It is possible to change the heir. To do this, you need to open the family tree. Select the desired character, click on the question button and in the adviser that appears, click the "Lesson" button. For each change of heir, a certain amount will be withdrawn from the treasury.

imperial1661723772 1


imperial1661723794 2


By default, a script works that automatically changes the heir to a blood heir (the trait "French blood", English, etc. - the dynasty that was the ruler from the start), i.e. now, if the computer will appoint an adopted character as the heir, the script will quickly return the hereditary crown to the true heir :) Works for all factions.

Desertion script and army replenishment
The desertion of the army will occur automatically on neutral or hostile lands - every turn, several people will desert from each squad.You can put an army for replenishment only in your own or allied lands. To do this, click on the button "show general unit details" and follow the instructions. The trait "Replenishing the army" should appear, but note that there is one glitch in copper when the last trait is not visible. Therefore, it can repeat several times - money for replenishment is not withdrawn immediately.
You can also replenish the fleet at ports - automatic replenishment of several people per turn.

2023 04 0

2023 04 0 2

2023 04 0 3



Garrison script and GF script (garrison in forts)
The first script churns out a garrison in AI cities and forts when assaulting, sortie or attacking outside the city - the composition of the garrison depends on the owner. The second ensures the constant presence of the garrison in the forts, which is why the AI willingly attacks them - the composition is the same squad (temporarily).

imperial1661724943 18 08 2022 1



Auto declaration of war
Now, when crossing the border of a neutral faction in a random order, war will be automatically declared.
If the army is on a campaign led by a general, then no. The crusaders get the right to pass through the lands of the Catholics, and the participants in the jihad through the lands of the Muslims.
With exclusion from the church, war is automatically declared on the Pope.


Hiring Troops - Population
Now the population of the city is directly dependent on hiring and vice versa. If the settlement is less than or equal to 1000 people, then it will no longer be possible to hire. When hiring, the population is deducted from the settlement and added back during the dissolution, and the dissolution in foreign lands will add the population to them, that is, in other words, where he dismissed, there is a plus to the population. The dissolution of the fleet at sea does not replenish the population - only in the port.


Change of religion
If some faction in each settlement simultaneously has one or another religion greater than or equal to 55%, then the faction converts to a new faith, all old buildings collapse and new ones appear. The appearance of the clergy remains, for now, the same. This affects all factions except the Pope and Rebels.


Siege and immediately assault
This script makes the AI ​​storm cities without sieges, i.e. if the AI ​​has siege weapons in the stack (ballistas, catapults, etc.), then it can decide to attack on the move, without foreplay.


These were the main scripts. There are also other scripts in the mod, but they do not need to be explained. Scripts will be updated and new ones will be added - this is the basis of this mod.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.