Aschbourne_PRC8/_module/nss/pv_lstn_2_prices.nss

51 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2024-06-14 10:48:20 -04:00
//::///////////////////////////////////////////////
//:: Name: pv_lstn_2_prices
//:://////////////////////////////////////////////
/*
When the player is speaking a price, this
script will detect if he matched the listen
pattern 5000.
If he did, update the database and necessary
local variables.
*/
//:://////////////////////////////////////////////
void main()
{
object oShouter = GetLastSpeaker();
object oNPCMerchant = OBJECT_SELF;
object oPCOwner = GetLocalObject(oNPCMerchant, "PV_MERCHANT_OWNER");
int iMatch = GetListenPatternNumber();
if (iMatch == -1 && GetCommandable(oNPCMerchant))
{
ClearAllActions();
BeginConversation();
}
else
{
if(GetIsObjectValid(oShouter) && GetIsPC(oShouter) && (oShouter == oPCOwner) && (GetMatchedSubstringsCount() != 0))
{
object oChosenItem = GetLocalObject(oNPCMerchant, "PV_ITEM_CHOSEN");
string sChosenItemName = GetName(oChosenItem);
string sPrice;
// If a number was spoken (matched the listen pattern), resume the conversation
if (iMatch == 5000)
{
SetLocalInt(oNPCMerchant, "PV_SPOKEN_PRICE", StringToInt(GetMatchedSubstring(0)));
SetLocalString(oNPCMerchant, "PV_ITEM_NAME", sChosenItemName);
// I doubt anyone would ever think of saying this :P :D
SetListenPattern(oNPCMerchant, "**xXxmuahahahaha!!!11!!!11xXx**", 5000);
SetListening (oNPCMerchant, FALSE);
ActionResumeConversation();
}
}
}
}