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

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questTroubleTheEnd 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 elaine.getRelationshipCondition(MIKE, REL_TROUBLE) >= 10
  21.             then
  22.                 -- she has trouble with him
  23.                 --elaine.cancelAllActivities();
  24.                 --mike.cancelAllActivities();
  25.                 
  26.                 elaine.queueCommand("pm_talkCutscene", "talkCutscene", mike, "questTroubleTheEnda");
  27.                 setState("talktome");
  28.             else
  29.             if mike.getRelationshipCondition(ELAINE, REL_TROUBLE) >= 10
  30.             then
  31.                 -- he has trouble with her
  32.                 mike.cancelAllActivities();
  33.                 elaine.cancelAllActivities();
  34.                 
  35.                 mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine, "questTroubleTheEnda");
  36.                 setState("talktome");
  37.             end
  38.             end
  39.  
  40.         end )
  41.         
  42.         
  43.     state("talktome")
  44.         -- assoon as arrived - start dialog
  45.         onMsg("talking", function(msg)
  46.             if (msg.data == "questTroubleTheEnda") then
  47.                 if msg.sender == getParent().getParent().getCharacter(ELAINE).getUniqueID() then
  48.                     popupConversation("dialogTroubleTheEnda");
  49.                 else
  50.                     popupConversation("dialogTroubleTheEndb");
  51.                 end
  52.                 setState("donetalktome");
  53.             end
  54.         end )
  55.         
  56.     state("donetalktome");
  57.         onMsg("yes", function(msg)
  58.             getParent().getParent().getCharacter(MIKE).cancelCurrentActivity();
  59.             getParent().getParent().getCharacter(ELAINE).cancelCurrentActivity();
  60.             setState("done");
  61.         end )
  62.         
  63. ---------------------------------------------------------------------------------------------------------------------------------------    
  64.  
  65.         
  66.     state("done")
  67.         onEnter(function(msg)
  68.             popupChapter("guiStoryChapterGroup3");
  69.             gameOver();
  70.         end )
  71.  
  72.     -- sackgasse hier
  73.         
  74.         
  75.         
  76. endStateMachine()
  77.