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

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questFriendship9 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_FRIENDSHIP),
  23.                     elaine.getRelationshipCondition(MIKE, REL_FRIENDSHIP)) >= 9)
  24.         ----------------
  25.             then
  26.                 -- elaine alone in the living room
  27.                 local mikeRoom = mike.getRoomNumber();
  28.                 local room = getParent(2).getApartment().getRoom(mikeRoom);
  29.                 if (
  30.                     room
  31.                     and elaine.getRoomNumber() ~= mikeRoom
  32. --                    and room.getRoomTypeValue(Room.LIVINGROOM) > 0.3
  33.                 )
  34.         ----------------
  35.                 then
  36.                     -- mike talks to himself
  37.                     sendDelayedMsg("epsilon", this, 2000, "");
  38.                     setState("monolog");
  39.                 end
  40.             end
  41.         end )
  42.     
  43.     
  44.     state("monolog")
  45.         onMsg("epsilon", function(msg) 
  46.             popupConversation("dialogFriendship9");
  47.             setState("done");
  48.         end )
  49.         
  50.         
  51. ---------------------------------------------------------------------------------------------------------------------------------------    
  52.  
  53.         
  54.     state("done")
  55.     
  56.     -- sackgasse hier
  57.         
  58.         
  59.         
  60. endStateMachine()
  61.