Last change
on this file since 4386 was
4202,
checked in by bensch, 18 years ago
|
merged the data back from scripting
|
File size:
660 bytes
|
Rev | Line | |
---|
[4202] | 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 | |
---|
[4080] | 8 | -- Get objects from orxonox |
---|
| 9 | thisscript:addObject("GenericNPC", "Secondprisoner") |
---|
| 10 | thisscript:addObject("FPSPlayer", "Player") |
---|
[3946] | 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.