Files
dsrc/sku.0/sys.server/compiled/game/script/event/ewok_festival/chief.script
T

74 lines
1.8 KiB
Plaintext

/**
* Title: Love Day Valentines Ewok Chief
* Description: Have Chief give gift when he hears specific phrase.
*/
/***** INCLUDES ********************************************************/
include library.groundquests;
include library.static_item;
include library.utils;
/***** CONSTANTS *******************************************************/
const string_id GIVE_GIFT = new string_id("spam", "ewok_chief_give_gift");
const string_id HAVE_GIFT = new string_id("spam", "ewok_chief_have_gift");
//update these every year
//const string OBJ_BOUQUET = "item_event_flower_02_01"; 2008 flowers
const string OBJ_BOUQUET_QUEST = "loveday_flowers_2010";
trigger OnAttach()
{
messageTo(self, "handleChiefInitialize", null, 9, false);
return SCRIPT_CONTINUE;
}
messageHandler handleChiefInitialize()
{
location here = getLocation(self);
if ( !here.area.equals("naboo") )
{
setName(self, "an Ewok chieftain");
}
return SCRIPT_CONTINUE;
}
trigger OnHearSpeech(obj_id speaker, string text)
{
float distance = utils.getDistance2D(self, speaker);
if( distance > 10f )
{
return SCRIPT_CONTINUE;
}
if( toLower(text).equals("allayloo ta nuv") )
{
obj_id speakerTarget = getIntendedTarget(speaker);
if( speakerTarget == self )
{
if( groundquests.hasCompletedQuest(speaker, OBJ_BOUQUET_QUEST) )
{
sendSystemMessage(speaker, HAVE_GIFT);
doAnimationAction(self, "explain");
return SCRIPT_CONTINUE;
}
//give the bouquet
doAnimationAction(self, "bow");
//obj_id inv = utils.getInventoryContainer(speaker);
//obj_id bouquet = static_item.createNewItemFunction(OBJ_BOUQUET, inv);
groundquests.requestGrantQuest(speaker, OBJ_BOUQUET_QUEST);
sendSystemMessage(speaker, GIVE_GIFT);
return SCRIPT_CONTINUE;
}
doAnimationAction(self, "celebrate");
}
return SCRIPT_CONTINUE;
}