Here's the story: The character is in a dusty shed. Sadly, he's allergic to dust. So, I'd like to give him, say, 20% chance that he sneezes each time he makes a step.* This means that if the rng decides he's gonna sneeze then the movement is interrupted and a dialogue with a sneeze appears; but, if the rng decides he's not gonna sneeze yet then the movement must not be interrupted.
What is the best approach to do this?
One idea to do this sans javascript is to place events with priority below characters ALL OVER THE PLACE, assign each a switch, and give each two pages: when its switch is on then its activated on player touch, rerandomizes switches, and shows dialogue. One problem with this approach is that this will mean that if two adjacent tiles have their corresponding switches off then the player ma move his character back and forth infinitely without the sneeze showing up. The solution would be to rerandomize switches even on non-sneezing tiles, but this would require setting all tiles to activation on player touch and this would break auto movement.
Or is there any plugin that would do something like this around alredy? Or if there is none, could you give me a hint how should I tackle this? Note I'm not asking you to write it for me, just for a hint.
* Yes, I know this would be annoying to players. But well, that's the point.
What is the best approach to do this?
One idea to do this sans javascript is to place events with priority below characters ALL OVER THE PLACE, assign each a switch, and give each two pages: when its switch is on then its activated on player touch, rerandomizes switches, and shows dialogue. One problem with this approach is that this will mean that if two adjacent tiles have their corresponding switches off then the player ma move his character back and forth infinitely without the sneeze showing up. The solution would be to rerandomize switches even on non-sneezing tiles, but this would require setting all tiles to activation on player touch and this would break auto movement.
Or is there any plugin that would do something like this around alredy? Or if there is none, could you give me a hint how should I tackle this? Note I'm not asking you to write it for me, just for a hint.
* Yes, I know this would be annoying to players. But well, that's the point.
