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

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questRomance1 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 questErotic1 has already started
  18.             --if getParent().questErotic1.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)) >= 1)
  29.         ----------------
  30.             then
  31.                 -- go to talk position
  32. print("questRomance1 - go to talk position");
  33.                 elaine.queueCommand("pm_talkCutscene", "talkCutscene", mike, "questRomance1");
  34.                 setState("talktome");
  35.             end
  36.         end )
  37.         
  38.     state("talktome")
  39.         -- as soon as arrived - start dialog (interaction.talkCutscene sends talking)
  40.         onMsg("talking", function(msg)
  41.             if (msg.data == "questRomance1") then
  42.                 popupConversation("dialogRomance1");
  43.                 setState("donetalktome");
  44.             end
  45.         end )
  46.         
  47.     state("donetalktome");        
  48.         -- last dialog box clicked away
  49.         onMsg("yes", function(msg)
  50.             -- cancel
  51.             local mike = getParent().getParent().getCharacter(MIKE);
  52.             local elaine = getParent().getParent().getCharacter(ELAINE);
  53.  
  54.             mike.cancelCurrentActivity();
  55.             elaine.cancelCurrentActivity();
  56.             setState("done");
  57.         end )
  58.         
  59. ---------------------------------------------------------------------------------------------------------------------------------------    
  60.  
  61.         
  62.     state("done")
  63.         
  64.     -- sackgasse hier
  65.         
  66.         
  67.         
  68. endStateMachine()
  69.