OK, I'm building a Wherigo in Urwigo and want to create a scenario where, when a player enters a zone, a randomly chosen three characters out of a prescribed list of eight become visible. (they're all going to reside within that zone permanently so switching the visibility on and off is the simple approach)
What's the cleanest, least code-heavy way of approaching that?
The best would be to create a Lua script, which is doing the following (pseudo code):
Create a table
Insert all 8 characters in the table
Do 3 times
Select a random entry in the character table
Set selected character visible
Remove character from table
end
This could look in Lua like (when zc1...zc8 the ZCharacter objects):
function ActivateCharacters()
-- Create table and insert all 8 characters
local characters = {zc1, zc2, zc3, zc4, zc5, zc6, zc7, zc8}
-- Init random gene