home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles (French)
/
Singles-FrenchVersion-Win95.iso
/
data1.cab
/
Statemachine
/
questHoneymoon.lua
< prev
next >
Wrap
Text File
|
2004-03-05
|
8KB
|
269 lines
beginStateMachine()
-- called when questor builds up all known questScripts
onEnter(function(msg)
print("questMarriage entered");
setState("initial");
end )
-- on game over: relationship conditions get reset to 0 and all quests are reset to initial
onMsg("questreset", function(msg)
setState("initial");
end )
---------------------------------------------------------------------------------------------------------------------------------------
onDefault( function(msg)
print("++++++++++++ "..getState().. "got msg:" .. msg.name);
--setState("initial");
end )
-- on forced or failsafe-marry me-antrag ( see initgame.lua:canMarry() )
onMsg("queueInteraction", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
local elaine = getParent().getParent().getCharacter(ELAINE);
if (msg.data == "talkMarryMe") then -- adam muss das noch einbauen
--mike.cancelAllActivities();
--elaine.cancelAllActivities();
mike.pushCommand("pm_talkCutscene", "talkCutscene", elaine, "questHoneymoon");
setState("willYouMarryMe");
end
end )
state("initial")
onMsg("checkCondition", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
local elaine = getParent().getParent().getCharacter(ELAINE);
local friendship = min(mike.getRelationshipCondition(ELAINE, REL_FRIENDSHIP),
elaine.getRelationshipCondition(MIKE, REL_FRIENDSHIP));
local romantic = min(mike.getRelationshipCondition(ELAINE, REL_ROMANTIC),
elaine.getRelationshipCondition(MIKE, REL_ROMANTIC));
local erotic = min(mike.getRelationshipCondition(ELAINE, REL_EROTIC),
elaine.getRelationshipCondition(MIKE, REL_EROTIC));
if ( -- condition here
max(max(friendship, romantic), erotic) >= 10
and
min(min(friendship, romantic), erotic) >= 5
--and
--getParent()["questGottaWork"].getState() == "done"
)
then
setState("waitTillWorkingOut");
end
end )
state("waitTillWorkingOut")
onMsg("checkCondition", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
if ( mike.getAtWork() ) then
setState("waitTillWorkIsOut");
end
end )
state("waitTillWorkIsOut")
onMsg("checkCondition", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
if ( not mike.getAtWork() ) then
setState("weveGotMail");
end
end )
state("weveGotMail")
onMsg("checkCondition", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
local elaine = getParent().getParent().getCharacter(ELAINE);
if (mike.getAtHome() and elaine.getAtHome()) then
mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine, "questHoneymoon");
setState("talktome");
end
end )
state("talktome")
-- as soon as arrived - start dialog (interaction.talkCutscene sends talking)
onMsg("talking", function(msg)
if (msg.data == "questHoneymoon" ) then
popupConversation("dialogHoneymoonInParadise");
setState("donetalktome");
end
end )
-- if the talk was canceled before it started, queue it againe after a while
onMsg("talkingCancelled", function(msg)
if ( msg.data == "questHoneymoon" ) then
print("--------------------> talktome onMsg talkingCancelled " .. msg.data);
sendDelayedMsgThis("timeout", QUEST_REQUEUE_TIME)
talkingCancelled(ELAINE, "questHoneymoon"); -- notify passive
end
end )
onMsg("timeout", function(msg)
setState("weveGotMail");
end )
state("donetalktome")
-- last dialog box clicked away
onMsg("yes", function(msg)
-- cancel
local mike = getParent().getParent().getCharacter(MIKE);
local elaine = getParent().getParent().getCharacter(ELAINE);
mike.cancelCurrentActivity();
elaine.cancelCurrentActivity();
-- enable piemenu-marryme-here
setState("waitForMarriage");
end )
state("waitForMarriage")
onMsg("queueInteraction", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
local elaine = getParent().getParent().getCharacter(ELAINE);
if (msg.data == "talkMarryMe") then -- adam muss das noch einbauen
mike.cancelAllActivities();
elaine.cancelAllActivities();
mike.pushCommand("pm_talkCutscene", "talkCutscene", elaine, "questHoneymoon");
setState("willYouMarryMe");
end
end )
state("willYouMarryMe");
onMsg("talking", function(msg)
if ( msg.data == "questHoneymoon") then
popupConversation("dialogElainePleaseMarryMe");
setState("doneWillYouMarryMe");
end
end )
-- if the talk was canceled before it started, queue it againe after a while
onMsg("talkingCancelled", function(msg)
-- waitForMarriage waits itself for queueInteraction, no need to go to wait
talkingCancelled(ELAINE, "questHoneymoon"); -- notify passive
setState("waitForMarriage");
end )
state("doneWillYouMarryMe");
onMsg("yes", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
local elaine = getParent().getParent().getCharacter(ELAINE);
mike.cancelAllActivities();
elaine.cancelAllActivities();
local friendship = min(mike.getRelationshipCondition(ELAINE, REL_FRIENDSHIP),
elaine.getRelationshipCondition(MIKE, REL_FRIENDSHIP));
local romantic = min(mike.getRelationshipCondition(ELAINE, REL_ROMANTIC),
elaine.getRelationshipCondition(MIKE, REL_ROMANTIC));
local erotic = min(mike.getRelationshipCondition(ELAINE, REL_EROTIC),
elaine.getRelationshipCondition(MIKE, REL_EROTIC));
if ( -- condition here
min(min(friendship, romantic), erotic) >= 10
)
then
print("!!!!!!!!!!!!!!!! OK Heirate mich");
popupConversation("dialogElaineMarryMeNow");
setState("victory");
else
print("========================= nee, du:");
-- Wenn genug Romantik da ist
if romantic >= 10 then
print("!!! GENUG ROMANTIK");
-- .. und genug Freundschaft
if friendship >= 10 then
print("!!! GENUG FREUNDSCHAFT");
-- fehlt Erotik
popupConversation("dialogElaineMarryMeWithoutErotic");
else
print("!!! WENIG FREUNDSCHAFT");
-- ... nicht genug Freundschaft
-- aber genug Erotik
if erotic >= 10 then
print("!!! GENUG EROTIK");
-- fehlt Freundschaft
popupConversation("dialogElaineMarryMeWithoutFriendship");
else
print("!!! WENIG EROTIK");
-- fehlt Freundschaft und Erotik
popupConversation("dialogElaineMarryMeWithoutFriendshipErotic");
end
end
else
print("!!! WENIG ROMANTIK");
-- ... nicht genug Romantik
if friendship >= 10 then
print("!!! GENUG FREUNDSCHAFT");
-- .. aber genug Freundschaft
if erotic >= 10 then
print("!!! GENUG EROTIK");
-- und erotic, dann fehlt nur Romantik
popupConversation("dialogElaineMarryMeWithoutRomance");
else
print("!!! WENIG EROTIK");
popupConversation("dialogElaineMarryMeWithoutEroticRomance");
end
else
print("!!! WENIG FREUNDSCHAFT");
-- ... nicht genug Freundschaft
popupConversation("dialogElaineMarryMeWithoutRomanceFriendship");
end
end
setState("waitForMarriage");
end
end )
---------------------------------------------------------------------------------------------------------------------------------------
state("victory")
onMsg("yes", function(msg)
getParent().getParent().getCharacter(MIKE).cancelCurrentActivity();
getParent().getParent().getCharacter(ELAINE).cancelCurrentActivity();
writeConfig("Game", "cottageEnabled", "true");
-- popup marriage chapter
popupChapter("guiStoryChapterGroup4");
--############################################
------ ende - credits here
--############################################
-- disable questor
getParent().setState("done");
setState("done");
end )
state("done")
-- sackgasse hier
endStateMachine()