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

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questErotic6 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.     onMsg("checkCondition", function(msg)
  16. --        print( "##############"..getState() );
  17.         --setState("initial");
  18.     end )    
  19.  
  20. ---------------------------------------------------------------------------------------------------------------------------------------    
  21.     
  22.     state("initial") 
  23.         onMsg("checkCondition", function(msg)
  24.             local mike = getParent().getParent().getCharacter(MIKE);
  25.             local elaine = getParent().getParent().getCharacter(ELAINE);
  26.  
  27.             if ( -- condition here
  28.         ----------------
  29.                 min(    mike.getRelationshipCondition(ELAINE, REL_EROTIC),
  30.                     elaine.getRelationshipCondition(MIKE, REL_EROTIC) ) >= 6)
  31.         ----------------
  32.             then
  33.                 -- go to talk position
  34.                 setState("waitTrashDishes");
  35. --                print("#### ok warte auf den dreck");
  36.             end
  37.         end )
  38.         
  39.     state("waitTrashDishes")
  40.         onMsg("checkCondition", function(msg)
  41.             local mike = getParent().getParent().getCharacter(MIKE);
  42.             local elaine = getParent().getParent().getCharacter(ELAINE);
  43.             
  44.             local trashCans = mike.getObjectsWithBehavior("trashCan");
  45.             local sinks = mike.getObjectsWithBehavior("dishwasher");        
  46.             local table, actionPoint = getNextTableWithDishes(mike);
  47.             
  48.             if (trashCans and sinks and table) then
  49.                 if (trashCans[1] and sinks[1] and table) then
  50. --                    print("#### trashcans, sinks und volles table gefunden");
  51.                     
  52.                     local highestFillLevel = 0.0;
  53.                     for index, trashCan in trashCans do
  54.                         if ( trashCan.retrieveData("fillLevel") > highestFillLevel ) then
  55.                             highestFillLevel = tonumber(trashCan.retrieveData("fillLevel"));
  56.                             storeData("fullTrashCan", trashCan.getUniqueID() );
  57.                         end 
  58.                     end
  59.                     
  60. --                    print("#### trashlvl: "..highestFillLevel);
  61.                     
  62.                     storeData("sink", sinks[1].getUniqueID());
  63.                     
  64.                     if (highestFillLevel > 0.1) then
  65.                         mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine, "questErotic6").setUserCancel(false);
  66.  
  67.                         setState("talktome");
  68.                     end 
  69.                 end
  70.             end
  71.             
  72.         end )
  73.     
  74.     
  75.     state("talktome")
  76.         ----------------        
  77.         onMsg("talking", function(msg)
  78.             if ( msg.data == "questErotic6" ) then
  79.                 popupConversation("dialogErotic6");
  80.                 setState("fullfillYourPromises");
  81.             end
  82.         ----------------
  83.             
  84.         end )
  85.         
  86.  
  87.     
  88.     state("fullfillYourPromises")
  89.         
  90.         onMsg("yes", function(msg)
  91.             -- eigentlich nich abbrechbar. Prⁿfen / einbauen !!
  92.             local mike = getParent().getParent().getCharacter(MIKE);
  93.             local elaine = getParent().getParent().getCharacter(ELAINE);
  94.  
  95.             mike.cancelAllActivities();
  96.             elaine.cancelAllActivities();
  97.             
  98. --            print("######## ok auf gehts");            
  99.             mike.queueCommand("pm_washDishes","washDishes", getStateObjectFromID(tonumber(retrieveData("sink"))), "", false, true);
  100.             mike.queueCommand("pm_bringOutTrash","takeTrash", getStateObjectFromID(tonumber(retrieveData("fullTrashCan"))), "", false, true);
  101.         end )
  102.         
  103.         onMsg("checkCondition", function(msg)
  104. --            print("############# "..getState());
  105.             local elaine = getParent().getParent().getCharacter(ELAINE);
  106.             local mike = getParent().getParent().getCharacter(MIKE);
  107.             
  108.             local table, actionPoint = getNextTableWithDishes(mike);
  109.             
  110.             local trashCan = --retrieveData("fullTrashCan"); 
  111.                 mike.getObjectsWithBehavior("trashCan")[1];
  112.             
  113.             if (trashCan.retrieveData("fillLevel") <0.1 and (not table) ) then
  114.                 mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine, "dialogErotic6").setUserCancel(false);
  115.                 setState("elaineItsYourTurn");
  116.             end
  117.         end )
  118.         
  119.     state("elaineItsYourTurn")
  120.         onMsg("talking", function(msg)
  121.             if (msg.data == "dialogErotic6") then
  122.                 popupConversation("dialogErotic6ItsMyTurn");
  123.                 setState("binJaGespannt");
  124.             end
  125.             --popupConversation(
  126.             --    "Elaine:mimicFlirt1:Ok, jetzt muss ich wohl meinen Teil der Abmachung erfⁿllen;"..
  127.             --    "Mike:mimicSmile2:Na da bin ich aber gespannt;"..
  128.             --    "Elaine:mimicSmile3:Naja wenn ich was zum Staubsaugen finde und nicht zu mⁿde bin mach ich mich an die Arbeit. Pass blo▀ auf, dass du es nich verpasst;"
  129.             --);
  130.         end )
  131.         
  132.     state("binJaGespannt")    
  133.         onMsg("yes", function(msg)
  134.             local mike = getParent().getParent().getCharacter(MIKE);
  135.             local elaine = getParent().getParent().getCharacter(ELAINE);
  136.  
  137.             mike.cancelCurrentActivity();
  138.             elaine.cancelCurrentActivity();
  139.             
  140.             setState("okIllDoIt");
  141.         end )
  142.         
  143.     state("okIllDoIt")
  144.  
  145.     
  146.         onMsg("checkCondition", function(msg)            
  147. --            print("########### Elaine: ok its my turn");
  148.             local elaine = getParent().getParent().getCharacter(ELAINE);
  149.             local mike = getParent().getParent().getCharacter(MIKE);
  150.                                     
  151.             local actionPoint = elaine.getNextCleaningPoint(DIRT_DISTANCE);
  152.             if (actionPoint) then
  153. --                print("########## da ist sogar Dreck auf dem Boden");
  154.                 local hoovers = elaine.getObjectsWithBehavior("hoover");
  155.                 local kommodes = elaine.getObjectsWithBehavior("kommode");
  156.                 
  157.                 if ( hoovers[1] and kommodes[1] and elaine.getCondition(NEED_TIREDNESS)>0.4 ) then
  158. --                    print("########## ok losgehts");
  159.                     
  160.                     elaine.queueCommand("pm_talkCutscene", "talkCutscene", mike, "dialogErotic6").setUserCancel(false);
  161.                     setState("offWeGo");
  162.                 else
  163. --                    print("######## aber kein Staubsauger oder Kommode");
  164.                 end
  165.             end 
  166.             
  167.         end )
  168.         
  169.     state("offWeGo")
  170.         onMsg("talking", function(msg)
  171.             if (msg.data=="dialogErotic6") then
  172.                 popupConversation("dialogErotic6LetsDoIt");
  173.                 setState("doneOffWeGo");
  174.             end
  175.         end )
  176.         
  177.     state("doneOffWeGo")
  178.         onMsg("yes", function(msg)
  179.             local mike = getParent().getParent().getCharacter(MIKE);        
  180.             local elaine = getParent().getParent().getCharacter(ELAINE);
  181.             
  182.             elaine.cancelCurrentActivity();
  183.             mike.cancelCurrentActivity();
  184.             
  185.             
  186.             local hoovers = elaine.getObjectsWithBehavior("hoover");
  187.             local kommodes = elaine.getObjectsWithBehavior("kommode");
  188.             elaine.queueCommand("outfit_naked", "outfit", kommodes[1], "5").setUserCancel(false);
  189.             elaine.queueCommand("pm_cleanFloor","cleanFloor", hoovers[1], "", false, true).setUserCancel(false);
  190.             elaine.queueCommand("pm_talkCutscene", "talkCutscene", mike, "dialogErotic6").setUserCancel(false);
  191.             setState("epilog");            
  192.         end )
  193.         
  194. ---------------------------------------------------------------------------------------------------------------------------------------    
  195.  
  196.     state("epilog")
  197.         onMsg("talking", function(msg)
  198.             if (msg.data=="dialogErotic6") then 
  199.                 popupConversation("dialogErotic6Ending");
  200.                 setState("doneEpilog");
  201.             end
  202.             --popupConversation(
  203.             --    "Mike:mimicFlirt1:Mhhh, ich hΣtte nicht gedacht, dass du dich das traust.;"..
  204.             --    "Elaine:mimicSmile2:Ich stecke eben noch voller ⁿberraschungen.;"..
  205.             --    "Mike:mimicSmile4:Dafⁿr hast du dir eine Belohnung verdient...;");
  206.         end )
  207.         
  208.     state("doneEpilog")
  209.         onMsg("yes", function(msg)
  210.             -- eigentlich nich abbrechbar. Prⁿfen / einbauen !!
  211.             local mike = getParent().getParent().getCharacter(MIKE);
  212.             local elaine = getParent().getParent().getCharacter(ELAINE);
  213.  
  214.             mike.cancelCurrentActivity();
  215.             elaine.cancelCurrentActivity();
  216.             
  217.             
  218.             mike.queueCommand("pm_kissSexy", "kiss", elaine, "Sexy", false, true);--.setUserCancel(false);
  219.             
  220.             setState("done");
  221.         end ) 
  222.         
  223.     state("done")
  224.         onMsg("checkCondition", function(msg)
  225.         --    setState("initial");
  226.         end )
  227.     
  228.     -- sackgasse hier
  229. endStateMachine()
  230.  
  231.  
  232.  
  233.  
  234.