This came up before and there is a non-documented feature that the return value from the action function can actually provide the "jump" variable. The following example would randomly pick between the three possible chat options:
Code: Select all
action = function(player, npc)
local possible_options = {"friendly", "neutral", "belligerent"}
return rng.table(possible_options)
end
You could come up with a weighted rng.table that allows you to set weights for each particular option, but you get the idea. In regards to randomness in the action/cond/etc, well you can simply add randomness to the returns/brances of each. Define three action functions, action1, action2, and action3 and then do the following:
Code: Select all
action = function(player, npc)
local possible_actions = {action1, action2, action3}
return tng.table(possible_actions)(player, npc)
In summary, I think everything you want is already possible, just maybe not in the most elegant fashion.