Am trying to get faction specific mercs working; tried this sort of method
Originally Posted by
Ishan
To make it more interesting we can now also make a merc unit available to only England when it allies with France.
So need to add one more event:-
First make the event (
e_o) faction specific:
Code:
monitor_event PreFactionTurnStart FactionType england
set_event_counter e_o 1
end_monitor
monitor_event FactionTurnEnd FactionType england
and I_EventCounter e_o == 1
set_event_counter e_o 0
end_monitor
Now all you have to do is add this event along with
x_y in
descr_mercenaries.txt file like this
Code:
unit Galloglaich exp 0 cost 830 replenish 0.08 - 0.25 max 4 initial 1 events { x_y e_o }
And we are done. Now when the 2 factions are Allies(France and England in the above case) only England can recruit this merc unit i.e.(Galloglaich).
actual code was
Code:
monitor_event PreFactionTurnStart FactionType egypt
if I_EventCounter egypt_merc_turn == 0
console_command create_unit Salient "citlev_naugir" 1 0 0 0
end_if
if I_EventCounter egypt_merc_turn == 1
console_command create_unit Salient "citlev_ashapr" 1 0 0 0
end_if
set_event_counter egypt_merc_turn 1
end_monitor
monitor_event FactionTurnEnd FactionType egypt
if I_EventCounter egypt_merc_turn == 1
console_command create_unit Salient "citlev_feddys" 1 0 0 0
end_if
if I_EventCounter egypt_merc_turn == 0
console_command create_unit Salient "citlev_ashapr" 1 0 0 0
end_if
set_event_counter egypt_merc_turn 0
end_monitor
&
Code:
unit ferakine exp 0 cost 830 replenish 0.9 - 1.95 max 4 initial 1 events { egypt_merc_turn }
The initial 1 merc unit did turn up available to egypt only, but it never replenished - I stuck the console_command units in to check the counter was setting to right values and it was (i.e. 0 at start of turn and 1 at end, before it re-sets) - I tried the higher replenish values in case the pool was resetting each time the counter zero'd but that hasn't helped.
tried also
Originally Posted by
Gigantus
I have actually used this type of coding (with normal counters) for 1648 to make faction specific coding easier. Instead of wrangling with the faction name and it's coding, you simply use the
event counter in the code:
declare_counter reichs_fraktion ; belongs to a confedaration or not
declare_counter katholisch ; catholic faction or not
;--- Schweden ---
declare_counter england_turn
monitor_event PreFactionTurnStart FactionType england
set_counter england_turn 1
set_counter reichs_fraktion 0
set_counter katholisch 0
end_monitor
monitor_event FactionTurnEnd FactionType england
set_counter england_turn 0
end_monitor
type method with my code;
Code:
declare_counter egypt_merc_turn
monitor_event PreFactionTurnStart FactionType egypt
set_counter egypt_merc_turn 1
end_monitor
monitor_event FactionTurnEnd FactionType egypt
set_counter egypt_merc_turn 0
end_monitor
and don't get the merc at all
any ideas?