Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/single_player_map/scripts/secondguard.lua @ 3951

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

added some npcs

File size: 1.2 KB
Line 
1-- Global Variables
2allOk = true
3cellReached = false
4guidePositionReached = false
5prisonerReachedLock = false
6hangarReached = false
7
8
9-- Returns the distance between (x1,x2,x3) and (y1,y2,y3)
10function dist( x1,x2,x3, y1,y2,y3 )
11
12return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 )
13
14end
15
16
17function observeGuard()
18guardX = guard:getAbsCoorX()
19guardY = guard:getAbsCoorY()
20guardZ = guard:getAbsCoorZ()
21
22if dist( guardX,guardY,guardZ,161.76,49,358.87 ) < 60 then
23allOk = false
24end
25
26end
27
28function observePrisoner()
29
30prisonerX = Prisoner:getAbsCoorX()
31prisonerY = Prisoner:getAbsCoorY()
32prisonerZ = Prisoner:getAbsCoorZ()
33
34if dist( prisonerX,prisonerY,prisonerZ,161.76,49,358.87 ) < 60 then
35prisonerReachedLock = true
36end
37
38end
39
40
41function goToCell(timestep)
42
43return false
44end
45
46function goToGuidePosition(timestep)
47
48return false
49end
50
51function goToHangar(timestep)
52
53return false
54end
55
56function tick(timestep)
57--io.write("Secondguard called \n")
58 
59observePrisoner()
60
61if not allOk then
62cellReached = goToCell(timestep)
63end
64
65if cellReached and not guidePositionReached then
66guidePositionReached = goToGuidePosition(timestep)
67end
68
69if guidePositionReached and prisonerReachedLock then
70hangarReached = goToHangar(timestep)
71end
72
73if hangarReached then
74return true
75end
76
77return false
78end
Note: See TracBrowser for help on using the repository browser.