home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles (French)
/
Singles-FrenchVersion-Win95.iso
/
data1.cab
/
Statemachine
/
questFriendship3.lua
< prev
next >
Wrap
Text File
|
2004-03-05
|
5KB
|
158 lines
beginStateMachine()
-- called when questor builds up all known questScripts
onEnter(function(msg)
print("questFriendship3 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 )
---------------------------------------------------------------------------------------------------------------------------------------
onMsg("checkCondition", function(msg)
--print("********************** "..getState());
--setState("initial");
end )
state("initial")
onMsg("checkCondition", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
local elaine = getParent().getParent().getCharacter(ELAINE);
if ( -- condition here
min( mike.getRelationshipCondition(ELAINE, REL_FRIENDSHIP),
elaine.getRelationshipCondition(MIKE, REL_FRIENDSHIP)) >= 3 ) then
--print("********** ok scharfgestellt");
setState("scharf");
end
end )
state("scharf")
onMsg("checkCondition", function(msg)
--~ local mike = getParent().getParent().getCharacter(MIKE);
--~ local mikeIsSleeping = mike.getSleeping();
--~
--~ if ( not mikeIsSleeping and mikeHasBeenSleeping ) then
--~ --print("********** mike hat gepennt");
--~ setState("gutenMorgenMike");
--~ else
--~ mikeHasBeenSleeping = mikeIsSleeping;
--~ end
--~
--~ local elaine = getParent().getParent().getCharacter(ELAINE);
--~ local elaineIsSleeping = elaine.getSleeping();
--~ if ( not elaineIsSleeping and elaineHasBeenSleeping ) then
--~ --print("********** elaine hat gepennt");
--~ setState("gutenMorgenElaine");
--~ else
--~ elaineHasBeenSleeping = elaineIsSleeping;
--~ end
local gameObjectServer = getParent().getParent();
local gameDate = gameObjectServer.getGameDate()
if (gameDate.getHours() > 4 and gameDate.getHours() < 12) then
local mike = gameObjectServer.getCharacter(MIKE);
local elaine = gameObjectServer.getCharacter(ELAINE);
if (not mike.isBusy() and not elaine.isBusy()) then
local mikeHadBreakfast = mike.hasRecentActivityName("eatBreakfast");
local elaineHadBreakfast = elaine.hasRecentActivityName("eatBreakfast");
if (not mikeHadBreakfast and not elaineHadBreakfast) then
local mikeIsSleeping = mike.getSleeping();
local mikeHasBeenSleeping = mike.hasRecentActivityName("sleep");
if ( not mikeIsSleeping and mikeHasBeenSleeping) then
setState("gutenMorgenMike");
end
local elaineIsSleeping = elaine.getSleeping();
local elaineHasBeenSleeping = elaine.hasRecentActivityName("sleep")
if ( not elaineIsSleeping and elaineHasBeenSleeping) then
setState("gutenMorgenElaine");
end
end
end
end
end )
state("gutenMorgenMike")
onMsg("checkCondition", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
local elaine = getParent().getParent().getCharacter(ELAINE);
if (mike.getRoomNumber() == elaine.getRoomNumber()) then
mike.queueCommand("pm_talkCutscene", "talkCutscene", elaine , "questFriendship3");
setState("gutGeschlafenMike");
end
end )
state("gutGeschlafenMike")
onMsg("talking", function(msg)
if ( msg.data == "questFriendship3" ) then
--print("ASLDJKASDALSKJDKASJD");
popupConversation("dialogFriendship3Mike");
setState("doneGutGeschlafenMike");
end
end )
state("doneGutGeschlafenMike")
onMsg("yes", function( msg )
getParent().getParent().getCharacter(MIKE).cancelCurrentActivity();
getParent().getParent().getCharacter(ELAINE).cancelCurrentActivity();
setState("done");
end )
state("gutenMorgenElaine")
onMsg("checkCondition", function(msg)
local mike = getParent().getParent().getCharacter(MIKE);
local elaine = getParent().getParent().getCharacter(ELAINE);
if (mike.getRoomNumber() == elaine.getRoomNumber()) then
elaine.queueCommand("pm_talkCutscene", "talkCutscene", mike, "questFriendship3");
setState("gutGeschlafenElaine");
end
end )
state("gutGeschlafenElaine")
onMsg("talking", function(msg)
if (msg.data == "questFriendship3") then
popupConversation("dialogFriendship3Elaine");
setState("doneGutGeschlafenElaine");
end
end )
state("doneGutGeschlafenElaine")
onMsg("yes", function( msg )
getParent().getParent().getCharacter(MIKE).cancelCurrentActivity();
getParent().getParent().getCharacter(ELAINE).cancelCurrentActivity();
setState("done");
end )
---------------------------------------------------------------------------------------------------------------------------------------
state("done")
-- sackgasse hier
endStateMachine()