mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
549 lines
17 KiB
Plaintext
549 lines
17 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// sean_questn_university.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.chat;
|
|
include library.utils;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/sean_questn_university";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean sean_questn_university_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questn_university_condition_NegQObj (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.electionStarted") )
|
|
{
|
|
int electionNum = getIntObjVar(npc, "bestine.electionStarted");
|
|
if ( hasObjVar(player, "bestine.negquests" ) )
|
|
{
|
|
int electionPlayerIsIn = getIntObjVar(player, "bestine.negquests");
|
|
if ( electionPlayerIsIn >= electionNum)
|
|
{
|
|
if ( !hasObjVar(player, "bestine.sean_university_noroom") )
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questn_university_condition_alreadyHasEvidence (obj_id player, obj_id npc)
|
|
{
|
|
return utils.playerHasItemByTemplate(player, "object/tangible/loot/quest/sean_questn_gpapers.iff");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questn_university_condition_NoRoom1Obj (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.electionStarted") )
|
|
{
|
|
int electionNum = getIntObjVar(npc, "bestine.electionStarted");
|
|
if ( hasObjVar(player, "bestine.negquests" ) )
|
|
{
|
|
int electionPlayerIsIn = getIntObjVar(player, "bestine.negquests");
|
|
if ( electionPlayerIsIn >= electionNum)
|
|
{
|
|
if ( hasObjVar(player, "bestine.sean_university_noroom") )
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questn_university_condition_nonoffice (obj_id player, obj_id npc)
|
|
{
|
|
return hasObjVar(npc, "bestine.electionEnded");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questn_university_condition_noInventorySpace (obj_id player, obj_id npc)
|
|
{
|
|
boolean hasNoInvRoom = false;
|
|
obj_id playerInv = utils.getInventoryContainer(player);
|
|
if ( isIdValid(playerInv) )
|
|
{
|
|
int free_space = getVolumeFree(playerInv);
|
|
if (free_space < 1 )
|
|
{
|
|
hasNoInvRoom = true;
|
|
}
|
|
}
|
|
return hasNoInvRoom;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void sean_questn_university_action__defaultAction (obj_id player, obj_id npc)
|
|
{
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void sean_questn_university_action_NoRoom1 (obj_id player, obj_id npc)
|
|
{
|
|
int electionNum = getIntObjVar(npc, "bestine.electionStarted");
|
|
setObjVar( player, "bestine.sean_university_noroom", electionNum);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void sean_questn_university_action_givePapers (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(player, "bestine.sean_university_noroom") )
|
|
{
|
|
removeObjVar(player, "bestine.sean_university_noroom");
|
|
}
|
|
|
|
string GPAPERS = "object/tangible/loot/quest/sean_questn_gpapers.iff";
|
|
if (isIdValid(player))
|
|
{
|
|
obj_id playerInv = getObjectInSlot( player, "inventory" );
|
|
if(isIdValid(playerInv))
|
|
{
|
|
obj_id item = createObject( GPAPERS, playerInv, "" );
|
|
if(isIdValid(item))
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "npc.conversation.sean_questn_university");
|
|
|
|
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.sean_questn_university");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnStartNpcConversation (obj_id player)
|
|
{
|
|
if (ai_lib.isInCombat (self) || ai_lib.isInCombat (player))
|
|
return SCRIPT_OVERRIDE;
|
|
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition_nonoffice (player, self))
|
|
{
|
|
//-- NPC: I hope you've gone to school. We could really use more... educated folks nowadays.
|
|
string_id message = new string_id (c_stringFile, "s_9c880546");
|
|
chat.chat (self, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition_alreadyHasEvidence (player, self))
|
|
{
|
|
//-- NPC: You again. I'm still quite busy, and I see you still have those papers I gave you from Mr. Trenwell's school days. How's this... you leave me to my work, and I won't ask for those back?
|
|
string_id message = new string_id (c_stringFile, "s_70145cf1");
|
|
chat.chat (self, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition_NoRoom1Obj (player, self))
|
|
{
|
|
//-- NPC: I see that you've returned. Do you have enough room now?
|
|
string_id message = new string_id (c_stringFile, "s_656e8f97");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes, can I have the evidence, please?
|
|
boolean hasResponse0 = false;
|
|
if (sean_questn_university_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Not yet. I still need to make room.
|
|
boolean hasResponse1 = false;
|
|
if (sean_questn_university_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_7e78bf8f");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_7291fe2e");
|
|
|
|
setObjVar (player, "conversation.sean_questn_university.branchId", 3);
|
|
|
|
npcStartConversation (player, self, "sean_questn_university", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (self, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition_NegQObj (player, self))
|
|
{
|
|
//-- NPC: I'm in the middle of grading papers. Did you need help with something?
|
|
string_id message = new string_id (c_stringFile, "s_5788afea");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: I was told to talk to you about Sean Trenwell.
|
|
boolean hasResponse0 = false;
|
|
if (sean_questn_university_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_36904010");
|
|
|
|
setObjVar (player, "conversation.sean_questn_university.branchId", 7);
|
|
|
|
npcStartConversation (player, self, "sean_questn_university", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (self, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: I'm too busy to talk right now. I'm grading papers. You seem like you'd be interested in voting at the capitol. They're holding an election.
|
|
string_id message = new string_id (c_stringFile, "s_3c4a2f4");
|
|
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 != "sean_questn_university")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
int branchId = getIntObjVar (player, "conversation.sean_questn_university.branchId");
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I see that you've returned. Do you have enough room now?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes, can I have the evidence, please?
|
|
if (branchId == 3 && response == "s_7e78bf8f")
|
|
{
|
|
//-- [NOTE]
|
|
if (!sean_questn_university_condition_noInventorySpace (player, self))
|
|
{
|
|
sean_questn_university_action_givePapers (player, self);
|
|
|
|
//-- NPC: Of course. Here you are.
|
|
string_id message = new string_id (c_stringFile, "s_dcf7aa7a");
|
|
removeObjVar (player, "conversation.sean_questn_university.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition_noInventorySpace (player, self))
|
|
{
|
|
//-- NPC: Again, you still don't have enough room. Come back when you do.
|
|
string_id message = new string_id (c_stringFile, "s_99711fbf");
|
|
removeObjVar (player, "conversation.sean_questn_university.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'I see that you've returned. Do you have enough room now?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I see that you've returned. Do you have enough room now?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Not yet. I still need to make room.
|
|
if (branchId == 3 && response == "s_7291fe2e")
|
|
{
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: I see. I guess there's no hurry... just come back you have more space.
|
|
string_id message = new string_id (c_stringFile, "s_b8a92f09");
|
|
removeObjVar (player, "conversation.sean_questn_university.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'I see that you've returned. Do you have enough room now?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I'm in the middle of grading papers. Did you need help with something?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I was told to talk to you about Sean Trenwell.
|
|
if (branchId == 7 && response == "s_36904010")
|
|
{
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: Sean Trenwell... oh yes! I remember him. Unfortunately, he was a particularly bad student. I would always catch him trying to cheat during exams. He barely graduated from the University. In fact, he could even be considered a fake. I really don't want him representing our people in this election.
|
|
string_id message = new string_id (c_stringFile, "s_7c259594");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Oh? I could really use your help...
|
|
boolean hasResponse0 = false;
|
|
if (sean_questn_university_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_5ec23736");
|
|
|
|
setObjVar (player, "conversation.sean_questn_university.branchId", 8);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
removeObjVar (player, "conversation.sean_questn_university.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'I'm in the middle of grading papers. Did you need help with something?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Sean Trenwell... oh yes! I remember him. Unfortunately, he was a particularly bad student. I would always catch him trying to cheat during exams. He barely graduated from the University. In fact, he could even be considered a fake. I really don't want him representing our people in this election.
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Oh? I could really use your help...
|
|
if (branchId == 8 && response == "s_5ec23736")
|
|
{
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: Mmhmm--Oh really? I actually have something that might help you. I think you could use it as evidence. Yes! Here it is. I always keep the grades of my students. Here you are.
|
|
string_id message = new string_id (c_stringFile, "s_799ad811");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Thank you.
|
|
boolean hasResponse0 = false;
|
|
if (sean_questn_university_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_b9b27823");
|
|
|
|
setObjVar (player, "conversation.sean_questn_university.branchId", 9);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
removeObjVar (player, "conversation.sean_questn_university.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Sean Trenwell... oh yes! I remember him. Unfortunately, he was a particularly bad student. I would always catch him trying to cheat during exams. He barely graduated from the University. In fact, he could even be considered a fake. I really don't want him representing our people in this election.' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Mmhmm--Oh really? I actually have something that might help you. I think you could use it as evidence. Yes! Here it is. I always keep the grades of my students. Here you are.
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Thank you.
|
|
if (branchId == 9 && response == "s_b9b27823")
|
|
{
|
|
//-- [NOTE]
|
|
if (!sean_questn_university_condition_noInventorySpace (player, self))
|
|
{
|
|
sean_questn_university_action_givePapers (player, self);
|
|
|
|
//-- NPC: Good day.
|
|
string_id message = new string_id (c_stringFile, "s_e656ba0c");
|
|
removeObjVar (player, "conversation.sean_questn_university.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questn_university_condition_noInventorySpace (player, self))
|
|
{
|
|
sean_questn_university_action_NoRoom1 (player, self);
|
|
|
|
//-- NPC: I see that you don't have enough room to get the evidence you seek. Please come back when you have room.
|
|
string_id message = new string_id (c_stringFile, "s_dac635d2");
|
|
removeObjVar (player, "conversation.sean_questn_university.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Mmhmm--Oh really? I actually have something that might help you. I think you could use it as evidence. Yes! Here it is. I always keep the grades of my students. Here you are.' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
removeObjVar (player, "conversation.sean_questn_university.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|