Module commit
Module commit.
This commit is contained in:
66
_module/nss/_open_spider.nss
Normal file
66
_module/nss/_open_spider.nss
Normal file
@@ -0,0 +1,66 @@
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user