How does reward triggering work?

While triggering a reward is fairly simple, there is a bit more to it.

When you add a reward inside a block listener, and that reward triggers another reward, I call that reward chaining.

With reward chaining, you can trigger up to 25 rewards, but you can not trigger same reward twice in the same loop. That would make an infinite loop of rewards triggering each other and it would never stop. So how does the reward triggering work? Lets set an example so you can understand better.

Lets say we have 3 rewards and the 1st reward is called from the block listener:

reward_1: # This reward is called from the block listener
  reward_type: message
  messages:
    - '{0} &fReward 1'
    
reward_2:
  reward_type: message
  messages:
    - '{0} &fReward 2'
    
reward_3:
  reward_type: message
  messages:
    - '{0} &fReward 3'

To trigger one reward from another, you have to add trigger: ['reward_id'] with the reward id of the reward that you want to trigger after this one. There is also a chance parameter that you can add for each reward that you trigger same as when you call a reward from the block listener trigger: ['reward_id:chance', 'example_reward:0.5'] where the example reward, has a 50% rate of triggering.

Note: When you trigger a reward, the reward_id of which you want to trigger can not be the same as the current reward id. For example, reward_1 can not trigger reward_1 again. If a reward is triggered twice in the same loop, it will stop there and not continue further and nothing will show in console.

So with that explained, you can start doing your first reward chaining. I'll show you an example below.

The example above shows a reward chaining of 3 rewards. The lifecycle goes from reward_1 -> reward_2 -> reward_3 -> STOP.

Note: The examples above only show the rewards of message type, you can recreate the reward chaining with any reward type.

Last updated