Last change
on this file since 4547 was
4448,
checked in by snellen, 18 years ago
|
reorganized scripts (put them in folders), implemented levelchange by script, put some npcs in spaceshiptower
|
File size:
660 bytes
|
Line | |
---|
1 | -- Create the trigger |
---|
2 | trigger = ScriptTrigger() |
---|
3 | trigger:setName("secondprisonertrigger") |
---|
4 | trigger:setScript("secondprisoner.lua") |
---|
5 | trigger:setFunction("tick") |
---|
6 | trigger:setActiveOnCreation(true) |
---|
7 | |
---|
8 | -- Get objects from orxonox |
---|
9 | thisscript:addObject("GenericNPC", "Secondprisoner") |
---|
10 | thisscript:addObject("FPSPlayer", "Player") |
---|
11 | |
---|
12 | -- Initialises the random number generator |
---|
13 | randinit = false |
---|
14 | function randInit() |
---|
15 | |
---|
16 | if not randinit then |
---|
17 | math.randomseed(os.clock()) |
---|
18 | randinit = true |
---|
19 | end |
---|
20 | |
---|
21 | end |
---|
22 | |
---|
23 | |
---|
24 | function scream() |
---|
25 | |
---|
26 | end |
---|
27 | |
---|
28 | function tick(timestep) |
---|
29 | |
---|
30 | --io.write("Secondprisoner called \n") |
---|
31 | randInit() |
---|
32 | randNumber = 10 * math.random() |
---|
33 | |
---|
34 | if randNumber > 8 then |
---|
35 | scream() |
---|
36 | end |
---|
37 | |
---|
38 | return false |
---|
39 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.