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

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