Index: data/trunk/scripts/falldown.lua
===================================================================
--- data/trunk/scripts/falldown.lua	(revision 3991)
+++ data/trunk/scripts/falldown.lua	(revision 3991)
@@ -0,0 +1,43 @@
+dy = 0
+randTime = 0
+eventFinished = false
+randinit = false
+
+function RandTime()
+
+if not randinit then
+math.randomseed(os.clock())
+randinit = true
+randTime = 10 * math.random()
+end
+end
+
+
+function fallDown(timestep)
+dy = dy + timestep*0.01
+thisX = fallingguy:getAbsCoorX()
+thisY = fallingguy:getAbsCoorY()
+thisZ = fallingguy:getAbsCoorZ()
+
+fallingguy:setAbsCoor(thisX, thisY - dy, thisZ)
+
+if thisY < 0 then
+eventFinished = true
+end
+
+end
+
+
+function tick(timestep)
+
+RandTime()
+
+if randTime > 0 then
+randTime = randTime - timestep
+else
+fallDown(timestep)
+end
+
+return eventFinished
+
+end
Index: data/trunk/scripts/floorguy.lua
===================================================================
--- data/trunk/scripts/floorguy.lua	(revision 3991)
+++ data/trunk/scripts/floorguy.lua	(revision 3991)
@@ -0,0 +1,45 @@
+
+programRoute = true
+height = 80
+
+function tick(timestep)
+
+if programRoute then
+floorguy:runTo( 800.634338, height, -340.454163)
+floorguy:runTo( 800.965149, height, -317.040039)
+floorguy:runTo( 801.330627, height, -291.156891)
+floorguy:runTo( 801.922913, height, -274.193085)
+floorguy:runTo( 802.959045, height, -258.950653)
+floorguy:runTo( 803.812805, height, -246.390198)
+floorguy:runTo( 804.034180, height, -232.661407)
+floorguy:runTo( 816.056702, height, 407.114502)
+floorguy:runTo( 817.066284, height, 439.783112)
+floorguy:runTo( 817.734314, height, 461.401306)
+floorguy:runTo( 818.361816, height, 481.702789)
+floorguy:runTo( 820.161621, height, 540.826538)
+floorguy:runTo( 820.825195, height, 579.028748)
+floorguy:runTo( 821.907410, height, 641.302673)
+floorguy:runTo( 823.706055, height, 744.863098)
+floorguy:runTo( 820.552490, height, 761.699585)
+floorguy:runTo( 809.810425, height, 771.055420)
+floorguy:runTo( 794.455383, height, 779.180725)
+floorguy:runTo( 779.520386, height, 773.730957)
+floorguy:runTo( 769.395630, height, 762.138306)
+floorguy:runTo( 761.172668, height, 749.739258)
+floorguy:runTo( 756.049500, height, 736.094116)
+floorguy:runTo( 755.904297, height, 648.224854)
+floorguy:runTo( 742.674744, height, -243.343140)
+floorguy:runTo( 742.312805, height, -273.083893)
+floorguy:runTo( 741.927856, height, -304.735474)
+floorguy:runTo( 741.548035, height, -335.971069)
+floorguy:runTo( 741.181824, height, -366.028503)
+programRoute = false
+end
+
+if floorguy:finalGoalReached() then
+programRoute = true
+end
+
+
+return false
+end
Index: data/trunk/scripts/guard.lua
===================================================================
--- data/trunk/scripts/guard.lua	(revision 3991)
+++ data/trunk/scripts/guard.lua	(revision 3991)
@@ -0,0 +1,220 @@
+-- Global Variables
+walkingRouteOne = true   -- True if thestranger is walking route one
+exitPositionReached = false
+playerInLock = false
+hangarReached = false
+
+height = 80
+
+-- Returns the distance between (x1,x2,x3) and (y1,y2,y3)
+function dist( x1,x2,x3, y1,y2,y3 )
+return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 )
+end
+
+
+function observePlayer()
+playerX = Player:getAbsCoorX()
+playerY = Player:getAbsCoorY()
+playerZ = Player:getAbsCoorZ()
+
+if dist( playerX,playerY,playerZ,167.361526,29,483.163818 ) < 60 then
+playerInLock = true
+end
+
+end
+
+routeOneProgrammed = false
+function walkRouteOne(timestep)
+
+if not routeOneProgrammed then
+guard:walkTo( 266.396362, height, 241.398544)
+guard:walkTo( 254.577255, height, 241.159897)
+guard:walkTo( 221.120651, height, 240.484360)
+guard:walkTo( 187.732651, height, 239.810196)
+guard:walkTo( 165.661865, height, 239.364563)
+guard:walkTo( 148.642044, height, 239.020889)
+guard:walkTo( 128.012802, height, 238.604340)
+guard:walkTo( 65.664688, height, 237.345383)
+guard:walkTo( 30.099592, height, 236.627243)
+guard:walkTo( -14.031926, height, 236.483414)
+guard:walkTo( -52.224205, height, 241.776978)
+guard:walkTo( -83.528168, height, 245.757629)
+guard:walkTo( -98.730980, height, 247.394043)
+guard:walkTo( -111.666504, height, 246.585648)
+guard:walkTo( -111.666504, height, 246.585648)
+guard:walkTo( -114.805542, height, 246.144440)
+guard:walkTo( -119.267967, height, 245.360168)
+guard:walkTo( -138.284515, height, 239.281021)
+guard:walkTo( -146.166840, height, 234.512054)
+guard:walkTo( -157.210480, height, 222.620941)
+guard:walkTo( -158.519867, height, 219.674301)
+guard:walkTo( -158.519867, height, 219.674301)
+guard:walkTo( -158.478958, height, 213.490570)
+guard:walkTo( -158.478958, height, 213.490570)
+guard:walkTo( -155.965332, height, 210.303101)
+guard:walkTo( -150.804489, height, 203.959869)
+guard:walkTo( -148.853012, height, 201.561295)
+guard:walkTo( -145.451157, height, 197.554382)
+guard:walkTo( -143.694107, height, 196.373535)
+guard:walkTo( -139.281479, height, 193.407990)
+guard:walkTo( -137.526047, height, 192.228226)
+guard:walkTo( -103.046753, height, 182.510071)
+guard:runTo( -14.992087, height, 181.910767)
+guard:runTo( 46.347664, height, 181.493317)
+guard:runTo( 86.343376, height, 181.221130)
+guard:runTo( 124.465179, height, 194.251617)
+guard:runTo( 136.548996, height, 219.682953)
+guard:runTo( 145.162140, height, 244.268982)
+guard:runTo( 149.328720, height, 256.993256)
+guard:runTo( 162.649582, height, 268.181732)
+
+routeOneProgrammed = true
+end
+
+if guard:finalGoalReached() then
+return false
+end
+
+return true
+end
+
+
+exitRouteProgrammed = false
+function goToExitPosition(timestep)
+
+if not exitRouteProgrammed then
+guard:walkTo( 162.096558, height, 274.944366)
+guard:walkTo( 161.519516, height, 286.673370)
+guard:walkTo( 161.098618, height, 295.228699)
+guard:walkTo( 160.568466, height, 306.004486)
+guard:walkTo( 160.151169, height, 314.486572)
+guard:walkTo( 159.416641, height, 324.925232)
+guard:walkTo( 158.700073, height, 335.108154)
+guard:walkTo( 157.943298, height, 345.862610)
+guard:walkTo( 157.418381, height, 356.131256)
+guard:walkTo( 156.908035, height, 366.115417)
+guard:walkTo( 156.940308, height, 377.467712)
+guard:walkTo( 156.965408, height, 386.287933)
+guard:walkTo( 156.924698, height, 394.296417)
+guard:walkTo( 156.816116, height, 401.564911)
+guard:walkTo( 156.147583, height, 446.314850)
+guard:walkTo( 155.145660, height, 515.473877)
+guard:walkTo( 148.450058, height, 524.572571)
+guard:walkTo( 135.599609, height, 533.407166)
+guard:walkTo( 119.772217, height, 539.609192)
+guard:walkTo( 108.926720, height, 537.174927)
+guard:walkTo( 100.885788, height, 524.737793)
+guard:walkTo( 99.870834, height, 512.540100)
+guard:walkTo( 108.219215, height, 502.064178)
+
+exitRouteProgrammed = true
+end
+
+if guard:finalGoalReached() and playerInLock then
+return true
+end
+
+return false
+end
+
+
+hangarRouteProgrammed = false
+function goToHangar(timestep)
+
+if not hangarRouteProgrammed and playerInLock then
+guard:walkTo( 138.422943, height, 504.832733)
+guard:walkTo( 188.685089, height, 509.034851)
+guard:walkTo( 259.451904, height, 515.326111)
+guard:walkTo( 351.655762, height, 519.210571)
+guard:walkTo( 495.821381, height, 517.551392)
+guard:walkTo( 650.267029, height, 516.826843)
+guard:walkTo( 752.277100, height, 506.265289)
+guard:walkTo( 780.652405, height, 397.283752)
+guard:walkTo( 780.212830, height, 317.386017)
+guard:walkTo( 778.699158, height, 241.875305)
+guard:walkTo( 776.305542, height, 120.869957)
+guard:walkTo( 774.626343, height, 26.204597)
+guard:walkTo( 773.148804, height, -30.654911)
+guard:walkTo( 771.164978, height, -106.990250)
+guard:walkTo( 756.719971, height, -197.656296)
+guard:walkTo( 730.690796, height, -269.808075)
+guard:walkTo( 702.250854, height, -341.732147)
+guard:walkTo( 681.786011, height, -393.487030)
+guard:walkTo( 664.005981, height, -441.609131)
+guard:walkTo( 655.612671, height, -523.194153)
+guard:walkTo( 664.289978, height, -585.003540)
+guard:walkTo( 670.221069, height, -645.366333)
+guard:walkTo( 674.347290, height, -704.953674)
+guard:walkTo( 677.495605, height, -750.421082)
+guard:walkTo( 680.699280, height, -796.687073)
+guard:walkTo( 686.407043, height, -879.117859)
+guard:walkTo( 692.573364, height, -952.031555)
+guard:walkTo( 701.940552, height, -1025.037964)
+guard:walkTo( 710.218628, height, -1086.598389)
+guard:walkTo( 719.834900, height, -1142.248779)
+guard:walkTo( 731.087158, height, -1198.201538)
+guard:walkTo( 745.157715, height, -1258.461182)
+guard:walkTo( 753.189331, height, -1290.539551)
+guard:walkTo( 763.940369, height, -1347.249268)
+guard:walkTo( 768.509949, height, -1377.040039)
+guard:walkTo( 770.845215, height, -1408.751953)
+guard:walkTo( 770.785583, height, -1435.573608)
+guard:walkTo( 765.031799, height, -1462.657593)
+guard:walkTo( 753.982727, height, -1483.425415)
+guard:walkTo( 735.194580, height, -1500.978394)
+guard:walkTo( 707.312500, height, -1514.814575)
+guard:walkTo( 672.638550, height, -1522.803589)
+guard:walkTo( 560.158936, height, -1530.277344)
+guard:walkTo( 500.429626, height, -1532.241577)
+guard:walkTo( 371.231262, height, -1535.953613)
+guard:walkTo( 204.211609, height, -1539.026611)
+guard:walkTo( 104.032593, height, -1546.350220)
+guard:walkTo( 45.058315, height, -1550.720337)
+guard:walkTo( 1.504358, height, -1574.713745)
+guard:walkTo( -20.050890, height, -1627.849854)
+guard:walkTo( -28.036245, height, -1674.240479)
+guard:walkTo( -29.157598, height, -1702.924316)
+guard:walkTo( -29.760004, height, -1730.014526)
+guard:walkTo( -29.538343, height, -1759.887329)
+guard:walkTo( -21.584003, height, -1790.162842)
+guard:walkTo( -8.572795, height, -1823.067871)
+guard:walkTo( 13.254844, height, -1861.705688)
+hangarRouteProgrammed  = true
+end
+
+if guard:finalGoalReached() then
+return true
+end
+
+return false
+end
+
+
+function waveToSpaceship(timestep)
+
+end
+
+
+function tick(timestep)
+--io.write("Guard called \n")
+observePlayer()
+
+if walkingRouteOne then
+walkingRouteOne = walkRouteOne(timestep)
+end
+
+if not walkingRouteOne and not exitPositionReached then
+exitPositionReached = goToExitPosition(timestep)
+end
+
+if not hangarReached and exitPositionReached then
+hangarReached = goToHangar(timestep)
+end
+
+if hangarReached then
+waveToSpaceship(timestep)
+end
+
+return false
+end
+ 
Index: data/trunk/scripts/lua_extra_functions
===================================================================
--- data/trunk/scripts/lua_extra_functions	(revision 3991)
+++ data/trunk/scripts/lua_extra_functions	(revision 3991)
@@ -0,0 +1,20 @@
+!--------------- Copy this to the beginning of a lua script to use the functions ---------------!
+
+-- Initialises the random number generator
+randinit = false
+function randInit()
+
+if not randinit then
+math.randomseed(os.clock())
+randinit = true
+end
+
+end
+
+
+-- Returns the distance between (x1,x2,x3) and (y1,y2,y3)
+function dist( x1,x2,x3, y1,y2,y3 )
+
+return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 )
+
+end
Index: data/trunk/scripts/prisoner.lua
===================================================================
--- data/trunk/scripts/prisoner.lua	(revision 3991)
+++ data/trunk/scripts/prisoner.lua	(revision 3991)
@@ -0,0 +1,312 @@
+cellDoorOpened = false
+walkinCellFinished = false
+cellExitReached = false
+exitReached = false
+hangarReached = false
+spaceShipReached = false
+spaceShipEntered = false
+playerInLock = false
+
+randTime = 0
+height = 80
+
+
+function dist( x1,x2,x3, y1,y2,y3 )
+
+return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 )
+
+end
+
+function observeGuard()
+guardX = secondguard:getAbsCoorX()
+guardY = secondguard:getAbsCoorY()
+guardZ = secondguard:getAbsCoorZ()
+
+if dist( guardX,guardY,guardZ, 43.406876, 29, 179.517303) < 60 then
+cellDoorOpened = true
+end
+
+end
+
+function observePlayer()
+playerX = Player:getAbsCoorX()
+playerY = Player:getAbsCoorY()
+playerZ = Player:getAbsCoorZ()
+
+if dist( playerX,playerY,playerZ,161.76,49,358.87 ) < 60 then
+playerInLock = true
+end
+
+end
+
+
+
+walkProgrammed = false
+exitProgrammed = false
+function walkInCell(timestep)
+
+
+if not walkProgrammed then
+prisoner:walkTo( -66.454849, height, 62.363449)
+prisoner:walkTo( -66.454849, height, 62.363449)
+prisoner:walkTo( -63.214821, height, 62.429710)
+prisoner:walkTo( -56.661182, height, 62.563740)
+prisoner:walkTo( -46.779755, height, 62.765827)
+prisoner:walkTo( -41.634224, height, 71.319214)
+prisoner:walkTo( -38.168526, height, 79.655807)
+prisoner:walkTo( -40.782196, height, 101.285233)
+prisoner:walkTo( -47.722874, height, 114.314980)
+prisoner:walkTo( -54.593349, height, 118.605423)
+prisoner:walkTo( -62.802982, height, 117.947144)
+prisoner:walkTo( -73.180130, height, 116.720863)
+prisoner:walkTo( -85.028603, height, 114.952316)
+prisoner:walkTo( -113.125824, height, 96.362946)
+prisoner:walkTo( -118.218887, height, 87.702599)
+prisoner:walkTo( -120.596275, height, 80.304184)
+prisoner:walkTo( -114.928169, height, 68.971840)
+prisoner:walkTo( -108.606766, height, 62.085098)
+prisoner:walkTo( -90.078171, height, 59.558804)
+prisoner:walkTo( -83.558510, height, 60.516567)
+prisoner:walkTo( -71.352402, height, 63.920750)
+walkProgrammed = true
+end
+
+
+if prisoner:finalGoalReached() and not cellDoorOpened then
+ walkProgrammed = false
+end
+
+
+if cellDoorOpened then
+
+  if not exitProgrammed then
+prisoner:walkTo( -61.875267, height, 158.254517)
+prisoner:walkTo( -62.335995, height, 170.318756)
+prisoner:walkTo( -62.358681, height, 179.232559)
+prisoner:walkTo( -55.998741, height, 189.289749)
+prisoner:walkTo( -49.237957, height, 195.076263)
+prisoner:walkTo( -39.007496, height, 195.889221)
+prisoner:walkTo( -24.234095, height, 195.547043)
+prisoner:walkTo( -11.409116, height, 196.236069)
+prisoner:walkTo( 2.545602, height, 196.805954)
+prisoner:walkTo( 13.875313, height, 196.377563)
+prisoner:walkTo( 28.379402, height, 195.829132)
+prisoner:walkTo( 41.672989, height, 195.326477)
+prisoner:walkTo( 57.125935, height, 194.742126)
+prisoner:walkTo( 70.114609, height, 194.251007)
+prisoner:walkTo( 81.857407, height, 193.806961)
+prisoner:walkTo( 97.840607, height, 193.974030)
+prisoner:walkTo( 107.569641, height, 196.299652)
+prisoner:walkTo( 120.975266, height, 202.754532)
+prisoner:walkTo( 129.063812, height, 207.099640)
+prisoner:walkTo( 140.468765, height, 214.389191)
+prisoner:walkTo( 145.902267, height, 224.194229)
+prisoner:walkTo( 148.106079, height, 233.095215)
+prisoner:walkTo( 150.907532, height, 244.410049)
+prisoner:walkTo( 153.191757, height, 253.635788)
+prisoner:walkTo( 153.191757, height, 253.635788)
+   exitProgrammed = true
+  end
+
+  if prisoner:finalGoalReached() then
+   return true
+  end
+
+end 
+
+return false
+
+end
+
+
+hangarRouteProgrammed = false
+function goToHangar(timestep)
+
+if not hangarRouteProgrammed and playerInLock then
+prisoner:walkTo( 149.255554, height, 253.358582)
+prisoner:walkTo( 155.679886, height, 274.126282)
+prisoner:walkTo( 157.556641, height, 285.543640)
+prisoner:walkTo( 159.016068, height, 294.552338)
+prisoner:walkTo( 160.234924, height, 303.494812)
+prisoner:walkTo( 161.399475, height, 313.532013)
+prisoner:walkTo( 162.218994, height, 323.290924)
+prisoner:walkTo( 162.030823, height, 335.226715)
+prisoner:walkTo( 161.351410, height, 378.328094)
+prisoner:walkTo( 161.183487, height, 388.983093)
+prisoner:walkTo( 160.590225, height, 426.615540)
+prisoner:walkTo( 160.313049, height, 444.198425)
+prisoner:walkTo( 160.410721, height, 454.192413)
+prisoner:walkTo( 161.796692, height, 465.085663)
+prisoner:walkTo( 163.096069, height, 474.038086)
+prisoner:walkTo( 165.596329, height, 485.415924)
+prisoner:walkTo( 167.407303, height, 493.229279)
+prisoner:walkTo( 169.595749, height, 499.048309)
+prisoner:walkTo( 173.485214, height, 504.383026)
+prisoner:walkTo( 182.131546, height, 510.774567)
+prisoner:walkTo( 187.788422, height, 512.870789)
+prisoner:walkTo( 196.524994, height, 514.751892)
+prisoner:walkTo( 205.403473, height, 515.840271)
+prisoner:walkTo( 205.403473, height, 515.840271)
+prisoner:walkTo( 220.813049, height, 515.886658)
+prisoner:walkTo( 392.501221, height, 516.405579)
+prisoner:walkTo( 441.405975, height, 516.502502)
+prisoner:walkTo( 513.379517, height, 515.572266)
+prisoner:walkTo( 586.638611, height, 514.625244)
+prisoner:walkTo( 651.319214, height, 513.789246)
+prisoner:walkTo( 680.890869, height, 513.406982)
+prisoner:walkTo( 701.035828, height, 512.568359)
+prisoner:walkTo( 716.025879, height, 510.741150)
+prisoner:walkTo( 723.756042, height, 509.009583)
+prisoner:walkTo( 733.522095, height, 504.761475)
+prisoner:walkTo( 738.782104, height, 501.529327)
+prisoner:walkTo( 744.840637, height, 496.154846)
+prisoner:walkTo( 750.059875, height, 487.892670)
+prisoner:walkTo( 753.419373, height, 477.053894)
+prisoner:walkTo( 754.661743, height, 470.759735)
+prisoner:walkTo( 765.877319, height, 397.575897)
+prisoner:walkTo( 768.522522, height, 360.462250)
+prisoner:walkTo( 769.531250, height, 326.195801)
+prisoner:walkTo( 770.420532, height, 286.531830)
+prisoner:walkTo( 769.840393, height, 238.220535)
+prisoner:walkTo( 771.094543, height, 172.138474)
+prisoner:walkTo( 772.765137, height, 94.427673)
+prisoner:walkTo( 771.779175, height, 62.094421)
+prisoner:walkTo( 771.069336, height, 35.182930)
+prisoner:walkTo( 769.679199, height, 4.657598)
+prisoner:walkTo( 768.049377, height, -23.208313)
+prisoner:walkTo( 766.691711, height, -54.609066)
+prisoner:walkTo( 765.022156, height, -85.732277)
+prisoner:walkTo( 763.538635, height, -110.417847)
+prisoner:walkTo( 761.547485, height, -143.547577)
+prisoner:walkTo( 760.982483, height, -147.543091)
+prisoner:walkTo( 756.619934, height, -163.474457)
+prisoner:walkTo( 751.651611, height, -180.926727)
+prisoner:walkTo( 739.842041, height, -216.826782)
+prisoner:walkTo( 716.715149, height, -294.878693)
+prisoner:walkTo( 698.400146, height, -365.404541)
+prisoner:walkTo( 692.199890, height, -396.395386)
+prisoner:walkTo( 685.157593, height, -437.489929)
+prisoner:walkTo( 678.175537, height, -475.680817)
+prisoner:walkTo( 674.907837, height, -505.428314)
+prisoner:walkTo( 674.588501, height, -531.477478)
+prisoner:walkTo( 674.703308, height, -550.883789)
+prisoner:walkTo( 675.315063, height, -567.361206)
+prisoner:walkTo( 676.178345, height, -583.178772)
+prisoner:walkTo( 678.579407, height, -638.655518)
+prisoner:walkTo( 689.508118, height, -884.296448)
+prisoner:walkTo( 690.749084, height, -917.750366)
+prisoner:walkTo( 691.617676, height, -933.357056)
+prisoner:walkTo( 696.260742, height, -972.685669)
+prisoner:walkTo( 698.526550, height, -990.077209)
+prisoner:walkTo( 705.576599, height, -1033.587646)
+prisoner:walkTo( 719.388611, height, -1111.123657)
+prisoner:walkTo( 724.847229, height, -1137.902832)
+prisoner:walkTo( 729.118652, height, -1159.426514)
+prisoner:walkTo( 733.152161, height, -1179.577393)
+prisoner:walkTo( 737.474365, height, -1200.200684)
+prisoner:walkTo( 740.808777, height, -1216.996216)
+prisoner:walkTo( 748.261108, height, -1252.447021)
+prisoner:walkTo( 748.648682, height, -1254.182983)
+prisoner:walkTo( 752.690430, height, -1272.386719)
+prisoner:walkTo( 755.726562, height, -1286.795532)
+prisoner:walkTo( 758.134705, height, -1302.620117)
+prisoner:walkTo( 759.900879, height, -1317.258911)
+prisoner:walkTo( 760.405212, height, -1357.575195)
+prisoner:walkTo( 760.203979, height, -1396.744385)
+prisoner:walkTo( 759.262085, height, -1433.674316)
+prisoner:walkTo( 758.916016, height, -1447.247437)
+prisoner:walkTo( 757.844910, height, -1474.596558)
+prisoner:walkTo( 756.331238, height, -1484.150269)
+prisoner:walkTo( 754.152283, height, -1491.574585)
+prisoner:walkTo( 750.549561, height, -1497.667236)
+prisoner:walkTo( 741.115356, height, -1509.581177)
+prisoner:walkTo( 733.292236, height, -1516.592407)
+prisoner:walkTo( 724.755798, height, -1522.380615)
+prisoner:walkTo( 712.188721, height, -1528.557495)
+prisoner:walkTo( 707.279907, height, -1530.261841)
+prisoner:walkTo( 698.749390, height, -1532.002563)
+prisoner:walkTo( 681.891785, height, -1532.067871)
+prisoner:walkTo( 625.072388, height, -1531.572266)
+prisoner:walkTo( 501.572601, height, -1533.919922)
+prisoner:walkTo( 237.189667, height, -1538.984985)
+prisoner:walkTo( 146.071304, height, -1540.965820)
+prisoner:walkTo( 88.186996, height, -1549.110962)
+prisoner:walkTo( 85.715096, height, -1549.537842)
+prisoner:walkTo( 66.997787, height, -1552.770264)
+prisoner:walkTo( 52.632504, height, -1555.359009)
+prisoner:walkTo( 38.350941, height, -1560.845459)
+prisoner:walkTo( 26.315248, height, -1568.211060)
+prisoner:walkTo( 15.210221, height, -1580.474121)
+prisoner:walkTo( 6.527347, height, -1594.483398)
+prisoner:walkTo( 3.175952, height, -1610.220093)
+
+hangarRouteProgrammed = true
+end
+
+thisX = prisoner:getAbsCoorX()
+thisY = prisoner:getAbsCoorY()
+thisZ = prisoner:getAbsCoorZ()
+
+if dist( thisX,thisY,thisZ, 3.175952, 29, -1610.220093) < 60 then
+return true
+end
+
+
+return false
+
+end
+
+spaceshipRouteProgrammed = false
+function goToSpaceship(timestep)
+
+if not spaceshipRouteProgrammed then
+
+
+spaceshipRouteProgrammed = true
+end
+
+if prisoner:finalGoalReached() then
+   return true
+end
+
+return false
+
+end
+
+
+function enterSpaceship(timestep)
+
+return false
+end
+
+
+
+function tick(timestep)
+
+ observeGuard()
+ observePlayer()
+
+
+if not walkinCellFinished then
+walkinCellFinished = walkInCell(timestep)
+end
+
+
+if walkinCellFinished and not hangarReached then
+hangarReached = goToHangar(timestep)
+end
+
+if hangarReached and not spaceShipReached then 
+spaceShipReached = goToSpaceship(timestep)
+end
+
+if spaceShipReached and not spaceShipEntered then
+spaceShipEntered = enterSpaceship(timestep)
+end
+
+if spaceShipEntered then
+return true
+end
+
+return false
+end
Index: data/trunk/scripts/secondguard.lua
===================================================================
--- data/trunk/scripts/secondguard.lua	(revision 3991)
+++ data/trunk/scripts/secondguard.lua	(revision 3991)
@@ -0,0 +1,333 @@
+-- Global Variables
+allOk = true
+cellReached = false
+guidePositionReached = false
+prisonerReachedLock = false
+hangarReached = false
+
+height = 100
+
+-- Returns the distance between (x1,x2,x3) and (y1,y2,y3)
+function dist( x1,x2,x3, y1,y2,y3 )
+return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 )
+end
+
+
+function observeGuard()
+guardX = guard:getAbsCoorX()
+guardY = guard:getAbsCoorY()
+guardZ = guard:getAbsCoorZ()
+
+if dist( guardX,guardY,guardZ,35.48, 29, 191.28 ) < 30 then
+allOk = false
+end
+
+end
+
+function observePrisoner()
+
+prisonerX = prisoner:getAbsCoorX()
+prisonerY = prisoner:getAbsCoorY()
+prisonerZ = prisoner:getAbsCoorZ()
+
+if dist( prisonerX,prisonerY,prisonerZ,162.757919,49,363.489349 ) < 60 then
+--io.write("Prisonner reached lock \n")
+prisonerReachedLock = true
+end
+
+end
+
+cellProgrammed = false
+function goToCell(timestep)
+
+if not cellProgrammed then
+secondguard:walkTo( 442.173767, height, 176.429855)
+secondguard:walkTo( 442.173767, height, 176.429855)
+secondguard:walkTo( 436.727753, height, 188.191757)
+secondguard:walkTo( 432.311584, height, 198.882462)
+secondguard:walkTo( 426.079590, height, 213.968994)
+secondguard:walkTo( 420.553986, height, 226.714996)
+secondguard:walkTo( 412.681915, height, 235.053696)
+secondguard:walkTo( 398.758545, height, 241.846924)
+secondguard:walkTo( 384.690735, height, 242.851395)
+secondguard:walkTo( 348.930481, height, 242.394958)
+secondguard:walkTo( 336.467926, height, 241.985764)
+secondguard:walkTo( 324.042999, height, 241.577774)
+secondguard:walkTo( 303.851410, height, 240.914841)
+secondguard:walkTo( 293.013977, height, 240.559006)
+secondguard:walkTo( 276.207611, height, 240.007233)
+secondguard:walkTo( 261.475800, height, 239.523544)
+secondguard:walkTo( 239.185089, height, 238.791687)
+secondguard:walkTo( 226.655655, height, 238.491974)
+secondguard:walkTo( 211.996979, height, 238.851044)
+secondguard:walkTo( 192.956741, height, 239.859207)
+secondguard:walkTo( 178.496552, height, 241.852539)
+secondguard:walkTo( 160.421860, height, 244.009827)
+secondguard:walkTo( 145.371857, height, 244.946075)
+secondguard:walkTo( 129.918198, height, 245.307037)
+secondguard:walkTo( 113.065468, height, 245.108231)
+secondguard:walkTo( 99.159073, height, 244.695694)
+secondguard:walkTo( 82.069923, height, 244.188766)
+secondguard:walkTo( 65.880531, height, 243.708527)
+secondguard:walkTo( 48.133881, height, 243.182114)
+secondguard:walkTo( 34.706280, height, 242.783813)
+secondguard:walkTo( 20.682344, height, 242.367783)
+secondguard:walkTo( 5.419819, height, 241.915070)
+secondguard:walkTo( -10.556346, height, 241.058746)
+secondguard:walkTo( -24.159513, height, 240.127090)
+secondguard:walkTo( -33.819145, height, 239.995453)
+secondguard:walkTo( -45.414162, height, 240.373322)
+secondguard:walkTo( -60.228550, height, 240.856079)
+secondguard:walkTo( -73.269897, height, 241.260895)
+secondguard:walkTo( -86.128647, height, 240.457886)
+secondguard:walkTo( -100.443581, height, 236.485718)
+secondguard:walkTo( -112.346939, height, 233.967209)
+secondguard:walkTo( -127.331635, height, 227.615112)
+secondguard:walkTo( -135.153656, height, 215.476883)
+secondguard:walkTo( -131.529984, height, 202.931015)
+secondguard:walkTo( -122.671799, height, 193.644669)
+secondguard:walkTo( -113.823517, height, 183.986633)
+secondguard:walkTo( -104.089592, height, 170.659729)
+cellProgrammed = true
+end
+
+if secondguard:finalGoalReached() then
+return true
+end
+
+return false
+end
+
+guideProgrammed = false
+function goToGuidePosition(timestep)
+
+if not guideProgrammed then
+secondguard:walkTo( -104.757011, height, 171.200729)
+secondguard:walkTo( -100.266739, height, 171.345627)
+secondguard:walkTo( -91.152046, height, 171.639709)
+secondguard:walkTo( -85.456375, height, 171.823486)
+secondguard:walkTo( -74.048538, height, 172.191589)
+secondguard:walkTo( -53.574173, height, 172.852219)
+secondguard:walkTo( -43.275124, height, 173.184540)
+secondguard:walkTo( -35.155544, height, 173.446518)
+secondguard:walkTo( -31.645050, height, 173.559784)
+secondguard:walkTo( -23.426588, height, 173.824966)
+secondguard:walkTo( -10.576803, height, 174.239578)
+secondguard:walkTo( -2.389911, height, 174.503754)
+secondguard:walkTo( 6.950986, height, 174.805176)
+secondguard:walkTo( 16.313608, height, 175.161179)
+secondguard:walkTo( 23.271458, height, 175.547226)
+secondguard:walkTo( 31.248058, height, 176.199890)
+secondguard:walkTo( 43.694778, height, 177.753479)
+secondguard:walkTo( 50.441612, height, 178.595612)
+secondguard:walkTo( 71.374535, height, 181.208389)
+secondguard:walkTo( 82.251022, height, 181.855988)
+secondguard:walkTo( 91.975792, height, 182.434998)
+secondguard:walkTo( 101.695015, height, 183.013672)
+secondguard:walkTo( 110.377205, height, 183.530609)
+secondguard:walkTo( 122.299400, height, 184.240448)
+secondguard:walkTo( 129.848495, height, 184.689911)
+secondguard:walkTo( 141.687805, height, 185.394821)
+secondguard:walkTo( 150.166702, height, 186.776016)
+secondguard:walkTo( 155.342255, height, 189.285080)
+secondguard:walkTo( 162.508133, height, 192.849976)
+secondguard:walkTo( 171.747696, height, 197.075134)
+secondguard:walkTo( 177.846390, height, 199.864029)
+secondguard:walkTo( 182.707596, height, 204.381516)
+secondguard:walkTo( 182.707596, height, 204.381516)
+secondguard:walkTo( 187.317139, height, 211.966385)
+secondguard:walkTo( 193.191528, height, 221.632446)
+secondguard:walkTo( 197.856018, height, 229.307724)
+secondguard:walkTo( 198.350906, height, 232.634857)
+secondguard:walkTo( 198.427155, height, 243.656113)
+
+guideProgrammed = true
+end
+
+if secondguard:finalGoalReached() then
+return true
+end
+
+return false
+end
+
+hangarProgrammed = false
+function goToHangar(timestep)
+
+if not hangarProgrammed and prisonerReachedLock then
+secondguard:walkTo( 194.153641, height, 244.749863)
+secondguard:walkTo( 185.976517, height, 243.876404)
+secondguard:walkTo( 179.645737, height, 243.505066)
+secondguard:walkTo( 169.583008, height, 244.959457)
+secondguard:walkTo( 161.454269, height, 249.422363)
+secondguard:walkTo( 158.488998, height, 260.951874)
+secondguard:walkTo( 158.228958, height, 272.121582)
+secondguard:walkTo( 158.326004, height, 288.892853)
+secondguard:walkTo( 158.389069, height, 299.792603)
+secondguard:walkTo( 158.437561, height, 308.174896)
+secondguard:walkTo( 158.479034, height, 315.341095)
+secondguard:walkTo( 158.542801, height, 326.362518)
+secondguard:walkTo( 158.621414, height, 339.950256)
+secondguard:walkTo( 158.664566, height, 347.408417)
+secondguard:walkTo( 158.737900, height, 360.080902)
+secondguard:walkTo( 158.795013, height, 369.950531)
+secondguard:walkTo( 158.857086, height, 380.676056)
+secondguard:walkTo( 158.935440, height, 394.219177)
+secondguard:walkTo( 158.984039, height, 402.618896)
+secondguard:walkTo( 159.035522, height, 411.518219)
+secondguard:walkTo( 159.089432, height, 420.837036)
+secondguard:walkTo( 159.143021, height, 430.104523)
+secondguard:walkTo( 159.203644, height, 440.579224)
+secondguard:walkTo( 159.257263, height, 449.841522)
+secondguard:walkTo( 159.304810, height, 458.057617)
+secondguard:walkTo( 159.351440, height, 466.113068)
+secondguard:walkTo( 160.060013, height, 482.411865)
+secondguard:walkTo( 161.352600, height, 488.302185)
+secondguard:walkTo( 174.254333, height, 503.439209)
+secondguard:walkTo( 181.668213, height, 506.381195)
+secondguard:walkTo( 189.177277, height, 508.729156)
+secondguard:walkTo( 213.465332, height, 512.184326)
+secondguard:walkTo( 223.635010, height, 512.920715)
+secondguard:walkTo( 233.668503, height, 513.374512)
+secondguard:walkTo( 448.702118, height, 512.187744)
+secondguard:walkTo( 477.701050, height, 511.587463)
+secondguard:walkTo( 525.645752, height, 511.139526)
+secondguard:walkTo( 559.871216, height, 510.819763)
+secondguard:walkTo( 596.801941, height, 510.632080)
+secondguard:walkTo( 640.160767, height, 510.906891)
+secondguard:walkTo( 684.745239, height, 510.429138)
+secondguard:walkTo( 706.457214, height, 508.596039)
+secondguard:walkTo( 718.750916, height, 507.558044)
+secondguard:walkTo( 728.147827, height, 506.649780)
+secondguard:walkTo( 743.581970, height, 502.185822)
+secondguard:walkTo( 752.977234, height, 495.788635)
+secondguard:walkTo( 759.201721, height, 483.407104)
+secondguard:walkTo( 761.196167, height, 461.130798)
+secondguard:walkTo( 762.335449, height, 398.166901)
+secondguard:walkTo( 762.908691, height, 366.482208)
+secondguard:walkTo( 763.506409, height, 333.456848)
+secondguard:walkTo( 764.330750, height, 287.894409)
+secondguard:walkTo( 767.909790, height, 194.910492)
+secondguard:walkTo( 770.649231, height, 122.865265)
+secondguard:walkTo( 770.102112, height, 44.244534)
+secondguard:walkTo( 767.269775, height, -37.871273)
+secondguard:walkTo( 763.989197, height, -132.996460)
+secondguard:walkTo( 755.274231, height, -217.520859)
+secondguard:walkTo( 739.636230, height, -307.869354)
+secondguard:walkTo( 722.792725, height, -390.075226)
+secondguard:walkTo( 702.582275, height, -475.155273)
+secondguard:walkTo( 687.325012, height, -551.699036)
+secondguard:walkTo( 681.873169, height, -628.924316)
+secondguard:walkTo( 679.997437, height, -708.013794)
+secondguard:walkTo( 681.080933, height, -772.108887)
+secondguard:walkTo( 681.686035, height, -845.449524)
+secondguard:walkTo( 682.188538, height, -906.434998)
+secondguard:walkTo( 682.669800, height, -964.887085)
+secondguard:walkTo( 684.829895, height, -1023.870117)
+secondguard:walkTo( 690.728516, height, -1069.400146)
+secondguard:walkTo( 695.965027, height, -1097.353149)
+secondguard:walkTo( 701.128540, height, -1118.496216)
+secondguard:walkTo( 708.865234, height, -1144.444214)
+secondguard:walkTo( 724.753845, height, -1192.741699)
+secondguard:walkTo( 737.665771, height, -1230.398560)
+secondguard:walkTo( 741.520081, height, -1241.704712)
+secondguard:walkTo( 756.537842, height, -1287.260376)
+secondguard:walkTo( 764.046631, height, -1310.927002)
+secondguard:walkTo( 769.402771, height, -1342.806152)
+secondguard:walkTo( 772.158691, height, -1363.218750)
+secondguard:walkTo( 772.599426, height, -1374.571899)
+secondguard:walkTo( 771.977844, height, -1390.778320)
+secondguard:walkTo( 771.576355, height, -1401.246826)
+secondguard:walkTo( 770.982666, height, -1423.905273)
+secondguard:walkTo( 770.952637, height, -1429.344360)
+secondguard:walkTo( 770.912476, height, -1436.589966)
+secondguard:walkTo( 770.880249, height, -1442.399536)
+secondguard:walkTo( 770.847107, height, -1448.385376)
+secondguard:walkTo( 770.785339, height, -1454.349365)
+secondguard:walkTo( 768.858459, height, -1464.382080)
+secondguard:walkTo( 767.639709, height, -1469.028809)
+secondguard:walkTo( 765.099487, height, -1476.370605)
+secondguard:walkTo( 762.003601, height, -1484.767456)
+secondguard:walkTo( 758.787231, height, -1492.394287)
+secondguard:walkTo( 755.135986, height, -1496.482788)
+secondguard:walkTo( 752.631165, height, -1498.550049)
+secondguard:walkTo( 746.021912, height, -1502.547485)
+secondguard:walkTo( 739.376099, height, -1505.427734)
+secondguard:walkTo( 731.429199, height, -1507.691162)
+secondguard:walkTo( 719.202393, height, -1510.812622)
+secondguard:walkTo( 716.329712, height, -1511.546021)
+secondguard:walkTo( 711.301514, height, -1512.674438)
+secondguard:walkTo( 702.414124, height, -1514.126099)
+secondguard:walkTo( 695.724304, height, -1515.173218)
+secondguard:walkTo( 576.522278, height, -1521.146362)
+secondguard:walkTo( 542.552246, height, -1522.204712)
+secondguard:walkTo( 499.907288, height, -1524.441772)
+secondguard:walkTo( 461.101288, height, -1525.987915)
+secondguard:walkTo( 417.154602, height, -1526.579102)
+secondguard:walkTo( 367.752686, height, -1527.168091)
+secondguard:walkTo( 322.209106, height, -1527.709473)
+secondguard:walkTo( 273.998047, height, -1528.283447)
+secondguard:walkTo( 234.330612, height, -1528.756348)
+secondguard:walkTo( 188.730209, height, -1529.299438)
+secondguard:walkTo( 140.078659, height, -1529.880249)
+secondguard:walkTo( 105.882103, height, -1530.287109)
+secondguard:walkTo( 71.860947, height, -1532.856079)
+secondguard:walkTo( 39.777569, height, -1541.485596)
+secondguard:walkTo( 13.919314, height, -1565.188110)
+secondguard:walkTo( -0.632493, height, -1604.602783)
+secondguard:walkTo( -2.103141, height, -1639.236694)
+secondguard:walkTo( 0.498238, height, -1674.846558)
+secondguard:walkTo( 2.861493, height, -1705.131958)
+
+hangarProgrammed = true
+end
+
+guardX = secondguard:getAbsCoorX()
+guardY = secondguard:getAbsCoorY()
+guardZ = secondguard:getAbsCoorZ()
+
+if dist( guardX,guardY,guardZ, 2.861493, 29, -1705.131958) < 60 then
+return true
+end
+
+return false
+
+end
+
+time = 2
+function tick(timestep)
+--io.write("Secondguard called \n")
+ 
+observePrisoner()
+observeGuard()
+
+if not allOk then
+cellReached = goToCell(timestep)
+end
+
+--do talking
+if cellReached then
+time = time - timestep
+end
+
+
+if time < 0 then
+
+if cellReached and not guidePositionReached then
+guidePositionReached = goToGuidePosition(timestep)
+end
+
+if guidePositionReached and not hangarReached then
+hangarReached = goToHangar(timestep)
+end
+
+if hangarReached then
+return true
+end
+
+
+end
+
+
+return false
+end
Index: data/trunk/scripts/secondprisoner.lua
===================================================================
--- data/trunk/scripts/secondprisoner.lua	(revision 3991)
+++ data/trunk/scripts/secondprisoner.lua	(revision 3991)
@@ -0,0 +1,29 @@
+
+-- Initialises the random number generator
+randinit = false
+function randInit()
+
+if not randinit then
+math.randomseed(os.clock())
+randinit = true
+end
+
+end
+
+
+function scream()
+
+end
+
+function tick(timestep)
+
+--io.write("Secondprisoner called \n")
+randInit()
+randNumber = 10 * math.random()
+
+if randNumber > 8 then
+scream()
+end
+
+return false
+end
Index: data/trunk/scripts/spaceship.lua
===================================================================
--- data/trunk/scripts/spaceship.lua	(revision 3991)
+++ data/trunk/scripts/spaceship.lua	(revision 3991)
@@ -0,0 +1,5 @@
+
+function tick(timestep)
+--io.write("Spaceship called \n")
+return false
+end
Index: data/trunk/scripts/thestranger.lua
===================================================================
--- data/trunk/scripts/thestranger.lua	(revision 3991)
+++ data/trunk/scripts/thestranger.lua	(revision 3991)
@@ -0,0 +1,36 @@
+-- Global Variables
+panic = false             -- True if thestranger panics.
+walkingRouteOne = false   -- True if thestranger is walking route one
+
+
+function togglePanic(timestep)
+panic = not panic
+return false
+end
+
+
+function walkRouteOne()
+
+
+end
+
+function flee()
+
+
+end
+
+
+function tick(timestep)
+
+if not walkingRouteOne then
+walkRouteOne()
+routeOneTriggered = true
+end
+
+if panic then
+flee(timestep)
+end
+
+
+return false
+end
