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

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questRomance2 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("checkCondition", function(msg)
  17.             -- check if questErotic2 has already started
  18.             --if getParent().questErotic2.getState() ~= "initial" then
  19.             --    setState("done");
  20.             --end
  21.  
  22.             local mike = getParent().getParent().getCharacter(MIKE);
  23.             local elaine = getParent().getParent().getCharacter(ELAINE);
  24.  
  25.             if ( -- condition here
  26.         ----------------
  27.                 min(    mike.getRelationshipCondition(ELAINE, REL_ROMANTIC),
  28.                     elaine.getRelationshipCondition(MIKE, REL_ROMANTIC)) >= 2)
  29.         ----------------
  30.             then
  31.                 -- wait for mike going to bed
  32. print("questRomance2 - go to waitBed");
  33.                 setState("waitBed");
  34.             end
  35.         end )
  36.         
  37.     state("waitBed")
  38.         -- wait for elaine going to bed
  39.  
  40.         onMsg("queueInteraction", function(msg)
  41. --print("questRomance2 - queueInteraction: " .. msg.data);
  42.             local mike = getParent().getParent().getCharacter(MIKE);
  43.             local elaine = getParent().getParent().getCharacter(ELAINE);
  44.             
  45.             if msg.data == "sleep" and getStateObjectFromID(msg.sender) == elaine then
  46.                 -- go to talk position
  47.                 elaine.pushCommand("pm_talkCutscene", "talkCutscene", mike, "questRomance2");
  48.                 setState("talktome");
  49.             end
  50.         end )
  51.  
  52.     state("talktome")
  53.         -- as soon as arrived - start dialog (interaction.talkCutscene sends talking)
  54.         onMsg("talking", function(msg)
  55.             if (msg.data == "questRomance2") then
  56.                 popupConversation("dialogRomance2");
  57.                 setState("donetalktome");
  58.             end 
  59.         end )
  60.     
  61.     state("donetalktome");
  62.         -- last dialog box clicked away
  63.         onMsg("yes", function(msg)
  64.             -- cancel
  65.             local mike = getParent().getParent().getCharacter(MIKE);
  66.             local elaine = getParent().getParent().getCharacter(ELAINE);
  67.  
  68.             mike.cancelCurrentActivity();
  69.             elaine.cancelCurrentActivity();
  70.             setState("done");
  71.         end )
  72.         
  73. ---------------------------------------------------------------------------------------------------------------------------------------    
  74.  
  75.         
  76.     state("done")
  77.     
  78.     -- sackgasse hier
  79.         
  80.         
  81.         
  82. endStateMachine()
  83.