Results 1 to 10 of 10

Thread: Replenish unit script question

  1. #1

    Default Replenish unit script question

    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.

    Code:
    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.

  2. #2

    Default Re: Replenish unit script question

    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.....

  3. #3
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Replenish unit script question

    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.
    Last edited by alpaca; 01-09-2006 at 18:54.

  4. #4

    Default Re: Replenish unit script question

    Yep, our inability to check the character's name for anything prevents us from having quite a few neat features
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  5. #5
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Replenish unit script question

    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:

    Code:
    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

  6. #6

    Default Re: Replenish unit script question

    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.

  7. #7

    Default Re: Replenish unit script question

    If I change the monitor like so:

    Code:
    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.

  8. #8
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Replenish unit script question

    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?

  9. #9
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Replenish unit script question

    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.

  10. #10

    Default Re: Replenish unit script question

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO