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

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