"Chance" expansion via an "activateTrigger" spinoff option.
-
Currently there is no way to get immediate feedback to even the simplest multi tier (more than 2 outputs) sequential triggers that involve the
"chance"
option. This is true in the 3 areas below, in which they currently can be used.-
"triggerAttachment"
-
"userActionAttacment"
-
"politicalActionAttachment"
Current
"chance"
option as described in POS2."chance" value: diceroll:dicesides to hit for this action to succeed for example "1:6" for the action to succeed 1 out of 6 times .
It is true that a successful
"chance"
trigger can receive feedback in form of the change it will make, and that change can be used to create the condition needed for a subsequent use. But that condition itself will require a delay to be checked. And the"when"
option is used to fire another trigger, so it will not be immediate. But its doable with a delay, which creates a lot of extra code, which usually increases exponentially.However, if working with multi tier (more than 2 outputs) sequential triggers which are based on failure of preceding
"chance"
rolls. There is currently no way to achieve an immediate output, even with the above method, if the"chance"
trigger comes back as unsuccessful. (not practically)I propose an
"activateTrigger"
style option be used to provide the immediate feedback for both success and failure of the"chance"
option. Ideally, this should be used in all 3 trigger related areas listed above, in which the"chance"
option, can currently be used.This will vastly increase the viability of creative ideas, that a map maker has available when working with an elaborate or complex set of logical rules. It should also reduce the amount of code that the already viable options provide.
Perhaps something like below that functions identically to
"activateTrigger"
.option 1.
"activateTriggerOnChanceFailure" values: Based on chance output and will immediately fire another named trigger. "activateTriggerOnChanceSuccess" values: Based on chance output and will immediately fire another named trigger. Format: "triggerName:numberOfTimes:useUses:testUses:testConditions:testChance". "activateTrigger" will be affected by "each" in a condition statement.
Example of option 1, in a sequential 3 tier standard chance trigger.
<attachment name="triggerAttachment_Chance_Roll_For_Severe_Winter" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Time_To_Activate_Winter_Effects_Is_True"/> <option name="chance" value="1:10"/> <!-- For Above: The currently available chance roll which is set to give a true output only if a 1 in 10 roll is successful. I propose that it be linked directly to the 2 suggested options below. --> <option name="activateTriggerOnChanceFailure" value="triggerAttachment_Procede_ChanceRoll_For_Mild_Winter:1:true:false:false:false"/> <!-- For Above: If the 1 in 10 roll fails, then the above named trigger will immediately fire a trigger similar to this one. And that will determine if a mild winter climate activates. If that chance roll fails, then it will immediately fire a 3rd trigger that activates a moderate winter. This last part isn't even currently viable in a multi tier (more than 2 outputs) sequential set of immediately firing triggers, to my knowledge. --> <option name="activateTriggerOnChanceSuccess" value="triggerAttachment_Activate_Severe_Winter:1:true:false:false:false"/> <!-- For Above: If the 1 in 10 chance roll is a success, then the above named trigger will immediately fire. This part, although can be achieved in other non immediate ways, it would still be useful tool in reducing amount of code needed for such logic. --> <option name="activateTrigger" value="triggerAttachment_Confirmation_Switch_One:1:true:false:false:false"/> <!-- For Above: The currently available option that immediately fires a trigger. However it has limitations. --> <option name="when" value="before:russiansClimateControl_One"/> </attachment>
Ok so I went into some detail to describe the immediately firing, sequential 3 tier outputs, which are based on output of chance rolls. But just to be clear this method would be able to do unlimited tiers. So it should be very valuable in the right hands.
-
-
Small correction to above.
The successful
"chance"
option does allow the"activateTrigger"
that is within a standard"triggerAttachment"
, to immediately fire. (Same deal for"userActionAttachment"
.)This means the above example trigger can be coded a bit more efficiently, due to this immediate feedback.
So all we really need is the failure portions,
"activateTriggerOnChanceFailure"
, as it pertains to"triggerAttachment"
,"userActionAttachment"
and"politicalAttachment"
.However the
"politicalActionAttachment"
still needs feedback on a successful"chance"
, since it does not have"activateTrigger"
available. I did place a feature request for a"activateTrigger"
for this earlier, in a separate post. -
I should probably add that if the
"activateTriggerOnChanceFailure"
is added. Then we can have elaborate logic based on"chance"
triggers that do not need a million conditions. Each"chance"
trigger could in theory cascade to it's conclusion.Another simple example of use is, map makers can have spawning reinforcements logic to help out an AI player. The elaborate logic to spawn can be based on chance. So the human player won't be able to predict where the reinforcements will spawn next. A trigger, via 1 line of code (
"activateTriggerOnChanceFailure"
), would know how to proceed if the chance roll fails without a whole new set of conditions. Currently more than 1 failed chance roll can not be handled practically.