mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
552 lines
16 KiB
Plaintext
552 lines
16 KiB
Plaintext
// ======================================================================
|
|
//
|
|
// destroysample.script
|
|
//
|
|
//
|
|
//
|
|
// DO NOT EDIT THIS AUTO-GENERATED FILE. PLEASE USE THE CONVERATION EDITOR!
|
|
//
|
|
// ======================================================================
|
|
|
|
// ======================================================================
|
|
// Library Includes
|
|
// ======================================================================
|
|
|
|
include library.ai_lib;
|
|
include library.chat;
|
|
include library.money;
|
|
include library.space_quest;
|
|
|
|
// ======================================================================
|
|
// Script Constants
|
|
// ======================================================================
|
|
|
|
string c_stringFile = "conversation/destroysample";
|
|
|
|
// ======================================================================
|
|
// Script Conditions
|
|
// ======================================================================
|
|
|
|
boolean destroysample_condition__defaultCondition (obj_id player, obj_id npc)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean destroysample_condition_completedQuest (obj_id player, obj_id npc)
|
|
{
|
|
// Return true if we've finished the quest and we won.
|
|
if ( space_quest.hasCompletedQuest( player, "destroy", "sampleDestroy" ) &&
|
|
space_quest.hasWonQuest( player, "destroy", "sampleDestroy" ) )
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean destroysample_condition_onQuest (obj_id player, obj_id npc)
|
|
{
|
|
// Return true if we have the quest or have finished the quest.
|
|
if ( space_quest.hasQuest( player, "destroy", "sampleDestroy" ) ||
|
|
space_quest.hasCompletedQuest( player, "destroy", "sampleDestroy" ) )
|
|
return true;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
boolean destroysample_condition_alreadyRewarded (obj_id player, obj_id npc)
|
|
{
|
|
return space_quest.hasReceivedReward( player, "destroy", "sampleDestroy" );
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Actions
|
|
// ======================================================================
|
|
|
|
void destroysample_action__defaultAction (obj_id player, obj_id npc)
|
|
{
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void destroysample_action_anim_greet (obj_id player, obj_id npc)
|
|
{
|
|
faceToBehavior( npc, player );
|
|
doAnimationAction ( npc, "greet");
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void destroysample_action_anim_converse (obj_id player, obj_id npc)
|
|
{
|
|
doAnimationAction ( npc, "conversation_1" );
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void destroysample_action_anim_checkwatch (obj_id player, obj_id npc)
|
|
{
|
|
doAnimationAction ( npc, "check_wrist_device" );
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void destroysample_action_giveQuest (obj_id player, obj_id npc)
|
|
{
|
|
space_quest.grantQuest( player, "destroy", "sampleDestroy" );
|
|
doAnimationAction ( npc, "standing_raise_fist" );
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void destroysample_action_rewardPlayer (obj_id player, obj_id npc)
|
|
{
|
|
doAnimationAction ( npc, "celebrate" );
|
|
|
|
// Give the player some credits.
|
|
// Probably need a reward system for this.
|
|
money.bankTo( money.ACCT_REBEL, player, 3000 );
|
|
|
|
// Mark the player as having received a reward for this quest.
|
|
space_quest.setQuestRewarded( player, "destroy", "sampleDestroy" );
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void destroysample_action_anim_shakeheaddisgust (obj_id player, obj_id npc)
|
|
{
|
|
doAnimationAction ( npc, "shake_head_disgust" );
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void destroysample_action_anim_wave (obj_id player, obj_id npc)
|
|
{
|
|
doAnimationAction ( npc, "wave1" );
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
void destroysample_action_anim_rubchin (obj_id player, obj_id npc)
|
|
{
|
|
doAnimationAction ( npc, "rub_chin_thoughtful" );
|
|
}
|
|
|
|
// ======================================================================
|
|
// User Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnInitialize ()
|
|
{
|
|
if ((!isMob (self)) || (isPlayer (self)))
|
|
detachScript(self, "npc.conversation.destroysample");
|
|
|
|
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.destroysample");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
// Script Triggers
|
|
// ======================================================================
|
|
|
|
trigger OnStartNpcConversation (obj_id player)
|
|
{
|
|
if (ai_lib.isInCombat (self) || ai_lib.isInCombat (player))
|
|
return SCRIPT_OVERRIDE;
|
|
|
|
//-- [NOTE]
|
|
if (destroysample_condition_alreadyRewarded (player, self))
|
|
{
|
|
destroysample_action_anim_wave (player, self);
|
|
|
|
//-- NPC: Nice to see you, Trent.
|
|
string_id message = new string_id (c_stringFile, "s_bc9b15b3");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: It's good to be seen.
|
|
boolean hasResponse0 = false;
|
|
if (destroysample_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_e0f3deb6");
|
|
|
|
setObjVar (player, "conversation.destroysample.branchId", 1);
|
|
|
|
npcStartConversation (player, self, "destroysample", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (self, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (destroysample_condition_onQuest (player, self))
|
|
{
|
|
destroysample_action_anim_greet (player, self);
|
|
|
|
//-- NPC: Hey there Trent. Do you have the sensor logs confirming your kills?
|
|
string_id message = new string_id (c_stringFile, "s_cdb71c15");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Yeah, I've got the logs right here.
|
|
boolean hasResponse0 = false;
|
|
if (destroysample_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: No, I haven't finished the job yet.
|
|
boolean hasResponse1 = false;
|
|
if (destroysample_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_5786ebef");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_fd6095f2");
|
|
|
|
setObjVar (player, "conversation.destroysample.branchId", 3);
|
|
|
|
npcStartConversation (player, self, "destroysample", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat (self, message);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE] A sample bounty mission.
|
|
if (destroysample_condition__defaultCondition (player, self))
|
|
{
|
|
destroysample_action_anim_greet (player, self);
|
|
|
|
//-- NPC: I haven't seen you around here before.
|
|
string_id message = new string_id (c_stringFile, "s_f324f7d5");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Call me Trent. I'm looking for work.
|
|
boolean hasResponse0 = false;
|
|
if (destroysample_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_5c09875a");
|
|
|
|
setObjVar (player, "conversation.destroysample.branchId", 7);
|
|
|
|
npcStartConversation (player, self, "destroysample", 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 != "destroysample")
|
|
return SCRIPT_CONTINUE;
|
|
|
|
int branchId = getIntObjVar (player, "conversation.destroysample.branchId");
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Nice to see you, Trent.
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: It's good to be seen.
|
|
if (branchId == 1 && response == "s_e0f3deb6")
|
|
{
|
|
//-- [NOTE]
|
|
if (destroysample_condition__defaultCondition (player, self))
|
|
{
|
|
//-- NPC: Thanks for doing that little job for me. I'll let you know if there's something else we need done.
|
|
string_id message = new string_id (c_stringFile, "s_f150abd");
|
|
removeObjVar (player, "conversation.destroysample.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Nice to see you, Trent.' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Hey there Trent. Do you have the sensor logs confirming your kills?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Yeah, I've got the logs right here.
|
|
if (branchId == 3 && response == "s_5786ebef")
|
|
{
|
|
//-- [NOTE]
|
|
if (destroysample_condition_completedQuest (player, self))
|
|
{
|
|
destroysample_action_rewardPlayer (player, self);
|
|
|
|
//-- NPC: Ah, nicely done! My people will transfer the credits right away. You did a good job.
|
|
string_id message = new string_id (c_stringFile, "s_32900dd8");
|
|
removeObjVar (player, "conversation.destroysample.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [NOTE]
|
|
if (destroysample_condition__defaultCondition (player, self))
|
|
{
|
|
destroysample_action_anim_shakeheaddisgust (player, self);
|
|
|
|
//-- NPC: What? After I risk my neck trying to hook you up, you try to pass off fake logs? Come back when you have real results.
|
|
string_id message = new string_id (c_stringFile, "s_360ed899");
|
|
removeObjVar (player, "conversation.destroysample.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Hey there Trent. Do you have the sensor logs confirming your kills?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Hey there Trent. Do you have the sensor logs confirming your kills?
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: No, I haven't finished the job yet.
|
|
if (branchId == 3 && response == "s_fd6095f2")
|
|
{
|
|
//-- [NOTE]
|
|
if (destroysample_condition__defaultCondition (player, self))
|
|
{
|
|
destroysample_action_anim_converse (player, self);
|
|
|
|
//-- NPC: Take your time. The faction I represent is interested in success, even if it means having to wait a little bit.
|
|
string_id message = new string_id (c_stringFile, "s_73b20bfc");
|
|
removeObjVar (player, "conversation.destroysample.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Hey there Trent. Do you have the sensor logs confirming your kills?' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE] A sample bounty mission.
|
|
//-- NPC: I haven't seen you around here before.
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Call me Trent. I'm looking for work.
|
|
if (branchId == 7 && response == "s_5c09875a")
|
|
{
|
|
//-- [NOTE]
|
|
if (destroysample_condition__defaultCondition (player, self))
|
|
{
|
|
destroysample_action_anim_converse (player, self);
|
|
|
|
//-- NPC: Nice to meet you, Trent. I've got a job you might be interested in. My faction wants help in making things difficult for the Empire. If you can destroy 5 Tie Fighters, I'll pay you 3,000 credits.
|
|
string_id message = new string_id (c_stringFile, "s_df17f706");
|
|
int numberOfResponses = 0;
|
|
|
|
boolean hasResponse = false;
|
|
|
|
//-- PLAYER: Wouldn't that be murder? I don't think I can take that job.
|
|
boolean hasResponse0 = false;
|
|
if (destroysample_condition__defaultCondition (player, self))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
|
|
//-- PLAYER: I have plenty of reasons for hurting the Empire. Sign me up.
|
|
boolean hasResponse1 = false;
|
|
if (destroysample_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_157082a");
|
|
|
|
if (hasResponse1)
|
|
responses [responseIndex++] = new string_id (c_stringFile, "s_cdc3b4c7");
|
|
|
|
setObjVar (player, "conversation.destroysample.branchId", 8);
|
|
|
|
npcSpeak (player, message);
|
|
npcSetConversationResponses (player, responses);
|
|
}
|
|
else
|
|
{
|
|
removeObjVar (player, "conversation.destroysample.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'I haven't seen you around here before.' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Nice to meet you, Trent. I've got a job you might be interested in. My faction wants help in making things difficult for the Empire. If you can destroy 5 Tie Fighters, I'll pay you 3,000 credits.
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: Wouldn't that be murder? I don't think I can take that job.
|
|
if (branchId == 8 && response == "s_157082a")
|
|
{
|
|
//-- [NOTE]
|
|
if (destroysample_condition__defaultCondition (player, self))
|
|
{
|
|
destroysample_action_anim_checkwatch (player, self);
|
|
|
|
//-- NPC: Well, you aren't likely to find better around here. I've got someone else to meet. Talk to you later.
|
|
string_id message = new string_id (c_stringFile, "s_c1fc410f");
|
|
removeObjVar (player, "conversation.destroysample.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Nice to meet you, Trent. I've got a job you might be interested in. My faction wants help in making things difficult for the Empire. If you can destroy 5 Tie Fighters, I'll pay you 3,000 credits.' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-- [BRANCH NOTE]
|
|
//-- NPC: Nice to meet you, Trent. I've got a job you might be interested in. My faction wants help in making things difficult for the Empire. If you can destroy 5 Tie Fighters, I'll pay you 3,000 credits.
|
|
//-- [RESPONSE NOTE]
|
|
//-- PLAYER: I have plenty of reasons for hurting the Empire. Sign me up.
|
|
if (branchId == 8 && response == "s_cdc3b4c7")
|
|
{
|
|
//-- [NOTE]
|
|
if (destroysample_condition__defaultCondition (player, self))
|
|
{
|
|
destroysample_action_giveQuest (player, self);
|
|
|
|
//-- NPC: Excellent. I'll wire the credits to your account when you bring me sensor validation of the kills. Good luck.
|
|
string_id message = new string_id (c_stringFile, "s_28969bdd");
|
|
removeObjVar (player, "conversation.destroysample.branchId");
|
|
|
|
npcSpeak (player, message);
|
|
npcEndConversation (player);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: All conditions for OnNpcConversationResponse for branch 'Nice to meet you, Trent. I've got a job you might be interested in. My faction wants help in making things difficult for the Empire. If you can destroy 5 Tie Fighters, I'll pay you 3,000 credits.' were false.");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
chat.chat (self, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
|
|
removeObjVar (player, "conversation.destroysample.branchId");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// ======================================================================
|
|
|