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

89 lines
3.3 KiB
Plaintext

///////////////////////////////////////////////////////
// Frostbite 1.0 - OnAreaEnter
// By Deva Bryson Winblood
// 11/25/2003
///////////////////////////////////////////////////////
////////////////////////////
// Prototypes
////////////////////////////
void fnHeatEffects(object oPC,object oArea);
//////////////////////////////////////////// MAIN
void main()
{
object oPC=GetEnteringObject();
object oIntensity=GetNearestObjectByTag("FB1_INTENSITY",oPC);
object oArea=GetArea(oPC);
int nIntensity=5;
if (oIntensity!=OBJECT_INVALID)
nIntensity=StringToInt(GetName(oIntensity));
SetLocalInt(oPC,"FB1_Intensity",nIntensity);
if (nIntensity<1) nIntensity=1;
if (GetIsPC(oPC)==TRUE)
{ // is PC
DelayCommand(24.0,fnHeatEffects(oPC,oArea));
} // is PC
}
//////////////////////////////////////////// MAIN
///////////////////////////
// Functions
///////////////////////////
void fnHeatEffects(object oPC,object oArea)
{
int nTotalIntensity;
effect eDmg;
object oItem;
string sTag;
float fDist;
if (GetArea(oPC)==oArea)
{ // still in same area
nTotalIntensity=GetLocalInt(oPC,"FB1_Intensity");
oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);
sTag=GetTag(oItem);
if (GetIsNight()==TRUE) nTotalIntensity=nTotalIntensity+3;
if (GetWeather(oArea)==WEATHER_SNOW) nTotalIntensity=nTotalIntensity-1;
if (GetWeather(oArea)==WEATHER_RAIN) nTotalIntensity=nTotalIntensity+1;
if (oItem!=OBJECT_INVALID)
{ // check clothing
if (sTag=="NW_CLOTH027"||sTag=="NW_CLOTH015"||sTag=="NW_CLOTH021"||sTag=="NW_CLOTH022") nTotalIntensity=nTotalIntensity+2;
else if (sTag=="NW_CLOTH011"||sTag=="NW_CLOTH014"||sTag=="NW_CLOTH016"||sTag=="NW_CLOTH009") nTotalIntensity=nTotalIntensity+2;
else if (sTag=="NW_CLOTH023"||sTag=="NW_CLOTH001"||sTag=="FB1_WORTHLESS") nTotalIntensity=nTotalIntensity+2;
else if (sTag=="fb1_warmclothes") nTotalIntensity=nTotalIntensity-2;
else if (sTag=="fb1_heavywinter") nTotalIntensity=nTotalIntensity-3;
} // check clothing
else
{ // no clothes
nTotalIntensity=nTotalIntensity+3;
} // no clothes
oItem=GetItemInSlot(INVENTORY_SLOT_CLOAK,oPC);
sTag=GetTag(oItem);
if (sTag=="fb1_warmcloak") nTotalIntensity=nTotalIntensity-2;
else if (sTag=="fb1_wintercloak") nTotalIntensity=nTotalIntensity-3;
else if (oItem!=OBJECT_INVALID) nTotalIntensity=nTotalIntensity-1;
oItem=GetNearestObjectByTag("fb1_campfire",oPC,1);
if (oItem!=OBJECT_INVALID)
{ // fire nearby
fDist=GetDistanceBetween(oItem,oPC);
if (fDist<3.1) nTotalIntensity=nTotalIntensity-3;
else if (fDist<5.1) nTotalIntensity=nTotalIntensity-2;
else if (fDist<8.1) nTotalIntensity=nTotalIntensity-1;
} // fire nearby
oItem=GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC);
if (GetTag(oItem)=="fb1_ringwarm") nTotalIntensity==0;
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC);
if (GetTag(oItem)=="fb1_ringwarm") nTotalIntensity==0;
if (nTotalIntensity>0)
{ // do cold damage
eDmg=EffectDamage(nTotalIntensity,DAMAGE_TYPE_COLD);
SendMessageToPC(oPC,"You are suffering from the coldness of this place.");
ApplyEffectToObject(DURATION_TYPE_INSTANT,eDmg,oPC,1.0);
} // do cold damage
DelayCommand(24.0,fnHeatEffects(oPC,oArea));
} // still in same area
} // fnHeatEffects()