Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/scripts/falldown.lua @ 4325

Last change on this file since 4325 was 4247, checked in by snellen, 18 years ago

fixed falldown guy

File size: 4.1 KB
Line 
1-- Create the trigger
2trigger = ScriptTrigger()
3trigger:setName("falldowntrigger")
4trigger:setScript("falldown.lua")
5trigger:setFunction("tick")
6trigger:setAbsCoor(670.307190, 0, -410.386810)
7trigger:setTarget("Player")
8trigger:setRadius(100)
9
10
11-- Get objects from orxonox
12thisscript:addObject("GenericNPC", "fallingguy")
13thisscript:addObject("FPSPlayer", "Player")
14thisscript:addObject("GenericNPC","fleemechanic")
15
16dy = 0
17randTime = 0
18eventFinished = false
19randinit = false
20mtheight = -10
21
22function RandTime()
23
24if not randinit then
25math.randomseed(os.clock())
26randinit = true
27randTime = 8 * math.random()
28end
29end
30
31
32function fallDown(timestep)
33dy = dy + timestep
34thisX = fallingguy:getAbsCoorX()
35thisY = fallingguy:getAbsCoorY()
36thisZ = fallingguy:getAbsCoorZ()
37
38fallingguy:setAbsCoor(thisX, thisY - dy, thisZ)
39
40if thisY < -100 then
41eventFinished = true
42end
43
44end
45
46
47
48fleeprogrammed = false
49function flee(timestep)
50if not fleeprogrammed then
51fleemechanic:runTo( 735.658142, mtheight, -1525.291870)
52fleemechanic:runTo( 746.021912, mtheight, -1416.895508)
53fleemechanic:runTo( 746.021912, mtheight, -1415.689819)
54fleemechanic:runTo( 745.840454, mtheight, -1314.824585)
55fleemechanic:runTo( 745.840454, mtheight, -1313.533691)
56fleemechanic:runTo( 745.840454, mtheight, -1312.239258)
57fleemechanic:runTo( 745.840454, mtheight, -1310.942749)
58fleemechanic:runTo( 686.141907, mtheight, -1174.515015)
59fleemechanic:runTo( 685.479614, mtheight, -1173.372925)
60fleemechanic:runTo( 684.815857, mtheight, -1172.228271)
61fleemechanic:runTo( 630.430725, mtheight, -1072.972168)
62fleemechanic:runTo( 629.804199, mtheight, -1071.821777)
63fleemechanic:runTo( 629.174438, mtheight, -1070.665527)
64fleemechanic:runTo( 628.542786, mtheight, -1069.505859)
65fleemechanic:runTo( 627.905334, mtheight, -1068.335449)
66fleemechanic:runTo( 582.125610, mtheight, -969.282288)
67fleemechanic:runTo( 581.719971, mtheight, -968.030273)
68fleemechanic:runTo( 581.312866, mtheight, -966.773621)
69fleemechanic:runTo( 580.904602, mtheight, -965.513550)
70fleemechanic:runTo( 580.492493, mtheight, -964.241638)
71fleemechanic:runTo( 555.827942, mtheight, -873.071045)
72fleemechanic:runTo( 555.657410, mtheight, -871.761780)
73fleemechanic:runTo( 555.485962, mtheight, -870.445679)
74fleemechanic:runTo( 555.314087, mtheight, -869.126160)
75fleemechanic:runTo( 555.141418, mtheight, -867.800598)
76fleemechanic:runTo( 554.968262, mtheight, -866.471069)
77fleemechanic:runTo( 554.794922, mtheight, -865.140076)
78fleemechanic:runTo( 547.754639, mtheight, -767.221680)
79fleemechanic:runTo( 547.722961, mtheight, -765.892944)
80fleemechanic:runTo( 547.691223, mtheight, -764.562683)
81fleemechanic:runTo( 547.659180, mtheight, -763.219604)
82fleemechanic:runTo( 548.969849, mtheight, -649.171387)
83fleemechanic:runTo( 549.043274, mtheight, -647.850952)
84fleemechanic:runTo( 549.117126, mtheight, -646.523193)
85fleemechanic:runTo( 549.191101, mtheight, -645.193542)
86fleemechanic:runTo( 549.265137, mtheight, -643.862305)
87fleemechanic:runTo( 568.188416, mtheight, -510.499756)
88fleemechanic:runTo( 568.575439, mtheight, -509.219055)
89fleemechanic:runTo( 568.964539, mtheight, -507.931458)
90fleemechanic:runTo( 569.355469, mtheight, -506.637726)
91fleemechanic:runTo( 626.359924, mtheight, -384.633179)
92fleemechanic:runTo( 627.059998, mtheight, -383.511444)
93fleemechanic:runTo( 627.764282, mtheight, -382.382935)
94fleemechanic:runTo( 628.469055, mtheight, -381.253601)
95fleemechanic:runTo( 629.178345, mtheight, -380.117065)
96fleemechanic:runTo( 629.888367, mtheight, -378.979340)
97fleemechanic:runTo( 630.599548, mtheight, -377.839752)
98fleemechanic:runTo( 631.316711, mtheight, -376.690643)
99fleemechanic:runTo( 704.250305, mtheight, -250.679443)
100fleemechanic:runTo( 704.842896, mtheight, -249.538712)
101fleemechanic:runTo( 705.438721, mtheight, -248.391754)
102fleemechanic:runTo( 706.033630, mtheight, -247.246506)
103fleemechanic:runTo( 706.628479, mtheight, -246.101395)
104fleemechanic:runTo( 707.229248, mtheight, -244.944870)
105fleemechanic:runTo( 707.831665, mtheight, -243.785248)
106fleeprogrammed = true
107
108end
109end
110
111
112function tick(timestep)
113 flee(timestep)
114RandTime()
115if randTime > 0 then
116randTime = randTime - timestep
117else
118fallDown(timestep)
119end
120
121return eventFinished
122
123end
Note: See TracBrowser for help on using the repository browser.