Results 1 to 6 of 6

Thread: Triggger regulation, mutli-building unit reqs, and specific retraining

  1. #1
    The Great Khan of Rome's Avatar Civis
    Join Date
    Dec 2016
    Location
    In your prison cell...
    Posts
    157

    Icon5 Triggger regulation, mutli-building unit reqs, and specific retraining

    First off, I want somebody to look at this:

    Code:
    monitor_event FactionTurnStart 
    			 and I_TurnNumber > 9
    			 if RandomPercent = 3
    				if I_EventCounter CANNONS_huevent = 0
    						historic_event CANNONS
    						set_counter CANNONS_huevent 1
    			end_if
    		end_if
    end_monitor
    What I'm doing here, is trying to restrict the number of times the event occurs, as this event unlocks cannons. I'm working with SS 6.4. I'm wondering to see if I can do it with this logic, rather than using and I_EventCounter to regulate the firings of triggers like this. Here's what I attempted to do last time:

    Code:
    monitor_event FactionTurnStart 
    			 and I_EventCounter HALF_PLATE_ARMOR_huevent = 0
    			 and I_TurnNumber > 4
    			 if RandomPercent = 3
    						historic_event HALF_PLATE_ARMOR
    						set_counter HALF_PLATE_ARMOR_huevent 1
    			end_if
    end_monitor
    This throws up an error when firing: "don't recognise this token: and", thus messing up the whole script.

    Another thing I'm doing is requiring units to have different buildings in order to train them. My logic is that the base building that being castle_barracks, barracks, stables, etc., provide base repen, and then another building, say professional_military or gunsmith, provides the capacity for the unit.

    The last question is that are specific retraining units possible? Assume I want to retrain a unit like Peasant Crossbowmen from the archery_range, so that it has +1 experience. How would I go about doing that?
    Here's what I think would work:

    Code:
    recruit_pool "Peasant Crossbowmen"  0   0  0  1  requires factions { france, hre, spain, aragon, portugal, milan, venice, papal_states, }
    Creator of UNREAL, balance mod series that promises changes to everything Total War, and it's offshoots, MEGA for other games. Basically, I'm reject Radious.

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Triggger regulation, mutli-building unit reqs, and specific retraining

    The 'and' issue is fairly simple if you look at the 'normal' way of writing the code:
    Code:
    monitor_event FactionTurnStart and I_TurnNumber > 9
                 ifand RandomPercent = 3
                    ifand I_EventCounter CANNONS_huevent = 0
                            historic_event CANNONS
                            set_counter CANNONS_huevent 1
                    end_if
                end_if
    end_monitor
    I am having trouble understanding what you are trying to achieve here: the corrected monitor will fire when the random percent is met, display the historic event and then set a counter to avoid triggering again. Which is rather wasteful unless you somewhere in the script reset that event counter again. Underneath the short version and a terminated monitor, eg will fire once and then never fire again as the monitor is disabled:
    Code:
    monitor_event FactionTurnStart I_TurnNumber > 9
        and RandomPercent = 3
        historic_event CANNONS
        terminate_monitor
    end_monitor

    Your recruiting will not work as there will be no pool - you need to set the max pool as well as the refresh rate. The experience is the last number as you have set correctly.










  3. #3
    The Great Khan of Rome's Avatar Civis
    Join Date
    Dec 2016
    Location
    In your prison cell...
    Posts
    157

    Default Re: Triggger regulation, mutli-building unit reqs, and specific retraining

    Quote Originally Posted by Gigantus View Post
    The 'and' issue is fairly simple if you look at the 'normal' way of writing the code:
    Code:
    monitor_event FactionTurnStart and I_TurnNumber > 9
                 ifand RandomPercent = 3
                    ifand I_EventCounter CANNONS_huevent = 0
                            historic_event CANNONS
                            set_counter CANNONS_huevent 1
                    end_if
                end_if
    end_monitor
    I am having trouble understanding what you are trying to achieve here: the corrected monitor will fire when the random percent is met, display the historic event and then set a counter to avoid triggering again. Which is rather wasteful unless you somewhere in the script reset that event counter again. Underneath the short version and a terminated monitor, eg will fire once and then never fire again as the monitor is disabled:
    Code:
    monitor_event FactionTurnStart I_TurnNumber > 9
        and RandomPercent = 3
        historic_event CANNONS
        terminate_monitor
    end_monitor

    Your recruiting will not work as there will be no pool - you need to set the max pool as well as the refresh rate. The experience is the last number as you have set correctly.
    Ok, thanks. I've been on and off coding for a while, so I'm rusty when it comes to things like code structure.

    My assumption going into it is that when the monitor_event triggers fire, the monitor_event would terminate automatically, rather than through a command like terminate_monitor.

    So will this work for retraining the unit, but not the ability to recruit it?

    recruit_pool "Peasant Crossbowmen" 0 1 2 1 requires factions { france, hre, spain, aragon, portugal, milan, venice, papal_states, }
    Last edited by The Great Khan of Rome; June 06, 2022 at 02:16 AM.
    Creator of UNREAL, balance mod series that promises changes to everything Total War, and it's offshoots, MEGA for other games. Basically, I'm reject Radious.

  4. #4
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Triggger regulation, mutli-building unit reqs, and specific retraining

    A monitor will never terminate on it's own, it has to be terminated. Otherwise it will get checked again every time the event (FactionTurnStart) happens - which can be up to 31 times per round in this case. Which puts a load on turn times, hence monitors that are not repeating should be terminated after use.

    Recruiting: you cannot retrain a unit to gain experience - that can only happen when you initially train\recruit it. What will happen is that the new soldiers will have that experience and then an average value gets determined between the 'old' experience soldier count and the 'new' soldier count.
    Retraining\'filling up' only can be done by keeping the pool number below 1, eg 0.999 - then the 'new' soldiers will get that experience as per above.

    Example: 20 soldiers with 3 experience get retrained and gain 40 soldier with 1 experience. The average will fall down to 1.5 (I think) which will be displayed as 1.










  5. #5
    The Great Khan of Rome's Avatar Civis
    Join Date
    Dec 2016
    Location
    In your prison cell...
    Posts
    157

    Default Re: Triggger regulation, mutli-building unit reqs, and specific retraining

    I'm thinking about fresh recruits here, not those sent into battle and have gained experience through that. It's mostly an excuse so that you don't have to deal with the risk of trying to get xp via battles.
    Creator of UNREAL, balance mod series that promises changes to everything Total War, and it's offshoots, MEGA for other games. Basically, I'm reject Radious.

  6. #6
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Triggger regulation, mutli-building unit reqs, and specific retraining

    Well, then it's a standard recruiting entry with the XP (last number) elevated.

    First number - automatic pool when the building gets constructed
    Second number - max pool
    Third number - pool refresh rate
    Last number - XP










Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •