Alangara_PRC8/_module/nss/farm_sign_ou.nss
Jaysyn904 86feb9ca6f Initial commit
Initial commit.
2024-06-05 21:21:06 -04:00

83 lines
2.4 KiB
Plaintext

//:://////////////////////////////////////////////
//:: Name: farm_sign_ou
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
OnUsed event for property signs.
This script will initate a conversation with
the last object to activate this sign.
*/
//:://////////////////////////////////////////////
//:: Created By: Adam Walenga
//:: Created On: August 30th, 2004
//:://////////////////////////////////////////////
#include "farm_include"
#include "farm_config"
// ----------------------------
// added by kewnneth jensen
string sDeny;
// ----------------------------
void main()
{
object oPlayer = GetLastUsedBy();
string sTag = GetTag (OBJECT_SELF);
int iFarmNumber = StringToInt (GetStringRight (sTag, (GetStringLength
(sTag) - 13)));
// -------------------------------------------------------------
// takes level 10 to use the farms to prevent overuse of farms by "guestplayers"
// by kenneth Jensen aka Tarashon
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
if (!(GetHitDice(oPC) >= 10))
{
sDeny="You may buy a farm when you have reached level 10";
SendMessageToPC(oPC, sDeny);
return;
}
// -------------------------------------------------------------
//Reset/Set variables for future use.
DeleteLocalInt (OBJECT_SELF, "Farm_Is_Owned");
DeleteLocalInt (OBJECT_SELF, "Farm_Temp_Sell_Price");
SetLocalInt (OBJECT_SELF, "Farm_Number", iFarmNumber);
//Check if farmland is currently owned.
if (Farm_GetOwner (iFarmNumber) == "")
{
SetCustomToken (601, FARM_INIT_LAND_OWNER);
SetCustomToken (602, IntToString (GetLocalInt (OBJECT_SELF, "Farm_Price")));
}
else //Farm is currently owned by a PC.
{
string sFarmOwner = Farm_GetOwner (iFarmNumber);
int iPosition = FindSubString (sFarmOwner, "_");
//Check if farm is for sale.
if (Farm_GetIsForSale (iFarmNumber))
{
SetCustomToken (601, "by another adventurer");
SetCustomToken (602, IntToString (Farm_GetSellPrice (iFarmNumber)));
}
else //Farm is currently not for sale...
{
SetLocalInt (OBJECT_SELF, "Farm_Is_Owned", TRUE);
SetCustomToken (601, "by another adventurer");
}
}
//Initiate conversation with the PC.
ActionStartConversation (oPlayer, "", TRUE, FALSE);
}