Line | |
---|
1 | trigger = ScriptTrigger() |
---|
2 | trigger:setName("secondprisonertrigger") |
---|
3 | trigger:setScript("secondprisoner.lua") |
---|
4 | trigger:setFunction("tick") |
---|
5 | trigger:setActiveOnCreation(true) |
---|
6 | |
---|
7 | -- Get objects from orxonox |
---|
8 | thisscript:addObject("GenericNPC", "Secondprisoner") |
---|
9 | thisscript:addObject("FPSPlayer", "Player") |
---|
10 | |
---|
11 | -- Initialises the random number generator |
---|
12 | randinit = false |
---|
13 | function randInit() |
---|
14 | |
---|
15 | if not randinit then |
---|
16 | math.randomseed(os.clock()) |
---|
17 | randinit = true |
---|
18 | end |
---|
19 | |
---|
20 | end |
---|
21 | |
---|
22 | |
---|
23 | function scream() |
---|
24 | |
---|
25 | end |
---|
26 | |
---|
27 | function tick(timestep) |
---|
28 | |
---|
29 | --io.write("Secondprisoner called \n") |
---|
30 | randInit() |
---|
31 | randNumber = 10 * math.random() |
---|
32 | |
---|
33 | if randNumber > 8 then |
---|
34 | scream() |
---|
35 | end |
---|
36 | |
---|
37 | return false |
---|
38 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.