FAQ Search
Memberlist Usergroups
  Forum Statistics Register
 Log in to check your private messages
Log in to check your private messages
Moonpod Homepage Starscape Information Mr. Robot Information Free Game Downloads Starscape Highscore Table
h1r1 - the first room
Post new topic   Reply to topic    Discussion Pod Forum Index -> User Adventures View previous topic :: View next topic  
Poo Bear
Pod Team
Pod Team

Joined: 14 Oct 2002
Posts: 4121
Location: Sheffield, UK

PostPosted: Thu Dec 20, 2007 9:59 am    Post subject: h1r1 - the first room Reply with quote

Here is the lua script for the first room in the game

Note - x = room width (left=0 to right), y = room height (bottom=0 to top), z = room length (front=0 to back). You can work out coordinates using the editor by selecting a single square tile and moving it around the room and reading off the coordinates displayed.


-- asimov is frozen, effect plays on his head, he wakes up, hel tells him to get to work,
-- player gets control

-- definitions - these are unchanging "names" for the different states this room can get in

-- globabls - these values will be set when we enter the room and then we'll change
-- them as things happen, if we leave the room and walk back in they'll reset to these values again
g_timer = 0
g_state = DOWNLOAD

--a function called sequence is always called if we're new to the room
--it will keep being called over and over while we are in the room
function sequence()

   if( g_state == DOWNLOAD ) then   
      --stop him and wait a tiny bit
      closeDoor( 0, true )  -- close the door straight away, do it instantly
      overrideAsimov( true ) -- stop the player moving around
      -- grab a dummy robot in the room and make it walk from xz1->xz2->xz3 and back again
      sendMessage( "h1r1dummy", "SYSTEM", "WANDER", "2,0,7,0,7,8" )
      g_state = INTRO_EFFECT -- switch to the next state next time this function runs
      g_timer = getTime()  -- setup a timer
   elseif( g_state == INTRO_EFFECT ) then
      if( not timerExpired( 500, g_timer ) ) then
         return false  -- wait around a bit, no rush
      --play an effect on his head
      Asimov = getDynamicObject( "PLAYER" ) -- grab the player object
      x, y, z = getDisplayPos( Asimov ) -- work out where it is
      y = y + 0.85 -- go above it slightly
      launchEffectSimple( x, y, z, "asimov_brain_download" ) -- play a little sparkly effect
      g_state = START_CONV
      g_timer = getTime()
   elseif( g_state == START_CONV ) then

      -- wait for the effect to finish      
      if( not timerExpired( 3000, g_timer ) ) then
         return false

      -- play a conversation
      name = "T01_asimov_wakeup"
      playConversation( name )   
      g_state = WAIT_CONV_FINISH

   elseif( g_state == WAIT_CONV_FINISH ) then

      -- when the conversation finishes release asimov      
      if( isConversationActive() ) then
         return false
      overrideAsimov( false )
      openDoor( 0, false )  -- open the door slowly
      return true

   return false

-- when sequence returns true the game remembers and then starts calling
-- completed instead, use this to keep things tidy after the room is finished with
function completed()

   if( g_state == DOWNLOAD ) then   -- remember our state variable will reset when we leave and come back
      -- getKeyVal and saveKeyVal are a way for scripts to save bits of text permanently
      -- and let other scripts check them later. In this case we are checking for some major event happening
      -- later in the game that means all the robots should have gone
      if( getKeyVal( "z1r17" ) == "main_objective" ) then
         sendMessage( "h1r1dummy", "SYSTEM", "DISABLE", "" ) -- stop that dummy robot doing stuff
         sendMessage( "h1r1dummy", "SYSTEM", "SHOW", "FALSE" ) -- make it vanish
         sendMessage( "h1r1dummy", "SYSTEM", "WANDER", "2,0,7,0,7,8" ) -- otherwise make sure it keeps wandering about
      openDoor( 0, true ) -- make sur ethe door stays open, do it fast
      -- put us into any other state just so we stop running this bit of code
      g_state = INTRO_EFFECT
   return true


Does this help anyone or just add to the confusion Smile
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Discussion Pod Forum Index -> User Adventures All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group