For
on_actions, does anyone know for a random_events section, if there's any functional difference between chance_to_happen and chance_of_no_event, versus simply putting in something like "1000 = 0"? I understand chance_of_no_event and chance_to_happen allow you to add in various modifiers to modify the chances of things appearing based on other triggers, but I'm interested in if anyone knows if there's any reason why I would choose one option over the other if no modifiers were involved.
What I mean is, let's say I have the three following options:
Code:
random_events = {
chance_to_happen = 25
100 = cool_event.1
}
Code:
random_events = {
chance_of_no_event = {
value = 75
}
100 = cool_event.1
}
Code:
random_events = {
300 = 0
100 = cool_event.1
}
Is there functionally any difference between the three? Presumably in each situation there's a 25% chance "cool_event.1" will fire.
I realize this is a bit old, but since I was wondering this myself and effected an understanding, I figured I'd answer it.
Functionally, the options you present are all identical. If, as you suggest, no modifiers are involved, I'd use
chance_to_happen
, since presumably not having to evaluate a script value is going to be better for performance. However, there are reasons you might choose one over another—or use them in combination—when things get a bit more complex.
Starting with the first two, the effects of
chance_to_happen
and
chance_of_no_event
are basically the same when used in isolation. The obvious difference, of course, is that
chance_of_no_event
takes a script value, which can be adjusted with conditionals, while
chance_to_happen
takes only a simple percentage chance. The two can be used in combination, however, and will
chance_of_no_event
will only be evaluated if
chance_to_happen
evaluates as
true
.
Code:
random_events = {
chance_to_happen = 25
chance_of_no_event = {
value = 75
}
100 = cool_event.1 # will have a 6.25% chance of firing
}
n = 0
differs from the prior two cases in that, if both of those evaluate to
true
(or are omitted entirely), one event from the list will
always fire so long as its trigger is valid. Thus, consider the following:—
Code:
random_events = {
100 = common_event.1
100 = common_event.2
100 = common_event.3
1 = very_rare_event.1
}
If the triggers for the common events evaluate to
false
because they're not valid to run,
for whatever reason, the 'very rare' event will suddenly have a 100% chance of firing. Adding
100 = 0
to the above code, then, effectively acts a null event that does nothing but will
always be available for selection—keeping the 'very rare' event, well, rare, even if none of the other options are available.