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

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questTrouble5b entered");
  6.         setState("initial");
  7.     end )
  8.     
  9.     -- debug mechanism, should be implemented properly such that a reset by questormessage is possible 
  10.     -- make sure that the initial condition wont be triggerd right away, maybe reset all prerequesites in order to prevent that
  11.     onMsg("questreset", function(msg)
  12.         getParent().getParent().getCharacter(MIKE).decRelationshipCondition(ELAINE, REL_TROUBLE,1);
  13.         getParent().getParent().getCharacter(ELAINE).decRelationshipCondition(MIKE, REL_TROUBLE,1);
  14.         setState("initial");
  15.     end ) 
  16. ---------------------------------------------------------------------------------------------------------------------------------------    
  17.     
  18.     state("initial") 
  19.         onMsg("checkCondition", function(msg)
  20.             local mike = getParent().getParent().getCharacter(MIKE);
  21.             local elaine = getParent().getParent().getCharacter(ELAINE);
  22.  
  23.             if ( mike.getRelationshipCondition(ELAINE, REL_TROUBLE) >= 5 )
  24.             then
  25.                 
  26.                 
  27.                 mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine, "questTrouble5b");
  28.                 setState("talktome");
  29.             end
  30.         end )
  31.         
  32.         
  33.     state("talktome")
  34.         -- assoon as arrived - start dialog
  35.         ----------------        
  36.         onMsg("talking", function(msg)
  37.             if (msg.data == "questTrouble5b" ) then 
  38.                 popupConversation("dialogTrouble5b");
  39.                 setState("donetalktome");
  40.             end
  41.         end )
  42.         
  43.     state("donetalktome");
  44.         onMsg("yes", function(msg)
  45.             getParent().getParent().getCharacter(MIKE).cancelCurrentActivity();
  46.             getParent().getParent().getCharacter(ELAINE).cancelCurrentActivity();
  47.             setState("done");
  48.         end )
  49.         
  50. ---------------------------------------------------------------------------------------------------------------------------------------    
  51.  
  52.         
  53.     state("done")
  54.     
  55.     -- sackgasse hier
  56.         
  57.         
  58.         
  59. endStateMachine()
  60.  
  61.  
  62.  
  63.  
  64.