• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Do you mean a flag to influence the AI logic to nominate a character rather than another as a commander ?
Because you can already tweak the conditions for commanders via title_commander allowed_to_hold block (traits, titles, ...)
Yes exactly that. Messing with the allowed_to_hold_block is problematic. Further having an additional grant_limit block could be useful, especially with respect to where you want the new commanders expressly as sub-commanders like my usage indicates.
 
Yes exactly that. Messing with the allowed_to_hold_block is problematic. Further having an additional grant_limit block could be useful, especially with respect to where you want the new commanders expressly as sub-commanders like my usage indicates.

Maybe you can play with ai_will_do clause that was added for minor_titles in patch 2.5 a bit, giving 1 for mages and less for non-mage ? Haven't tried it.

On a character that is eligible by the hard-coded definition, the ai_will_do weight is calculated. 1 or above means he is eligible, 0 or below means he is not eligible. Any value in between is the chance of being eligible. But it's not a weight compared to other characters. So it basically works like other decisions.
 
Maybe you can play with ai_will_do clause that was added for minor_titles in patch 2.5 a bit, giving 1 for mages and less for non-mage ? Haven't tried it.
The issue is as I actually outline, I am looking for a bonus to the number of subcommanders not commanders. Mages have bad martial, people who read books tend to not be good at commanding armies. I want them however to be included as sub commanders frequently. By giving a is_commander = yes flag similar to the voter flag, we can have a mage only title that lets them be mages without totally imbalancing the combat system with the a.i choosing a whole lot of low martial mages to command their entire army.
 
Allow on-actions to process province_events. Right now, they don't fire (for example, within on_startup). It would be very useful that if an on_action has any province_event listed under it, that the engine tries to fire that event for all provinces. Would let us avoid a lot of workarounds and any_province usages.
 
Allow on-actions to process province_events. Right now, they don't fire (for example, within on_startup). It would be very useful that if an on_action has any province_event listed under it, that the engine tries to fire that event for all provinces. Would let us avoid a lot of workarounds and any_province usages.


On the topic of on_actions would it be possible to let us set trigger conditions in the on action for the event, to cut down on where the events are triggering and who for?
 
Could you elaborate on what do you mean?
I mean let us check conditions or even pre-triggers on events at the on_action stage. I do not need my magic maintaining events firing on every character, but that is what it does.
 
I thought though it would do what most other events do, and fire it, then go through the event sequentially till it found a condition that blocks it and stop there.
 
I thought though it would do what most other events do, and fire it, then go through the event sequentially till it found a condition that blocks it and stop there.
I'm not understanding the distinction. When the on_action fires, it will call the event. The trigger/pre-trigger on the event will say "can't do this". Nothing else in the event will happen. In a sense, you could say the event "fires" then aborts in the trigger/pre-trigger phase, if you want to look at it that way. To me, since the event window won't show and no 'immediate' or 'option' will occur, the event hasn't in any sense "fired".
 
  • 1
Reactions:
I'm not understanding the distinction. When the on_action fires, it will call the event. The trigger/pre-trigger on the event will say "can't do this". Nothing else in the event will happen. In a sense, you could say the event "fires" then aborts in the trigger/pre-trigger phase, if you want to look at it that way. To me, since the event window won't show and no 'immediate' or 'option' will occur, the event hasn't in any sense "fired".

But in that case it does mean it begins to process. Say i want an event to only go to a very small proportion of characters. Being able to set conditons on who the on_action will fire for allows a more efficient cut off in the chain.
 
  • 1
Reactions:
But in that case it does mean it begins to process. Say i want an event to only go to a very small proportion of characters. Being able to set conditons on who the on_action will fire for allows a more efficient cut off in the chain.
I don't see how it would be any more efficient to have the condition in the on_action file than in the event file. The executable is still going to have to process the condition for every potential target.
 
  • 1
Reactions:
I don't see how it would be any more efficient to have the condition in the on_action file than in the event file. The executable is still going to have to process the condition for every potential target.
Well, say you have 100 events that you are firing from an on_action, with all of them sharing (part of) the trigger conditions. If you specify those trigger conditions in the on_action, you are evaluating them once per character instead of once per character per event in the list.

For optimal use. I'd suggest this:

Change the syntax of on_actions in the following way:
Code:
<on_action_tag>
   events = {
      tag = xxx #an string to tag the list. Lists with the same tag in different files should be merged together.
      common_triggers = {
         <conditions common to all events in the list. This is checked agains every potential target before evaluating each event individually>
      }
      #events ids in the list, as in current version
   } 
   #more events = {} clauses, with different (possibly none) common_triggers. Each is is handled separately
   random_events = {
      tag = xxx #an string to tag the list. Lists with the same tag in different files should be merged together.
      common_triggers = {
         <conditions common to all events in the list. This is checked agains every potential target before evaluating each event individually>
      }
      #events ids in the list, weighted as in vanilla
   } 
   #more random_events = {} clauses, with different (possibly none) common_triggers. Each is is handled separately
}

The weights in random_events list are independent. i.e. a character can get one event from each list at a time.

This incorporate @Zarathustra_the 's suggestion as well as allowing for more fine_grained control of random_events.

Edit: on further reflection, common_triggers would be of little use in random_events, since every character gets only one of them at a time, instead of all of them. Still would be a pretty good improvement for events = {} and to have separated pools of random events for the same on_action.
@Divine what do you think?
 
Well, say you have 100 events that you are firing from an on_action, with all of them sharing (part of) the trigger conditions. If you specify those trigger conditions in the on_action, you are evaluating them once per character instead of once per character per event in the list.

For optimal use. I'd suggest this:

Change the syntax of on_actions in the following way:
Code:
<on_action_tag>
   events = {
      tag = xxx #an string to tag the list. Lists with the same tag in different files should be merged together.
      common_triggers = {
         <conditions common to all events in the list. This is checked agains every potential target before evaluating each event individually>
      }
      #events ids in the list, as in current version
   }
   #more events = {} clauses, with different (possibly none) common_triggers. Each is is handled separately
   random_events = {
      tag = xxx #an string to tag the list. Lists with the same tag in different files should be merged together.
      common_triggers = {
         <conditions common to all events in the list. This is checked agains every potential target before evaluating each event individually>
      }
      #events ids in the list, weighted as in vanilla
   }
   #more random_events = {} clauses, with different (possibly none) common_triggers. Each is is handled separately
}

The weights in random_events list are independent. i.e. a character can get one event from each list at a time.

This incorporate @Zarathustra_the 's suggestion as well as allowing for more fine_grained control of random_events.

Edit: on further reflection, common_triggers would be of little use in random_events, since every character gets only one of them at a time, instead of all of them. Still would be a pretty good improvement for events = {} and to have separated pools of random events for the same on_action.
@Divine what do you think?
Seems simpler to have 1 event with the common triggers in it, and have it fire the other events as needed. For that matter, having 100 distinct events fire for 1 on_action sounds… excessive.
 
Seems simpler to have 1 event with the common triggers in it, and have it fire the other events as needed. For that matter, having 100 distinct events fire for 1 on_action sounds… excessive.
Of course, I was just exaggerating for the sake of the argument. With regards to it being simpler to have one "master" event that calls the others, so to speak, I don't know what to say. Efficiency-wise, it seems to me that the proposal still would be a slight improvement (you would access a character and evaluate the common triggers, only if true then call the event, as opposed to accessing the character, calling the event and then evaluating the common triggers. Of course, that difference might well be negligible; we don't really know.

Aesthetically wise... it'd depend on each user's taste, really. I'd personally find it handy and cleaner to see at a glance in the on_action file to see which events will be launched under which general conditions, as opposed to having to check both the on_action and the event itself.

Still, the other part, regarding the possibility of distinct, tagged lists particularly for random_events = {} cannot be replicated currently and would be really worth implementing.
 
That feature is present already in HoI4 in a manner of speaking I believe as you can put an effect clause to contain ifs and limits into an on_action as seen below:
Code:
on_nuke_drop = {

    effect = {
        if = {
            limit = { NOT = { has_country_flag = achievement_has_dropped_nuke } }
            goto_state = FROM
            set_country_flag = achievement_has_dropped_nuke
        }
        if = {
            limit = {
                FROM = { state = 378 }                  
            }
            set_country_flag = achievement_has_nuked_california
        }
        if = {
            limit = {
                FROM = { is_core_of = AST }                  
            }
            set_country_flag = achievement_AST_nuke_self
        }
        if = {
            limit = {
                tag = SWE
                FROM = {
                    is_owned_by = DEN
                    is_core_of = DEN
                }
            }
            set_country_flag = achievement_med_plutonium
        }
        news_event = { id = nuke_dropped.2 days = 1}
        news_event = { id = nuke_dropped.3 days = 1}
        news_event = { id = nuke_dropped.4 days = 1}
        news_event = { id = nuke_dropped.5 days = 1}
        news_event = { id = nuke_dropped.6 days = 1}
        news_event = { id = nuke_dropped.7 days = 1}
        news_event = { id = nuke_dropped.8 days = 1}
        news_event = { id = nuke_dropped.9 days = 1}
        news_event = { id = nuke_dropped.10 days = 1}
        news_event = { id = nuke_dropped.11 days = 1}
        news_event = { id = nuke_dropped.12 days = 1}
        news_event = { id = nuke_dropped.13 days = 1}
    }
    random_events = {
        100 = nuke_dropped.0
    }
}

Although I am unsure as to how much of a performance improvement it actually has and whether the impact is even a beneficial one. It would in my mind make very little difference because, as said above, the game still checks everyone against the triggers. It does not actually matter where the triggers are as they are still the exact same thing being checked, if anything I would say it would be worse for performance as you would not have the ability to use the better performance pre/fast-triggers in the on action file as they only work in the structure of events.
This seems to me to be a similar case to the scripted triggers and effects, they do not actually make the performance better as all they effectively do is insert the piece of script into the events etc to be processed normally. The same thing would happen with the moving of triggers into the on_actions, they are the same triggers being checked just in a different place so not a performance increase.
 
Could you please make it possible to specify whether trade routes flow both ways? Many mods, amongst which ours, the Winter King, use the silk road mechanic, but customized to resemble other trade routes. It would be of great help if there was a way to enable these trade routes to flow in both ways.
 
Could you please make it possible to specify whether trade routes flow both ways? Many mods, amongst which ours, the Winter King, use the silk road mechanic, but customized to resemble other trade routes. It would be of great help if there was a way to enable these trade routes to flow in both ways.

Does it not work to set two routes inverse of each other?