Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/sample.script
T
2013-09-10 23:17:15 -07:00

717 lines
19 KiB
Plaintext

// ======================================================================
//
// sample.script
// Copyright 2003, Sony Online Entertainment
// All Rights Reserved.
//
// DO NOT EDIT THIS AUTO-GENERATED FILE. PLEASE USE THE CONVERATION EDITOR!
//
// ======================================================================
// ======================================================================
// Library Includes
// ======================================================================
include library.ai_lib;
include library.anims;
include library.chat;
include library.cmd;
include library.colors;
include library.combat;
// ======================================================================
// Script Constants
// ======================================================================
string c_stringFile = "conversation/sample";
// ======================================================================
// Script Conditions
// ======================================================================
boolean sample_condition__defaultCondition (obj_id player, obj_id npc)
{
return true;
}
// ----------------------------------------------------------------------
boolean sample_condition_knowsPlayer (obj_id player, obj_id npc)
{
return getIntObjVar (player, "asommers_test.playerLevel") == 0;
}
// ----------------------------------------------------------------------
boolean sample_condition_likesPlayer (obj_id player, obj_id npc)
{
return getIntObjVar (player, "asommers_test.playerLevel") == 1;
}
// ----------------------------------------------------------------------
boolean sample_condition_dislikesPlayer (obj_id player, obj_id npc)
{
return getIntObjVar (player, "asommers_test.playerLevel") == 2;
}
// ======================================================================
// Script Actions
// ======================================================================
void sample_action__defaultAction (obj_id player, obj_id npc)
{
}
// ----------------------------------------------------------------------
void sample_action_cheer (obj_id player, obj_id npc)
{
setObjVar (player, "asommers_test.playerLevel", 1);
doAnimationAction (npc, anims.PLAYER_APPLAUSE_POLITE);
}
// ----------------------------------------------------------------------
void sample_action_greet (obj_id player, obj_id npc)
{
doAnimationAction (npc, anims.PLAYER_BOW2);
}
// ----------------------------------------------------------------------
void sample_action_clear (obj_id player, obj_id npc)
{
setObjVar (player, "asommers_test.playerLevel", 0);
}
// ----------------------------------------------------------------------
void sample_action_impress (obj_id player, obj_id npc)
{
setObjVar (player, "asommers_test.playerLevel", 1);
doAnimationAction (npc, anims.PLAYER_FLEX_BICEPS);
playMusic (player, "sound/music_event_danger.snd");
location loc = getLocation (npc);
if (loc != null)
playClientEffectLoc (player, "clienteffect/entertainer_color_lights_level_3.cef", loc, 0.f);
}
// ----------------------------------------------------------------------
void sample_action_shakeFist (obj_id player, obj_id npc)
{
doAnimationAction (npc, anims.PLAYER_GESTICULATE_WILDLY);
}
// ----------------------------------------------------------------------
void sample_action_scratchHead (obj_id player, obj_id npc)
{
doAnimationAction (npc, anims.PLAYER_SCRATCH_HEAD);
setObjVar (player, "asommers_test.playerLevel", 2);
}
// ======================================================================
// Script Triggers
// ======================================================================
trigger OnInitialize ()
{
if ((!isMob (self)) || (isPlayer (self)))
detachScript(self, "npc.conversation.sample");
setCondition (self, CONDITION_CONVERSABLE);
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnAttach ()
{
setCondition (self, CONDITION_CONVERSABLE);
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, "npc.conversation.sample");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnStartNpcConversation (obj_id player)
{
if (ai_lib.isInCombat (self) || ai_lib.isInCombat (player))
return SCRIPT_OVERRIDE;
//-- [NOTE]
if (sample_condition_knowsPlayer (player, self))
{
sample_action_greet (player, self);
//-- NPC: Hi there. I don't believe I know you!
string_id message = new string_id (c_stringFile, "s_a23c5071");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: You still don't.
boolean hasResponse0 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: Do you know any magic?
boolean hasResponse1 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_9f39d936");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_8516f9af");
setObjVar (player, "conversation.sample.branchId", 1);
npcStartConversation (player, self, "sample", message, responses);
}
else
{
chat.chat (self, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (sample_condition_likesPlayer (player, self))
{
//-- NPC: Welcome back! What would you like to see?
string_id message = new string_id (c_stringFile, "s_d3feb8e7");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: What do you have to show me?
boolean hasResponse0 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I'd like to see you go away!
boolean hasResponse1 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: DEBUG: Reset conversation
boolean hasResponse2 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_b6a01563");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_58132054");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_4a1f212c");
setObjVar (player, "conversation.sample.branchId", 4);
npcStartConversation (player, self, "sample", message, responses);
}
else
{
chat.chat (self, message);
}
return SCRIPT_CONTINUE;
}
//-- [NOTE]
if (sample_condition_dislikesPlayer (player, self))
{
//-- NPC: Why are you bothering me?
string_id message = new string_id (c_stringFile, "s_e5afcb3a");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: I just wanted to say that I'm really sorry.
boolean hasResponse0 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: I'm a sadist.
boolean hasResponse1 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
//-- PLAYER: DEBUG: Reset conversation
boolean hasResponse2 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse2 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_5c203407");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_59da9c5a");
if (hasResponse2)
responses [responseIndex++] = new string_id (c_stringFile, "s_4a1f212c");
setObjVar (player, "conversation.sample.branchId", 9);
npcStartConversation (player, self, "sample", message, responses);
}
else
{
chat.chat (self, message);
}
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnStartNpcConversation were false.");
return SCRIPT_CONTINUE;
}
// ----------------------------------------------------------------------
trigger OnNpcConversationResponse (string conversationId, obj_id player, string_id response)
{
if (conversationId != "sample")
return SCRIPT_CONTINUE;
int branchId = getIntObjVar (player, "conversation.sample.branchId");
//-- [BRANCH NOTE]
//-- NPC: Hi there. I don't believe I know you!
//-- [RESPONSE NOTE]
//-- PLAYER: You still don't.
if (branchId == 1 && response == "s_9f39d936")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
sample_action_scratchHead (player, self);
//-- NPC: Fine, go away.
string_id message = new string_id (c_stringFile, "s_d574fa56");
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Hi there. I don't believe I know you!' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Hi there. I don't believe I know you!
//-- [RESPONSE NOTE]
//-- PLAYER: Do you know any magic?
if (branchId == 1 && response == "s_8516f9af")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
sample_action_impress (player, self);
//-- NPC: Why, yes. Watch this!
string_id message = new string_id (c_stringFile, "s_27dd59b6");
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Hi there. I don't believe I know you!' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Welcome back! What would you like to see?
//-- [RESPONSE NOTE]
//-- PLAYER: What do you have to show me?
if (branchId == 4 && response == "s_b6a01563")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
//-- NPC: Well, I can only show you the first trick I have ever shown you.
string_id message = new string_id (c_stringFile, "s_5967ef4d");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Let's have it!
boolean hasResponse0 = false;
if (sample_condition__defaultCondition (player, self))
{
++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_2280847e");
setObjVar (player, "conversation.sample.branchId", 5);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
}
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Welcome back! What would you like to see?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Welcome back! What would you like to see?
//-- [RESPONSE NOTE]
//-- PLAYER: I'd like to see you go away!
if (branchId == 4 && response == "s_58132054")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
sample_action_scratchHead (player, self);
//-- NPC: No need to be mean -- I was here first.
string_id message = new string_id (c_stringFile, "s_ae4f086a");
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Welcome back! What would you like to see?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Welcome back! What would you like to see?
//-- [RESPONSE NOTE]
//-- PLAYER: DEBUG: Reset conversation
if (branchId == 4 && response == "s_4a1f212c")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
sample_action_clear (player, self);
//-- NPC: Done.
string_id message = new string_id (c_stringFile, "s_551ee684");
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Welcome back! What would you like to see?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Well, I can only show you the first trick I have ever shown you.
//-- [RESPONSE NOTE]
//-- PLAYER: Let's have it!
if (branchId == 5 && response == "s_2280847e")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
sample_action_impress (player, self);
//-- NPC: Voila!
string_id message = new string_id (c_stringFile, "s_33ee1807");
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Well, I can only show you the first trick I have ever shown you.' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Why are you bothering me?
//-- [RESPONSE NOTE]
//-- PLAYER: I just wanted to say that I'm really sorry.
if (branchId == 9 && response == "s_5c203407")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
//-- NPC: Do you mean it?
string_id message = new string_id (c_stringFile, "s_3f9aded7");
int numberOfResponses = 0;
boolean hasResponse = false;
//-- PLAYER: Yes!
boolean hasResponse0 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
//-- PLAYER: No! Sucker! Ha-ha-ha!
boolean hasResponse1 = false;
if (sample_condition__defaultCondition (player, self))
{
++numberOfResponses;
hasResponse = true;
hasResponse1 = true;
}
if (hasResponse)
{
int responseIndex = 0;
string_id responses [] = new string_id [numberOfResponses];
if (hasResponse0)
responses [responseIndex++] = new string_id (c_stringFile, "s_ef420789");
if (hasResponse1)
responses [responseIndex++] = new string_id (c_stringFile, "s_bc51d16b");
setObjVar (player, "conversation.sample.branchId", 10);
npcSpeak (player, message);
npcSetConversationResponses (player, responses);
}
else
{
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
}
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Why are you bothering me?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Why are you bothering me?
//-- [RESPONSE NOTE]
//-- PLAYER: I'm a sadist.
if (branchId == 9 && response == "s_59da9c5a")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
sample_action_scratchHead (player, self);
//-- NPC: No, you're a dork.
string_id message = new string_id (c_stringFile, "s_914765d8");
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Why are you bothering me?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Why are you bothering me?
//-- [RESPONSE NOTE]
//-- PLAYER: DEBUG: Reset conversation
if (branchId == 9 && response == "s_4a1f212c")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
sample_action_clear (player, self);
//-- NPC: Done.
string_id message = new string_id (c_stringFile, "s_551ee684");
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Why are you bothering me?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Do you mean it?
//-- [RESPONSE NOTE]
//-- PLAYER: Yes!
if (branchId == 10 && response == "s_ef420789")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
sample_action_cheer (player, self);
//-- NPC: Ok. Come back later and I'll show you something cool.
string_id message = new string_id (c_stringFile, "s_b75b171f");
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Do you mean it?' were false.");
return SCRIPT_CONTINUE;
}
//-- [BRANCH NOTE]
//-- NPC: Do you mean it?
//-- [RESPONSE NOTE]
//-- PLAYER: No! Sucker! Ha-ha-ha!
if (branchId == 10 && response == "s_bc51d16b")
{
//-- [NOTE]
if (sample_condition__defaultCondition (player, self))
{
sample_action_shakeFist (player, self);
//-- NPC: Why you...
string_id message = new string_id (c_stringFile, "s_629c5d0b");
removeObjVar (player, "conversation.sample.branchId");
npcSpeak (player, message);
npcEndConversation (player);
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Do you mean it?' were false.");
return SCRIPT_CONTINUE;
}
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
removeObjVar (player, "conversation.sample.branchId");
return SCRIPT_CONTINUE;
}
// ======================================================================