Index: /data/branches/single_player_map/scripts/guard.lua
===================================================================
--- /data/branches/single_player_map/scripts/guard.lua	(revision 3950)
+++ /data/branches/single_player_map/scripts/guard.lua	(revision 3951)
@@ -7,13 +7,7 @@
 -- 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 stopWalkRouteOne(timestep)
-walkRouteOne = false
-return true
-end
 
 function observePlayer()
@@ -32,12 +26,48 @@
 
 if not routeOneProgrammed then
-io.write("Guard called \n")
-guard:walkTo(-154.592667, 80.000000, 231.381805)
+--io.write("Guard called \n")
+guard:walkTo(-132, 29, 238.381805)
+guard:walkTo(-138.41, 29, 275.25)
+guard:walkTo(-143.70, 29, 275.35)
+guard:walkTo(-149.10, 29, 226.66)
+guard:walkTo(-149.10, 29, 196.83)
+guard:walkTo(-145.82, 29, 189.74)
+guard:walkTo(-138.48, 29, 184.28)
+guard:walkTo(35.48, 29, 191.28)
+guard:runTo(102, 29, 203.28)
+guard:runTo(164, 29, 245.28)
+
 routeOneProgrammed = true
 end
 
+if guard:finalGoalReached() then
+return false
 end
 
+return true
+end
+
+
+exitRouteProgrammed = false
 function goToExitPosition(timestep)
+
+if not exitRouteProgrammed then
+guard:walkTo(-132, 29, 238.381805)
+guard:walkTo(-138.41, 29, 275.25)
+guard:walkTo(-143.70, 29, 275.35)
+guard:walkTo(-149.10, 29, 226.66)
+guard:walkTo(-149.10, 29, 196.83)
+guard:walkTo(-145.82, 29, 189.74)
+guard:walkTo(-138.48, 29, 184.28)
+guard:walkTo(35.48, 29, 191.28)
+guard:runTo(102, 29, 203.28)
+guard:runTo(164, 29, 245.28)
+
+exitRouteProgrammed = true
+end
+
+if guard:finalGoalReached() and playerInLock then
+return true
+end
 
 return false
@@ -45,5 +75,25 @@
 
 
+hangarRouteProgrammed = false
 function goToHangar(timestep)
+
+if not hangarRouteProgrammed  then
+guard:walkTo(-132, 29, 238.381805)
+guard:walkTo(-138.41, 29, 275.25)
+guard:walkTo(-143.70, 29, 275.35)
+guard:walkTo(-149.10, 29, 226.66)
+guard:walkTo(-149.10, 29, 196.83)
+guard:walkTo(-145.82, 29, 189.74)
+guard:walkTo(-138.48, 29, 184.28)
+guard:walkTo(35.48, 29, 191.28)
+guard:runTo(102, 29, 203.28)
+guard:runTo(164, 29, 245.28)
+
+hangarRouteProgrammed  = true
+end
+
+if guard:finalGoalReached() then
+return true
+end
 
 return false
@@ -61,5 +111,5 @@
 
 if walkingRouteOne then
-walkRouteOne(timestep)
+walkingRouteOne = walkRouteOne(timestep)
 end
 
Index: /data/branches/single_player_map/scripts/secondguard.lua
===================================================================
--- /data/branches/single_player_map/scripts/secondguard.lua	(revision 3950)
+++ /data/branches/single_player_map/scripts/secondguard.lua	(revision 3951)
@@ -1,5 +1,5 @@
 -- Global Variables
 allOk = true
-standing = false
+cellReached = false
 guidePositionReached = false
 prisonerReachedLock = false
@@ -15,18 +15,29 @@
 
 
-function alert(timestep)
+function observeGuard()
+guardX = guard:getAbsCoorX()
+guardY = guard:getAbsCoorY()
+guardZ = guard:getAbsCoorZ()
+
+if dist( guardX,guardY,guardZ,161.76,49,358.87 ) < 60 then
 allOk = false
-return true
+end
+
 end
 
 function observePrisoner()
 
---prisonerX = Prisoner:getAbsCoorX()
---prisonerY = Prisoner:getAbsCoorY()
---prisonerZ = Prisoner:getAbsCoorZ()
+prisonerX = Prisoner:getAbsCoorX()
+prisonerY = Prisoner:getAbsCoorY()
+prisonerZ = Prisoner:getAbsCoorZ()
+
+if dist( prisonerX,prisonerY,prisonerZ,161.76,49,358.87 ) < 60 then
+prisonerReachedLock = true
+end
 
 end
 
-function standUp(timestep)
+
+function goToCell(timestep)
 
 return false
@@ -49,11 +60,10 @@
 
 if not allOk then
-standing = standUp(timestep)
+cellReached = goToCell(timestep)
 end
 
-if standing and not guidePositionReached then
+if cellReached and not guidePositionReached then
 guidePositionReached = goToGuidePosition(timestep)
 end
-
 
 if guidePositionReached and prisonerReachedLock then
Index: /data/branches/single_player_map/worlds/sp_level_ambush_at_jupiter.oxw
===================================================================
--- /data/branches/single_player_map/worlds/sp_level_ambush_at_jupiter.oxw	(revision 3950)
+++ /data/branches/single_player_map/worlds/sp_level_ambush_at_jupiter.oxw	(revision 3951)
@@ -120,5 +120,4 @@
     </ScriptTrigger>
 
-
    </ScriptTriggers>
 
@@ -154,4 +153,21 @@
     </GenericNPC>
     
+
+    <GenericNPC>
+       <name>Prisoner</name>
+       <model>models/creatures/doom_guy.md2, 10</model>
+       <md2texture>doom_guy.png</md2texture>
+       <abs-coor>-69, 29, 74</abs-coor>
+       <abs-dir>-1.55, 0, 1, 0</abs-dir>
+    </GenericNPC>
+
+   <GenericNPC>
+       <name>Secondprisoner</name>
+       <model>models/creatures/doom_guy.md2, 10</model>
+       <md2texture>doom_guy.png</md2texture>
+       <abs-coor>22, 29,121</abs-coor>
+       <abs-dir>-1.55, 0, 1, 0</abs-dir>
+    </GenericNPC>
+
     <GenericNPC>
        <name>statist</name>
