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

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questMarriage 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.     --onDefault( function(msg)
  16.         --print("~~~~~~~~~~ questMarriage: "..getState());
  17.     --end )
  18.     
  19.     state("initial") 
  20.         onMsg("checkCondition", function(msg)
  21.             -- check if questTroubleTheEnda has already started
  22.             if getParent().questTroubleTheEnda.getState() ~= "initial" then
  23.                 setState("done");
  24.             end
  25.  
  26.             local mike = getParent().getParent().getCharacter(MIKE);
  27.             local elaine = getParent().getParent().getCharacter(ELAINE);
  28.  
  29.             local friendship = min(mike.getRelationshipCondition(ELAINE, REL_FRIENDSHIP),
  30.                 elaine.getRelationshipCondition(MIKE, REL_FRIENDSHIP));
  31.             local romantic = min(mike.getRelationshipCondition(ELAINE, REL_ROMANTIC),
  32.                 elaine.getRelationshipCondition(MIKE, REL_ROMANTIC));
  33.             local erotic = min(mike.getRelationshipCondition(ELAINE, REL_EROTIC),
  34.                 elaine.getRelationshipCondition(MIKE, REL_EROTIC));
  35.  
  36.             if ( -- condition here
  37.                 min(min(friendship, romantic), erotic) >= 10
  38. --                and    getParent()["questFriendship10"].getState() == "done"
  39. --                and    getParent()["questRomance10"].getState() == "done"
  40. --                and    getParent()["questErotic10"].getState() == "done"
  41.             )
  42.             then
  43.                 -- cancel all quests that got stuck
  44.                 --getParent().sendMsgThis("cancelQuest");
  45.                 
  46.                 setState("okDelayQuestion");
  47.             end
  48.         end )
  49.  
  50.  
  51.     state("okDelayQuestion")
  52.         onEnter( function(msg)
  53.             --print(";;;;;;;;;;;;;;;;;;;;; marryMeRpg");
  54.             sendDelayedMsgThis("goAskHer", 60*1000);
  55.             --setDelayedState("talktome", 60*1000);
  56.         end )
  57.  
  58.         onMsg( "goAskHer", function(msg)
  59.             local mike = getParent().getParent().getCharacter(MIKE);
  60.             local elaine = getParent().getParent().getCharacter(ELAINE);
  61.  
  62.             -- go to talk position
  63.             mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine, "questMarriage");
  64.             setState("talktome");
  65.         end )
  66.         
  67.     state("talktome")
  68.  
  69.         -- as soon as arrived - start dialog (interaction.talkCutscene sends talking)
  70.         onMsg("talking", function(msg)
  71.             if (msg.data == "questMarriage") then
  72.                 popupConversation("dialogMarriage");
  73.                 setState("donetalktome");
  74.             end 
  75.         end )
  76.         
  77.     state("donetalktome");
  78.         -- last dialog box clicked away
  79.         onMsg("yes", function(msg)
  80.             -- cancel
  81.             local mike = getParent().getParent().getCharacter(MIKE);
  82.             local elaine = getParent().getParent().getCharacter(ELAINE);
  83.  
  84.             mike.cancelAllActivities(); --mike.cancelCurrentActivity();
  85.             elaine.cancelAllActivities(); --elaine.cancelCurrentActivity();
  86.             
  87.             setState("talktome2");
  88.             
  89.             
  90.             mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine, "questMarriage");            
  91.             elaine.queueCommand("pm_kissSexy", "kiss", mike, "Sexy", false, true);
  92.             
  93.             --mike.pushCommand("pm_kissSexy", "kiss", elaine, "Sexy" );
  94.             
  95.             --mike.queueCommand("pm_kissSexy", "kiss", elaine, "Sexy");
  96.             --mike.pushCommand("pm_talkCutscene", "talkCutscene", elaine, "");
  97.             
  98.             --mike.pushCommand("pm_kissIntimate", "kiss", elaine, "Intimate");            
  99.             
  100.         end )
  101.         
  102.     state("talktome2")
  103.         onMsg("talking", function(msg)
  104.             if (msg.data == "questMarriage") then
  105.                 popupConversation("dialogMarriage2");
  106.                 setState("donetalktome2");
  107.             end 
  108.         end )
  109.         
  110.     state("donetalktome2");
  111.         onMsg("yes", function(msg)
  112.             getParent().getParent().getCharacter(MIKE).cancelCurrentActivity();
  113.             getParent().getParent().getCharacter(ELAINE).cancelCurrentActivity();
  114.             setState("done");
  115.         end )
  116.     
  117. ---------------------------------------------------------------------------------------------------------------------------------------    
  118.  
  119.             
  120.     state("done")
  121. --        onEnter(function(msg)
  122.             --popupChapter("guiStoryChapterGroup4");
  123. --        end )         
  124.     
  125.     -- sackgasse hier
  126.         
  127.         
  128.         
  129. endStateMachine()
  130.