In "wrath of sparta",the game designer wants to spawn some army and free the upkeep cost for persian in special time,but I found that the script for decreasing upkeep cost
couldn't work in time,it means when the army is too many to feed,the AI will dismiss some of them.It's not expected,I don't know what happened in backstage.Here is my test,I spawned
some army using sparta,then freed the upkeep cost of my new army.The scripts referred are below:
function spawn_sparta_army ()
spawn_army(0, 0,"pel_sparta",unit_list["1"],"1",false);
spawn_army(0, 0,"pel_sparta",unit_list["1"],"2",false);
spawn_army(0, 0,"pel_sparta",unit_list["1"],"3",false);
end
"spawn_army()" is defaut script which already contains the function freeing the upkeep cost,but it only works for the first spawned army,maybe doesn't work for the rest ones.Here
is my words to free the cost of the rest:
function decrease_sparta_upkeep ()
local faction_list = cm:model():world():faction_list();
for i = 0, faction_list:num_items() - 1 do
local current_faction = faction_list:item_at(i);
if current_faction:name() == "pel_sparta" then
for j = current_faction:military_force_list():num_items() - 3, current_faction:military_force_list():num_items() - 1 do
local char = current_faction:military_force_list():item_at(j):general_character():cqi();
cm:apply_effect_bundle_to_characters_force("pel_persian_army_upkeep",char,-1); --free upkeep cost.
end
end
end
end
I fired them every turn in sequence,but the "decrease_sparta_upkeep ()" only worked one turn later,it should work immediately,diden't it?So what's the "cqi" and why it can't play in time?