home *** CD-ROM | disk | FTP | other *** search
/ Singles (French) / Singles-FrenchVersion-Win95.iso / data1.cab / Statemachine / questFriendship6.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("questFriendship6 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.         
  18.             local mike = getParent().getParent().getCharacter(MIKE);
  19.             local elaine = getParent().getParent().getCharacter(ELAINE);
  20.             
  21.             if ( -- condition here
  22.         ----------------
  23.                 min(    mike.getRelationshipCondition(ELAINE, REL_FRIENDSHIP),
  24.                     elaine.getRelationshipCondition(MIKE, REL_FRIENDSHIP)) >= 6
  25.             )
  26.             then
  27.  
  28.                 -- elaine alone in the living room
  29.                 local elaineRoom = elaine.getRoomNumber();
  30.                 local room = getParent(2).getApartment().getRoom(elaineRoom);
  31.                 
  32.                 if (
  33.                     room
  34.                     and mike.getRoomNumber() ~= elaineRoom
  35. --                    and room.getRoomTypeValue(Room.LIVINGROOM) > 0.3
  36.                 )
  37.         ----------------
  38.                 then
  39.                     
  40.                     -- elaine talks to herself
  41.                     sendDelayedMsg("epsilon", this, 3000, "questFriendship6");
  42.                     setState("monolog");
  43.                 end
  44.             end
  45.         end )
  46.         
  47. ---------------------------------------------------------------------------------------------------------------------------------------    
  48.     state("monolog")
  49.         onMsg("epsilon", function(msg) 
  50.             if ( msg.data == "questFriendship6" ) then
  51.                 popupConversation("dialogFriendship6");
  52.                 setState("done");
  53.             end
  54.         end )
  55.         
  56.         
  57.     state("done")
  58.     
  59.     -- sackgasse hier
  60.         
  61.         
  62.         
  63. endStateMachine()
  64.