mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
606 lines
18 KiB
Plaintext
606 lines
18 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// sean_questp_house.script
|
|
// Copyright 2003, Sony Online Entertainment
|
|
//
|
|
//
|
|
// 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_questp_house";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean sean_questp_house_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questp_house_condition_CampObj (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.electionStarted") )
|
|
{
|
|
int electionNum = getIntObjVar(npc, "bestine.electionStarted");
|
|
if ( hasObjVar(player, "bestine.campaign" ) )
|
|
{
|
|
int electionPlayerIsIn = getIntObjVar(player, "bestine.campaign");
|
|
if ( electionPlayerIsIn >= electionNum)
|
|
{
|
|
if ( !hasObjVar(player, "bestine.sean_house_noroom") )
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questp_house_condition_HouseTesti (obj_id player, obj_id npc)
|
|
{
|
|
string HTESTIMONY = "object/tangible/loot/quest/sean_questp_htestimony.iff";
|
|
if (isIdValid(player))
|
|
{
|
|
obj_id playerInv = getObjectInSlot( player, "inventory" );
|
|
if(isIdValid(playerInv))
|
|
{
|
|
obj_id item = createObject( HTESTIMONY, playerInv, "" );
|
|
if(isIdValid(item))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questp_house_condition_noroomObjVar (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(npc, "bestine.electionStarted") )
|
|
{
|
|
int electionNum = getIntObjVar(npc, "bestine.electionStarted");
|
|
if ( hasObjVar(player, "bestine.campaign" ) )
|
|
{
|
|
int electionPlayerIsIn = getIntObjVar(player, "bestine.campaign");
|
|
if ( electionPlayerIsIn >= electionNum)
|
|
{
|
|
if ( hasObjVar(player, "bestine.sean_house_noroom") )
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questp_house_condition_nonoffice (obj_id player, obj_id npc)
|
|
{
|
|
return hasObjVar(npc, "bestine.electionEnded");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questp_house_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;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean sean_questp_house_condition_alreadyHasEvidence (obj_id player, obj_id npc)
|
|
{
|
|
return utils.playerHasItemByTemplate(player, "object/tangible/loot/quest/sean_questp_htestimony.iff");
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void sean_questp_house_action__defaultAction (obj_id player, obj_id npc)
|
|
{
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void sean_questp_house_action_NoRoom (obj_id player, obj_id npc)
|
|
{
|
|
int electionNum = getIntObjVar(npc, "bestine.electionStarted");
|
|
setObjVar( player, "bestine.bestine.sean_house_noroom", electionNum);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void sean_questp_house_action_giveTestimony (obj_id player, obj_id npc)
|
|
{
|
|
if ( hasObjVar(player, "bestine.sean_house_noroom") )
|
|
{
|
|
removeObjVar(player, "bestine.sean_house_noroom");
|
|
}
|
|
|
|
string HTESTIMONY = "object/tangible/loot/quest/sean_questp_htestimony.iff";
|
|
if (isIdValid(player))
|
|
{
|
|
obj_id playerInv = getObjectInSlot( player, "inventory" );
|
|
if(isIdValid(playerInv))
|
|
{
|
|
obj_id item = createObject( HTESTIMONY, playerInv, "" );
|
|
if(isIdValid(item))
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "npc.conversation.sean_questp_house");
|
|
|
|
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_questp_house");
|
|
|
|
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_questp_house_condition_nonoffice (player, self))
|
|
{
|
|
//-- NPC: I'm so busy. Sean is planning to run for the new election that will happen soon. He's going to have tons of people over for dinner in hopes of impressing them. I really must get back to work. I'm sorry.
|
|
string_id message = new string_id (c_stringFile, "s_2267c63c");
|
|
chat.chat (self, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition_alreadyHasEvidence (player, self))
|
|
{
|
|
//-- NPC: Oh hello! I'm surprised to see you again so soon. Please be sure to sure to show the governor the testimony I wrote for you. I want her to know what a kind and generous person Sean is.
|
|
string_id message = new string_id (c_stringFile, "s_41f6594d");
|
|
chat.chat (self, message);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition_noroomObjVar (player, self))
|
|
{
|
|
//-- NPC: I'm glad you're back. Do you have enough room now?
|
|
string_id message = new string_id (c_stringFile, "s_20b8d563");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yes. Thank you.
|
|
boolean hasResponse0 = false;
|
|
if (sean_questp_house_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: Actually, no I don't.
|
|
boolean hasResponse1 = false;
|
|
if (sean_questp_house_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_e69937da");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_48b343d3");
|
|
|
|
setObjVar (player, "conversation.sean_questp_house.branchId", 3);
|
|
|
|
npcStartConversation (player, self, "sean_questp_house", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (self, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition_CampObj (player, self))
|
|
{
|
|
//-- NPC: Oh my! I didn't expect visitors today! This place is a complete mess! Please forgive me. The last of the tragedy victims left. They all found new homes. I'm just cleaning up. Why are you here?
|
|
string_id message = new string_id (c_stringFile, "s_f6effab8");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: What victims?
|
|
boolean hasResponse0 = false;
|
|
if (sean_questp_house_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I'm in the wrong house. Sorry!
|
|
boolean hasResponse1 = false;
|
|
if (sean_questp_house_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_34f710c5");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_51c40792");
|
|
|
|
setObjVar (player, "conversation.sean_questp_house.branchId", 7);
|
|
|
|
npcStartConversation (player, self, "sean_questp_house", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (self, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: Hello! Are you here to discuss the election? You haven't heard about it? You should really go to the capitol. The governor is taking votes.
|
|
string_id message = new string_id (c_stringFile, "s_d066eb10");
|
|
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_questp_house")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
int branchId = getIntObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I'm glad you're back. Do you have enough room now?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yes. Thank you.
|
|
if (branchId == 3 && response == "s_e69937da")
|
|
{
|
|
//-- [NOTE]
|
|
if (!sean_questp_house_condition_noInventorySpace (player, self))
|
|
{
|
|
sean_questp_house_action_giveTestimony (player, self);
|
|
|
|
//-- NPC: Here you are, then. I hope you have a wonderful day.
|
|
string_id message = new string_id (c_stringFile, "s_9e4a0794");
|
|
removeObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition_noInventorySpace (player, self))
|
|
{
|
|
//-- NPC: You still don't have enough room. Come back when you do. I'd be happy to give it to you then.
|
|
string_id message = new string_id (c_stringFile, "s_bd542a54");
|
|
removeObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'I'm glad you're back. Do you have enough room now?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: I'm glad you're back. Do you have enough room now?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Actually, no I don't.
|
|
if (branchId == 3 && response == "s_48b343d3")
|
|
{
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: Well, return when you do. I'll be happy to give it to you then.
|
|
string_id message = new string_id (c_stringFile, "s_d6d23166");
|
|
removeObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'I'm glad you're back. Do you have enough room now?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Oh my! I didn't expect visitors today! This place is a complete mess! Please forgive me. The last of the tragedy victims left. They all found new homes. I'm just cleaning up. Why are you here?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: What victims?
|
|
if (branchId == 7 && response == "s_34f710c5")
|
|
{
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: Oh, you didn't hear? The Empire went on a rampage and destroyed one of the newer, smaller cities assumed to harbor Rebel operatives. Those poor people. Sean Trenwell opened his homes for the survivors. He's such a kind man.
|
|
string_id message = new string_id (c_stringFile, "s_8a9c6889");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Really? Can you help me with something?
|
|
boolean hasResponse0 = false;
|
|
if (sean_questp_house_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_ab4c4ff8");
|
|
|
|
setObjVar (player, "conversation.sean_questp_house.branchId", 8);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
removeObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Oh my! I didn't expect visitors today! This place is a complete mess! Please forgive me. The last of the tragedy victims left. They all found new homes. I'm just cleaning up. Why are you here?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Oh my! I didn't expect visitors today! This place is a complete mess! Please forgive me. The last of the tragedy victims left. They all found new homes. I'm just cleaning up. Why are you here?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I'm in the wrong house. Sorry!
|
|
if (branchId == 7 && response == "s_51c40792")
|
|
{
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: Come back any time. You're always welcome in the Trenwell house.
|
|
string_id message = new string_id (c_stringFile, "s_d5702a3b");
|
|
removeObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Oh my! I didn't expect visitors today! This place is a complete mess! Please forgive me. The last of the tragedy victims left. They all found new homes. I'm just cleaning up. Why are you here?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Oh, you didn't hear? The Empire went on a rampage and destroyed one of the newer, smaller cities assumed to harbor Rebel operatives. Those poor people. Sean Trenwell opened his homes for the survivors. He's such a kind man.
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Really? Can you help me with something?
|
|
if (branchId == 8 && response == "s_ab4c4ff8")
|
|
{
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: Sure, I can try. What do you need? Write a testimony? Of course, I will! Anything to help him with this election. I really hope he wins. He deserves it. Let me write it up..
|
|
string_id message = new string_id (c_stringFile, "s_43e36f6f");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Okay.
|
|
boolean hasResponse0 = false;
|
|
if (sean_questp_house_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_67e6df55");
|
|
|
|
setObjVar (player, "conversation.sean_questp_house.branchId", 9);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
removeObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Oh, you didn't hear? The Empire went on a rampage and destroyed one of the newer, smaller cities assumed to harbor Rebel operatives. Those poor people. Sean Trenwell opened his homes for the survivors. He's such a kind man.' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Sure, I can try. What do you need? Write a testimony? Of course, I will! Anything to help him with this election. I really hope he wins. He deserves it. Let me write it up..
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Okay.
|
|
if (branchId == 9 && response == "s_67e6df55")
|
|
{
|
|
//-- [NOTE]
|
|
if (!sean_questp_house_condition_noInventorySpace (player, self))
|
|
{
|
|
sean_questp_house_action_giveTestimony (player, self);
|
|
|
|
//-- NPC: Here you are. Please let me know if you'd like to come over for dinner sometime. I'm a great cook! Have a great day!
|
|
string_id message = new string_id (c_stringFile, "s_47e61b76");
|
|
removeObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (sean_questp_house_condition_noInventorySpace (player, self))
|
|
{
|
|
sean_questp_house_action_NoRoom (player, self);
|
|
|
|
//-- NPC: Here you are--Oh no! You don't have enough room. I'm sorry. Please come back when you do.
|
|
string_id message = new string_id (c_stringFile, "s_198905a5");
|
|
removeObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Sure, I can try. What do you need? Write a testimony? Of course, I will! Anything to help him with this election. I really hope he wins. He deserves it. Let me write it up..' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
removeObjVar (player, "conversation.sean_questp_house.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|