Log in

View Full Version : Replenish unit script question



miska
01-08-2006, 23:53
Here is what I have in mind. I would like the game to replenish a general's units whenever he ends his turn in a settlement. Here is what I have so far. I can't get it to work. I only tried with one general, but of course it would be preferable if the script checked all generals for all factions.



script
declare_counter loop
set_counter loop 0

monitor_event FactionTurnStart FactionIsLocal TrueCondition

monitor_conditions EndedInSettlement Quintus
replenish_units Quintus
end_monitor

end_monitor

while I_CompareCounter loop = 0
end_while

end_script


I checked the the overall script works. If I just ask it to reposition quintus, for example, without checking EndedInSettlement, it works.

Mengde
01-09-2006, 10:42
i really don't know if it would effect it but maybe if you aligned replenish units one more tab in.....

monitor_conditions EndedInSettlement Quintus
. replenish_units Quintus
end_monitor

like so? again just giving idea's as i am just a beginning modder.....

alpaca
01-09-2006, 18:53
You can't have a monitor inside another one. You could just use the Condition monitor anyways and add "and FactionIsLocal" to it.
EndedInSettlement doesn't take a parameter, either, you can't check the character name anyhow afaik.

Epistolary Richard
01-09-2006, 19:51
Yep, our inability to check the character's name for anything prevents us from having quite a few neat features :sad:

Myrddraal
01-10-2006, 01:58
You can get rid of one of the monitors, either by using an 'and' as was suggested, or by using an 'if'. Also, I think that this is how you use EndedInSettlement:


script
declare_counter loop
set_counter loop 0

monitor_event CharacterTurnStart Quintus
and EndedInSettlement
replenish_units Quintus
end_monitor

while I_CompareCounter loop = 0
end_while

end_script

miska
01-10-2006, 04:44
Myyrdal,

Thanks for your suggestion. Interesting behaviour with your version of the script. If Quintus is NOT in a settlement, his units get replenished. If he IS in a settlement and needs replenishment, the game CTDs. I'll try a couple more things.

miska
01-10-2006, 05:01
If I change the monitor like so:



monitor_event CharacterTurnStart Quintus
and not InEnemyLands
replenish_units Quintus
end_monitor


Quintus gets replenished whether he is in friendly or enemy lands, and the game still crashes if he is in a settlement when replenished. I am starting to have serious doubts that my mod is even possible.

Monkwarrior
01-10-2006, 12:14
Could it be a problem with the authomatic slow replenishment of the general unit in a settlement?
In fact the general unit in campaign has not a fixed number of soldiers and this type of script may interfer with that feature.

Perhaps it is a silly question but, can you link the replenishment to a settlement instead of a general?

The_Mark
01-11-2006, 18:25
Managing generals in settlements is quite an awkward business with other commands also (e.g. console_command move_character creates a ghost character when you're trying to teleport someone in a city..), so it's probably that. I also doubt that you'll be able to replenish settlements, but trying wouldn't hurt.

miska
01-12-2006, 00:26
hmm, I will try to replenish settlements, although I don't hold out much hope.

I've discovered a few other interesting things while tyring to implement my mod. For example, InEnemyLands does not seem to do anything, and if I use "not InEnemyLands", it is as if there were no condition at all. More experimentation later. Thanks for all the help so far.