-- Create the trigger trigger = ScriptTrigger() trigger:setName("secondprisonertrigger") trigger:setScript("secondprisoner.lua") trigger:setFunction("tick") trigger:setActiveOnCreation(true) -- Get objects from orxonox thisscript:addObject("GenericNPC", "Secondprisoner") thisscript:addObject("FPSPlayer", "Player") -- Initialises the random number generator randinit = false function randInit() if not randinit then math.randomseed(os.clock()) randinit = true end end function scream() end function tick(timestep) --io.write("Secondprisoner called \n") randInit() randNumber = 10 * math.random() if randNumber > 8 then scream() end return false end