31
Technical forum / Re: background conversation demon - best practice?
« on: December 16, 2009, 10:35:42 PM »
(using WME 1.8.10 btw)
#include "scripts\base.inc"
on "StartDaemon"
{
Sleep(2000); // sleep for safely
TalkCycle();
}
method TalkCycle()
{
var TalkCount = 1;
while (GameState.AngryWatcherStage < 6) {
if (Scene.Name != "DoubleDep") // quit daemon if we're not in the scene.
return;
Sleep(1500);
// can we talk? if not wait until we can.
while (!CanTalk()) {
Sleep(2000);
}
// altrenate between the two characters's lines.
if (TalkCount % 2 == 0) {
//Watcher1.TurnTo(ClerkConvince);
Watcher1.TinyTalk("/DIALOG_DOUBLEDEP_TINYTALK_WATCHER1_CLERKCONVINCE_0" + TalkCount + "/MISSING TEXT DIALOG_DOUBLEDEP_TINYTALK_WATCHER1_CLERKCONVINCE_0" + TalkCount);
} else {
//ClerkConvince.TurnTo(Watcher1);
ClerkConvince.TinyTalk("/DIALOG_DOUBLEDEP_TINYTALK_CLERKCONVINCE_WATCHER1_0" + TalkCount + "/MISSING TEXT DIALOG_DOUBLEDEP_TINYTALK_CLERKCONVINCE_WATCHER1_0" + TalkCount);
}
if (TalkCount < 8) {
TalkCount = TalkCount + 1;
} else {
TalkCount = 1;
}
}
}
function CanTalk()
{
if (Scene.InConversation == true)
return false;
if (Game.Interactive != true)
return false;
if (Scene.Name != "DoubleDep")
return false;
if (actor != Watcher)
return false;
return true;
}
///////////////////////////////////////////////////////////////////////////////
if(!StateDoubleDep.Visited)
{
StateDoubleDep.Visited = true;
// this is our first visit in this scene...
global TurnCycleDaemon;
global TinyTalkConvDaemon;
if (TinyTalkConvDaemon == null)
TinyTalkConvDaemon = new Object("scenes\DoubleDep\scr\TinyTalkConvDaemon.script");
if (TinyTalkConvDaemon.CanHandleEvent("StartDaemon"))
TinyTalkConvDaemon.ApplyEvent("StartDaemon");
SCRIPT = "actors\Jackie\Jackie.script"
SHADOW_IMAGE = "actors\Jackie\shadow.png"
SHADOW_SIZE = 25.0
LIGHT_POSITION { -80, 500, -80 }
SHADOW_TYPE = "flat"
SHADOW_COLOR { 0, 0, 0, 128 }
...
...
;--- external data
MODEL = "actors\Jackie\Jackie6_cm_weld2.x"
SHADOW_MODEL = "actors\Jackie\Jackie_shadow.x"