mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -04:00
45 lines
965 B
Plaintext
45 lines
965 B
Plaintext
include library.ai_lib;
|
|
include library.hue;
|
|
include library.colors;
|
|
include library.chat;
|
|
|
|
const string CONVO = "static_npc/philosopher";
|
|
|
|
trigger OnAttach ()
|
|
{
|
|
ai_lib.setDefaultCalmBehavior( self, ai_lib.BEHAVIOR_SENTINEL );
|
|
attachScript(self, "npc.converse.npc_converse_menu");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnStartNpcConversation (obj_id speaker)
|
|
{
|
|
string lineToSay = "philosopher_1";
|
|
string datatable = "datatables/npc/convo/philosopher.iff";
|
|
|
|
if (ai_lib.isInCombat(self) || ai_lib.isInCombat(speaker))
|
|
{
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
int numLines = dataTableGetNumRows (datatable);
|
|
|
|
if (numLines == 0)
|
|
{
|
|
numLines = rand(1,5);
|
|
lineToSay = "philosopher_" + numLines;
|
|
}
|
|
else
|
|
{
|
|
int total = numLines - 1;
|
|
int pickLine = rand(0, total);
|
|
lineToSay = dataTableGetString (datatable, pickLine, "philosopher_lines");
|
|
|
|
}
|
|
|
|
string_id message = new string_id (CONVO, lineToSay);
|
|
chat.chat (self, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|