Initial Upload
Initial Upload
This commit is contained in:
94
_module/nss/_fb1_onenter.nss
Normal file
94
_module/nss/_fb1_onenter.nss
Normal file
@@ -0,0 +1,94 @@
|
||||
///////////////////////////////////////////////////////
|
||||
// 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=3;
|
||||
if (oIntensity!=OBJECT_INVALID)
|
||||
nIntensity=StringToInt(GetName(oIntensity));
|
||||
SetLocalInt(oPC,"FB1_Intensity",nIntensity);
|
||||
if (nIntensity<1) nIntensity=1;
|
||||
|
||||
if(GetIsDM(oPC)) return;
|
||||
|
||||
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+10;
|
||||
if (GetWeather(oArea)==WEATHER_SNOW) nTotalIntensity=nTotalIntensity-3;
|
||||
if (GetWeather(oArea)==WEATHER_RAIN) nTotalIntensity=nTotalIntensity+3;
|
||||
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_heavywinter") nTotalIntensity=nTotalIntensity-7;
|
||||
} // check clothing
|
||||
else
|
||||
{ // no clothes
|
||||
nTotalIntensity=nTotalIntensity+20;
|
||||
} // no clothes
|
||||
oItem=GetItemInSlot(INVENTORY_SLOT_CLOAK,oPC);
|
||||
sTag=GetTag(oItem);
|
||||
if (sTag=="fb1_wintercloak") nTotalIntensity=nTotalIntensity-7;
|
||||
else if (oItem!=OBJECT_INVALID) nTotalIntensity=nTotalIntensity-1;
|
||||
//boots
|
||||
oItem=GetItemInSlot(INVENTORY_SLOT_BOOTS,oPC);
|
||||
sTag=GetTag(oItem);
|
||||
if (sTag=="fb1_winterboots") nTotalIntensity=nTotalIntensity-7;
|
||||
else if (oItem!=OBJECT_INVALID) nTotalIntensity=nTotalIntensity-1;
|
||||
//boots
|
||||
oItem=GetNearestObjectByTag("fb1_campfire",oPC,1);
|
||||
if (oItem!=OBJECT_INVALID)
|
||||
{ // fire nearby
|
||||
fDist=GetDistanceBetween(oItem,oPC);
|
||||
if (fDist<3.1) nTotalIntensity=nTotalIntensity-9;
|
||||
else if (fDist<5.1) nTotalIntensity=nTotalIntensity-6;
|
||||
else if (fDist<8.1) nTotalIntensity=nTotalIntensity-3;
|
||||
} // 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);
|
||||
effect eVis = EffectVisualEffect(VFX_IMP_MAGIC_PROTECTION);
|
||||
SendMessageToPC(oPC,"You are suffering from the cold.");
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,eDmg,oPC,1.0);
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVis,oPC);
|
||||
} // do cold damage
|
||||
DelayCommand(24.0,fnHeatEffects(oPC,oArea));
|
||||
} // still in same area
|
||||
} // fnHeatEffects()
|
Reference in New Issue
Block a user