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

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questTrouble1 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.     
  16.     state("initial") 
  17.         onMsg("checkCondition", function(msg)
  18.             local mike = getParent().getParent().getCharacter(MIKE);
  19.             local elaine = getParent().getParent().getCharacter(ELAINE);
  20.  
  21.             
  22.             
  23.             if elaine.getRelationshipCondition(MIKE, REL_TROUBLE) >= 1
  24.             then
  25.                 elaine.queueCommand("pm_talkCutscene", "talkCutscene", mike, "questTrouble1a");
  26.                 setState("talktome");
  27.             else
  28.             if mike.getRelationshipCondition(ELAINE, REL_TROUBLE) >= 1
  29.             then
  30.                 mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine, "questTrouble1a");
  31.                 setState("talktome");
  32.             end
  33.             end
  34.         end )
  35.         
  36.         
  37.     state("talktome")
  38.         -- assoon as arrived - start dialog
  39.         onMsg("talking", function(msg)
  40.             if ( msg.data == "questTrouble1a" ) then
  41.                 if msg.sender == getParent().getParent().getCharacter(ELAINE).getUniqueID() then
  42.                     popupConversation("dialogTrouble1a");
  43.                 else
  44.                     popupConversation("dialogTrouble1b");
  45.                 end
  46.                 setState("donetalktome");
  47.             end
  48.         end )
  49.         
  50.         
  51.     state("donetalktome");
  52.         onMsg("yes", function(msg)
  53.             getParent().getParent().getCharacter(MIKE).cancelCurrentActivity();
  54.             getParent().getParent().getCharacter(ELAINE).cancelCurrentActivity();
  55.             setState("done");
  56.         end )
  57.         
  58. ---------------------------------------------------------------------------------------------------------------------------------------    
  59.  
  60.         
  61.     state("done")
  62.     
  63.     -- sackgasse hier
  64.         
  65.         
  66.         
  67. endStateMachine()
  68.