Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/kusak.script
T

1001 lines
26 KiB
Plaintext

// ======================================================================
//
// kusak.script
// Copyright 2004, Sony Online Entertainment
// All Rights Reserved.
//
// Created with SwgConversationEditor 1.37 - DO NOT EDIT THIS AUTO-GENERATED FILE!
//
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.ai_lib;
include library.chat;
include library.conversation;
include library.utils;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/kusak";
// ======================================================================
// Script Conditions
// ======================================================================
boolean kusak_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeed (obj_id player, obj_id npc)
{
if(hasObjVar(npc, "alreadyFed"))
return false;
if(!hasObjVar(npc, "kusak"))
return false;
int kusakNum = getIntObjVar(npc, "kusak");
if(kusakNum < 0 || kusakNum > 10)
return false;
string collectionSlot = "icon_nyms_kusak_feeding_"+kusakNum;
if(hasCompletedCollectionSlot(player, collectionSlot))
{
LOG("kusak","hasWeed player has slot");
return false;
}
for(int i=0;i < ALL_WEED_TEMPLATES.length; i++)
{
obj_id object = utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[i]);
if(isValidId(object))
{
return true;
}
}
return false;
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType1 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[0]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_01");
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType10 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[9]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_10");
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType9 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[8]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_09");
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType8 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[7]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_08");
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType7 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[6]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_07");
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType6 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[5]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_06");
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType4 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[3]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_04");
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType3 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[2]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_03");
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType2 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[1]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_02");
}
// ----------------------------------------------------------------------
boolean kusak_condition_hasWeedType5 (obj_id player, obj_id npc)
{
return isValidId(utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[4]))
&& hasCompletedCollectionSlot(player, "icon_nyms_duty_05");
}
// ======================================================================
// Script Actions
// ======================================================================
void kusak_action_validateWeedOne (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedOne init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedOne no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE01)
{
LOG("kusak","validateWeedOne type not "+WEEDTYPE01);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[0]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_validateWeedTen (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedTen init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedTen no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE10)
{
LOG("kusak","validateWeedTen type not "+WEEDTYPE10);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[9]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_validateWeedNine (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedNine init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedNine no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE09)
{
LOG("kusak","validateWeedNine type not "+WEEDTYPE09);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[8]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_validateWeedEight (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedEight init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedEight no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE08)
{
LOG("kusak","validateWeedEight type not "+WEEDTYPE08);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[7]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_validateWeedSeven (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedSeven init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedSeven no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE07)
{
LOG("kusak","validateWeedSeven type not "+WEEDTYPE07);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[6]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_validateWeedSix (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedSix init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedSix no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE06)
{
LOG("kusak","validateWeedSix type not "+WEEDTYPE06);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[5]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_validateWeedFive (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedFive init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedFive no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE05)
{
LOG("kusak","validateWeedFive type not "+WEEDTYPE05);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[4]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_validateWeedFour (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedFour init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedFour no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE04)
{
LOG("kusak","validateWeedFour type not "+WEEDTYPE04);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[3]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_validateWeedThree (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedThree init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedThree no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE03)
{
LOG("kusak","validateWeedThree type not "+WEEDTYPE03);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[2]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_validateWeedTwo (obj_id player, obj_id npc)
{
LOG("kusak","validateWeedTwo init");
if(!hasObjVar(npc, "weed_type"))
{
LOG("kusak","validateWeedTwo no var");
doAnimationAction(npc, "trick_1");
return;
}
int weedType = getIntObjVar(npc, "weed_type");
if(weedType != WEEDTYPE02)
{
LOG("kusak","validateWeedTwo type not "+WEEDTYPE02);
doAnimationAction(npc, "ashamed");
return;
}
setObjVar(npc, "weedObj", utils.getItemByTemplateInInventoryOrEquipped(player, ALL_WEED_TEMPLATES[1]));
kusak_action_awardPlayer(player, npc);
}
// ----------------------------------------------------------------------
void kusak_action_awardPlayer (obj_id player, obj_id npc)
{
if(!hasObjVar(npc, "kusak"))
{
return;
}
int kusakNum = getIntObjVar(npc, "kusak");
if(kusakNum < 0 || kusakNum > 10)
{
return;
}
if(!hasObjVar(npc, "weedObj"))
{
return;
}
obj_id weedObj = getObjIdObjVar(npc, "weedObj");
if(!isValidId(weedObj) || !exists(weedObj))
{
return;
}
string collectionSlot = "icon_nyms_kusak_feeding_"+kusakNum;
if(!hasCompletedCollectionSlot(player, collectionSlot))
{
if(modifyCollectionSlotValue(player, collectionSlot, 1))
{
decrementCount(weedObj);
string trickName = "trick_"+rand(1,2);
doAnimationAction(npc, trickName);
messageTo(npc, "destroySelf", null, 5, false);
setObjVar(npc, "alreadyFed", 1);
}
}
}
// ======================================================================
// Script %TO Tokens
// ======================================================================
// ======================================================================
// Script %DI Tokens
// ======================================================================
// ======================================================================
// Script %DF Tokens
// ======================================================================
// ======================================================================
// handleBranch<n> Functions
// ======================================================================
int kusak_handleBranch1 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: [Sniff's at your backpack]
//-- [RESPONSE NOTE]
//-- PLAYER: You want something?
if (response == "s_6")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
//-- NPC: Gruff!
string_id message = new string_id (c_stringFile, "s_19");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Feed Weed Type I
boolean hasResponse0 = false;
if (kusak_condition_hasWeedType1 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Feed Weed Type II
boolean hasResponse1 = false;
if (kusak_condition_hasWeedType2 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: Feed Weed Type III
boolean hasResponse2 = false;
if (kusak_condition_hasWeedType3 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
//-- PLAYER: Feed Weed Type IV
boolean hasResponse3 = false;
if (kusak_condition_hasWeedType4 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse3 = true;
}
//-- PLAYER: Feed Weed Type V
boolean hasResponse4 = false;
if (kusak_condition_hasWeedType5 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse4 = true;
}
//-- PLAYER: Feed Weed Type VI
boolean hasResponse5 = false;
if (kusak_condition_hasWeedType6 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse5 = true;
}
//-- PLAYER: Feed Weed Type VII
boolean hasResponse6 = false;
if (kusak_condition_hasWeedType7 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse6 = true;
}
//-- PLAYER: Feed Weed Type VIII
boolean hasResponse7 = false;
if (kusak_condition_hasWeedType8 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse7 = true;
}
//-- PLAYER: Feed Weed Type IX
boolean hasResponse8 = false;
if (kusak_condition_hasWeedType9 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse8 = true;
}
//-- PLAYER: Feed Weed Type X
boolean hasResponse9 = false;
if (kusak_condition_hasWeedType10 (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse9 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_20");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_21");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_22");
if (hasResponse3)
responses [responseIndex++] = new string_id (c_stringFile, "s_23");
if (hasResponse4)
responses [responseIndex++] = new string_id (c_stringFile, "s_24");
if (hasResponse5)
responses [responseIndex++] = new string_id (c_stringFile, "s_25");
if (hasResponse6)
responses [responseIndex++] = new string_id (c_stringFile, "s_28");
if (hasResponse7)
responses [responseIndex++] = new string_id (c_stringFile, "s_38");
if (hasResponse8)
responses [responseIndex++] = new string_id (c_stringFile, "s_42");
if (hasResponse9)
responses [responseIndex++] = new string_id (c_stringFile, "s_46");
utils.setScriptVar (player, "conversation.kusak.branchId", 2);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
int kusak_handleBranch2 (obj_id player, obj_id npc, string_id response)
{
//-- [BRANCH NOTE]
//-- NPC: Gruff!
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type I
if (response == "s_20")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedOne (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_30");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type II
if (response == "s_21")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedTwo (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_31");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type III
if (response == "s_22")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedThree (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_32");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type IV
if (response == "s_23")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedFour (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_33");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type V
if (response == "s_24")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedFive (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_34");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type VI
if (response == "s_25")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedSix (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_35");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type VII
if (response == "s_28")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedSeven (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_36");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type VIII
if (response == "s_38")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedEight (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_40");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type IX
if (response == "s_42")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedNine (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_44");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
//-- [RESPONSE NOTE]
//-- PLAYER: Feed Weed Type X
if (response == "s_46")
{
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
kusak_action_validateWeedTen (player, npc);
//-- NPC: Grrrrruff!
string_id message = new string_id (c_stringFile, "s_48");
utils.removeScriptVar (player, "conversation.kusak.branchId");
npcEndConversationWithMessage (player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
// ----------------------------------------------------------------------
// ======================================================================
// User Script Triggers
// ======================================================================
const string[] ALL_WEED_TEMPLATES =
{
"object/tangible/collection/col_nym_weed_01.iff",
"object/tangible/collection/col_nym_weed_02.iff",
"object/tangible/collection/col_nym_weed_03.iff",
"object/tangible/collection/col_nym_weed_04.iff",
"object/tangible/collection/col_nym_weed_05.iff",
"object/tangible/collection/col_nym_weed_06.iff",
"object/tangible/collection/col_nym_weed_07.iff",
"object/tangible/collection/col_nym_weed_08.iff",
"object/tangible/collection/col_nym_weed_09.iff",
"object/tangible/collection/col_nym_weed_10.iff"
};
const int WEEDTYPE01 = 1;
const int WEEDTYPE02 = 2;
const int WEEDTYPE03 = 3;
const int WEEDTYPE04 = 4;
const int WEEDTYPE05 = 5;
const int WEEDTYPE06 = 6;
const int WEEDTYPE07 = 7;
const int WEEDTYPE08 = 8;
const int WEEDTYPE09 = 9;
const int WEEDTYPE10 = 10;
trigger OnInitialize ()
{
if ((!isTangible (self)) || (isPlayer (self)))
detachScript(self, "conversation.kusak");
setCondition (self, CONDITION_CONVERSABLE);
return SCRIPT_CONTINUE;
}
trigger OnAttach ()
{
setCondition (self, CONDITION_CONVERSABLE);
messageTo(self, "setupWeedVar", null, 3, false);
return SCRIPT_CONTINUE;
}
trigger OnObjectMenuRequest (obj_id player, menu_info menuInfo)
{
int menu = menuInfo.addRootMenu (menu_info_types.CONVERSE_START, null);
menu_info_data menuInfoData = menuInfo.getMenuItemById (menu);
menuInfoData.setServerNotify (false);
setCondition (self, CONDITION_CONVERSABLE);
return SCRIPT_CONTINUE;
}
trigger OnIncapacitated (obj_id killer)
{
clearCondition (self, CONDITION_CONVERSABLE);
detachScript (self, "conversation.kusak");
return SCRIPT_CONTINUE;
}
messageHandler setupWeedVar()
{
if(!isValidId(self) || !exists(self))
return SCRIPT_CONTINUE;
setObjVar(self, "weed_type", rand(1,10));
return SCRIPT_CONTINUE;
}
messageHandler destroySelf()
{
if(!isValidId(self) || !exists(self))
return SCRIPT_CONTINUE;
//This is for the spawner script on the kusak!!
setObjVar(self, "respawnAfterDestroy", 1);
destroyObject(self);
return SCRIPT_CONTINUE;
}
// ======================================================================
// Script Triggers
// ======================================================================
//-- This function should move to base_class.java
boolean npcStartConversation(obj_id player, obj_id npc, string convoName, string_id greetingId, prose_package greetingProse, string_id[] responses)
{
Object[] objects = new Object[responses.length];
System.arraycopy(responses, 0, objects, 0, responses.length);
return npcStartConversation(player, npc, convoName, greetingId, greetingProse, objects);
}
// ----------------------------------------------------------------------
trigger OnStartNpcConversation (obj_id player)
{
obj_id npc = self;
if (ai_lib.isInCombat (npc) || ai_lib.isInCombat (player))
return SCRIPT_OVERRIDE;
//-- [NOTE]
if (kusak_condition_hasWeed (player, npc))
{
//-- NPC: [Sniff's at your backpack]
string_id message = new string_id (c_stringFile, "s_4");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: You want something?
boolean hasResponse0 = false;
if (kusak_condition__defaultCondition (player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_6");
utils.setScriptVar (player, "conversation.kusak.branchId", 1);
npcStartConversation (player, npc, "kusak", message, responses);
}
else
{
chat.chat (npc, player, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (kusak_condition__defaultCondition (player, npc))
{
//-- NPC: Grrrr!
string_id message = new string_id (c_stringFile, "s_50");
chat.chat (npc, player, message);
return SCRIPT_CONTINUE;
}
chat.chat (npc, "Error: All conditions for OnStartNpcConversation were false.");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnNpcConversationResponse (string conversationId, obj_id player, string_id response)
{
if (conversationId != "kusak")
return SCRIPT_CONTINUE;
obj_id npc = self;
int branchId = utils.getIntScriptVar (player, "conversation.kusak.branchId");
if (branchId == 1 && kusak_handleBranch1 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
if (branchId == 2 && kusak_handleBranch2 (player, npc, response) == SCRIPT_CONTINUE)
return SCRIPT_CONTINUE;
chat.chat (npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar (player, "conversation.kusak.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================