home *** CD-ROM | disk | FTP | other *** search
/ Singles (French) / Singles-FrenchVersion-Win95.iso / data1.cab / Statemachine / questGottaWork.lua < prev    next >
Text File  |  2004-03-05  |  2KB  |  74 lines

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questGottaWork entered");
  6.         setState("initial");
  7.     end )
  8.     
  9.     -- on game over: relationship conditions get reset to 0 and all quests are reset to initial
  10.     onMsg("questreset", function(msg)
  11.         setState("initial");
  12.     end ) 
  13. ---------------------------------------------------------------------------------------------------------------------------------------    
  14.  
  15.     state("initial") 
  16.         onMsg("queueInteraction", function(msg)
  17. print("questGottaWork - queueInteraction: " .. msg.data);
  18.             local mike = getParent().getParent().getCharacter(MIKE);
  19.             local elaine = getParent().getParent().getCharacter(ELAINE);
  20.             
  21.             if (msg.data == "work") then
  22.                 if (getStateObjectFromID(msg.sender) == mike) then
  23.                     
  24.                     -- go to talk position
  25.                     mike.pushCommand("pm_talkCutscene", "talkCutscene", elaine, "questGottaWork");
  26.                     
  27.                     setState("talktome");
  28.                 else
  29.                     
  30.                     -- go to talk position
  31.                     elaine.pushCommand("pm_talkCutscene", "talkCutscene", mike, "questGottaWork");
  32.                     setState("talktome");
  33.                 end
  34.             end
  35.         end )
  36.  
  37.     state("talktome")
  38.         -- assoon as arrived - start dialog
  39.         onMsg("talking", function(msg)
  40.             if ( msg.data == "questGottaWork") then
  41.                 if ( getStateObjectFromID(msg.sender).isMale() ) then
  42.                     popupConversation("dialogMikeGottaWork");
  43.                 else
  44.                     popupConversation("dialogLindaGottaWork");
  45.                 end
  46.                 setState("donetalktome");
  47.             end 
  48.         ----------------
  49.             --setState("done");
  50.         end )
  51.         
  52.     state("donetalktome");
  53.         -- last dialog box clicked away
  54.         onMsg("yes", function(msg)
  55.             -- cancel
  56.             local mike = getParent().getParent().getCharacter(MIKE);
  57.             local elaine = getParent().getParent().getCharacter(ELAINE);
  58.             
  59.             mike.cancelCurrentActivity();
  60.             elaine.cancelCurrentActivity();
  61.             setState("done");
  62.         end )
  63.         
  64. ---------------------------------------------------------------------------------------------------------------------------------------    
  65.  
  66.         
  67.     state("done")
  68.     
  69.     -- sackgasse hier
  70.         
  71.         
  72.         
  73. endStateMachine()
  74.