I want to make an event which can occur, but not necessarily. Let's say I want it to occur in 60% of the games. How to code that?
My suggestion involves 2 events, assumes that there is a specific country this event should occur for, and is completely untested:jova said:I want to make an event which can occur, but not necessarily. Let's say I want it to occur in 60% of the games. How to code that?
event = {
id = 100001 # change this
random = no
country = HOL # change this too, probably.
trigger = {
random = 60 # the 60% chance...
NOT = { event = 100001 } # if we haven't fired
NOT = { event = 100002 } # if the never fire side hasn't fired
}
name = "Hey, 60% hit!"
desc = "This event should only occur in 60% of the games!"
date = { day = 1 month = january year = 1936 }
offset = 30
deathdate = { day = 30 month = december year = 1947 }
action_a = {
command = { type = delete_unit which = -1 } # or whatever
}
}
event = {
id = 100002 # change this
random = no
country = HOL # change this too, probably.
trigger = {
random = 40 # the 40% chance...
NOT = { event = 100001 } # if the main event hasn't fired
NOT = { event = 100002 } # if we haven't fired
}
name = "Hey, 40% hit!"
desc = "This event should only occur in 40% of the games!"
date = { day = 1 month = january year = 1936 }
offset = 30
deathdate = { day = 30 month = december year = 1947 }
action_a = {
command = { type = delete_unit which = -1 } # or whatever
}
}
No, some events are checked more than once, then the X is not the real percentage.jova said:Perhaps it was just a coincidence.![]()
This event will either fire on 1936-1-3, or never...Panther G said:trigger = {
random = 60
}
date = { day = 2 month = january year = 1936 }
60% chance on Jan 3rd (or any other fix date)
With the date / offset / deathdate parameters, the events get multiple chances to hit the random number.jova said:Thanks, I supposed that "random = x" is the key, but I have seen some events with random = 40 and they occured almost every time.
Perhaps it was just a coincidence.![]()
ulmont said:Main drawback is that an event will fire to symbolize that the other will never happen, which is somewhat annoying.