Aschbourne_PRC8/_module/nss/_open_spider.nss
GetOffMyYarn 69879d6957 Areas and Fixes
Added CCOH and missing areas
Changed some areas to be craftable,
Fixed some on death issues,
Fixed the Gaurd
2024-08-30 11:38:44 -04:00

67 lines
2.1 KiB
Plaintext

void main()
{
object oPC = GetLastOpenedBy();
int iSpawned = GetLocalInt(OBJECT_SELF,"iSpawned");
int iSilkNum = GetLocalInt(OBJECT_SELF,"iSilk");
int iSpawnType = 0;
string sSpiderResRef = "";
int iSpawnNum = 0;
if (iSpawned==0)
{
if (Random(1000)<500) iSpawnType++;
if (Random(1000)<300) iSpawnType++;
switch (iSpawnType)
{
case 1:
{
sSpiderResRef="spidgiant002";
iSpawnNum = d12(1);
iSilkNum = d6(1);
break;
}
case 2:
{
sSpiderResRef="spidgiant006";
iSpawnNum = d8(1);
iSilkNum = iSpawnNum+d6(1);
break;
}
default:
{
sSpiderResRef="spidgiant001";
iSpawnNum = d10(2);
iSilkNum = d4(1);
break;
}
}
SetLocalInt(OBJECT_SELF,"iSpawned",99);
SetLocalInt(OBJECT_SELF,"iSilk",iSilkNum);
object oArea = GetArea(oPC);
vector vSelf = GetPosition(oPC);
object oTemp = OBJECT_INVALID;
object oTemp2 = OBJECT_INVALID;
for (iSpawnNum; iSpawnNum>0; iSpawnNum--)
{
float fSelf = GetFacing(oPC)+Random(360);
float fDistance = (IntToFloat(Random(100)+1)/10.0);
vector vFire = vSelf + (AngleToVector(fSelf) * fDistance);
location lFire = Location(oArea,vFire,fSelf);
oTemp = CreateObject(OBJECT_TYPE_CREATURE,sSpiderResRef,lFire,TRUE);
oTemp2 = CreateObject(OBJECT_TYPE_PLACEABLE,"temporaryplaceho",lFire,FALSE);
DestroyObject(oTemp2,600.0);
AssignCommand(oTemp,SetFacingPoint(AngleToVector(GetFacing(oPC))));
AssignCommand(oTemp, ActionAttack(oPC,FALSE));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_DUR_WEB,FALSE),oTemp2,300.0);
}
for (iSilkNum; iSilkNum>0; iSilkNum--)
{
CreateItemOnObject("item_spidersilk",OBJECT_SELF,1);
}
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_DUR_WEB_MASS,FALSE),OBJECT_SELF,600.0);
DelayCommand(600.0,ExecuteScript("_onclose_clear2",OBJECT_SELF));
FloatingTextStringOnCreature("You have disturbed the spider's nest!!",oPC,FALSE);
}
}