mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-10-09 00:12:57 -04:00
89 lines
2.1 KiB
Plaintext
89 lines
2.1 KiB
Plaintext
include library.ai_lib;
|
|
include library.create;
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
obj_id commoner = spawnGuyOne( self );
|
|
obj_id commoner2 = spawnGuyTwo( self );
|
|
spawnDroid();
|
|
faceTo (commoner, commoner2);
|
|
messageTo( self, "handleChatting", null, 10.0f, false );
|
|
messageTo( self, "checkForScripts", null, 10, true );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
obj_id spawnGuyOne(obj_id baseObject)
|
|
{
|
|
location here = getLocation (baseObject);
|
|
here.x = here.x + 1;
|
|
obj_id commoner1 = create.object("commoner", here);
|
|
setObjVar( baseObject, "commoner1", commoner1);
|
|
ai_lib.setDefaultCalmBehavior( commoner1, ai_lib.BEHAVIOR_SENTINEL );
|
|
return commoner1;
|
|
}
|
|
obj_id spawnGuyTwo(obj_id baseObject)
|
|
{
|
|
location here = getLocation (baseObject);
|
|
here.x = here.x - 1;
|
|
obj_id commoner2 = create.object("commoner", here);
|
|
setObjVar( baseObject, "commoner2", commoner2 );
|
|
ai_lib.setDefaultCalmBehavior( commoner2, ai_lib.BEHAVIOR_SENTINEL );
|
|
return commoner2;
|
|
}
|
|
void spawnDroid()
|
|
{
|
|
location here = getLocation (getSelf());
|
|
here.z = here.z + 1;
|
|
string droidToSpawn = getRandomDroid();
|
|
obj_id droid = create.object (droidToSpawn, here);
|
|
ai_lib.setDefaultCalmBehavior( droid, ai_lib.BEHAVIOR_SENTINEL );
|
|
}
|
|
|
|
messageHandler handleDeadGuyOne()
|
|
{
|
|
spawnGuyOne( self );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handleDeadGuyTwo()
|
|
{
|
|
spawnGuyTwo( self );
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handleDeadDroid()
|
|
{
|
|
spawnDroid();
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler handleChatting()
|
|
{
|
|
messageTo( self, "handleChatting", null, 600, false );
|
|
obj_id commoner1 = getObjIdObjVar( self, "commoner1" );
|
|
obj_id commoner2 = getObjIdObjVar( self, "commoner2" );
|
|
if ( !exists( commoner1) || !exists(commoner2) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
faceTo (commoner1, commoner2);
|
|
faceTo (commoner2, commoner1);
|
|
setAnimationMood (commoner1, "conversation");
|
|
setAnimationMood (commoner2, "conversation");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
string getRandomDroid()
|
|
{
|
|
int dnum = rand( 2,5 );
|
|
string droid = "r"+dnum;
|
|
return droid;
|
|
}
|
|
|
|
messageHandler checkForScripts()
|
|
{
|
|
if (hasScript (self, "theme_park.poi.launch"))
|
|
{
|
|
detachScript (self, "theme_park.poi.launch");
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
} |