Tutorial for a Garrisonscript
Open campaign_script.txt
This is the code, which we implent in campaign_script.txt
First we set the counter rome_siege to 0.Code:;========================================================================================= ;---------- Counter ---------- declare_counter rome_siege ;---------- Garrionscript ---------- monitor_conditions not I_SettlementUnderSiege Rome set_counter rome_siege 0 end_monitor monitor_conditions I_SettlementUnderSiege Rome and I_CompareCounter rome_siege = 0 if I_SettlementOwner Rome = papal_states create_unit Rome, peasant, num 2, exp 2, arm 1, wep 0 end_if set_counter rome_siege 1 end_monitor
If Rome is now under siege ("I_SettlementUnderSiege Rome" ) and is controlled by the papal states ("if I_SettlementOwner Rome = papal_states"), we spawn 2 Peasants ("num 2") with 2 experience (maximum 9) 1 Weaponupgrade (maximum 9) and no Armourupgrade (maximum 9) in Rome.
Now we set the counter rome_siege to 1, because we don't want to spawn the troops two times
Congrats, you have no written a full functional Garrisonscript.
Now you can implent some nice features like, if Arabs siege Rome you Spawn more troops etc.
The small additonial line "and I_FactionBesieging egypt" give the game all inforamtions ehich are needed.Code:;========================================================================================= ;---------- Counter ---------- declare_counter rome_siege ;---------- Garrionscript ---------- monitor_conditions not I_SettlementUnderSiege Rome set_counter rome_siege 0 end_monitor monitor_conditions I_SettlementUnderSiege Rome and I_CompareCounter rome_siege = 0 if I_SettlementOwner Rome = papal_states and I_FactionBesieging egypt create_unit Rome, Feudal Knights, num 4, exp 2, arm 5, wep 5 end_if set_counter rome_siege 1 end_monitor
You can also make more conditions.
For example if it is a citadel better units will spawn:
I hope this small Tutorial will helpCode:;========================================================================================= ;---------- Counter ---------- declare_counter rome_siege ;---------- Garrionscript ---------- monitor_conditions not I_SettlementUnderSiege Rome set_counter rome_siege 0 end_monitor monitor_conditions I_SettlementUnderSiege Rome and I_CompareCounter rome_siege = 0 if I_SettlementOwner Rome = papal_states and I_FactionBesieging egypt and SettlementBuildingExists = citadel create_unit Rome, Feudal Knights, num 4, exp 2, arm 5, wep 5 create_unit Rome, Armored Sergeants, num 4, exp 2, arm 5, wep 5 end_if set_counter rome_siege 1 end_monitor
regards weissnicht




Reply With Quote
















































