Archives des forums MMO/MMORPG > Neverwinter Nights > NWN - Maskado > scripter des feats?
scripter des feats?
Par John Hawkmoon le 24/7/2002 à 2:33:51 (#1851597)
Par Ryval le 24/7/2002 à 15:29:57 (#1854250)
void CreateMultipleCreatures(int iNumberOfCreatures, int sSphereSize, string sTemplate, object oSpawnObject, int iEffect, object oObjetaattaquer, int bInstantAttack = FALSE, int bOnceOnly = TRUE) {
if((bOnceOnly == TRUE && (GetLocalInt(oSpawnObject, "SPAWN_ONCE") != 1))
|| (bOnceOnly == FALSE))
{
//Get the location of the object to spawn around
location oMyLocation = GetLocation(oSpawnObject);
//Get the location vector of the object to spawn around
vector oMyVector = GetPosition(oSpawnObject);
//Count the number of creatures
int iCount = 0;
//While we still have items to create
while(iCount < iNumberOfCreatures)
{
//Create a new vector object
vector oNewVector = oMyVector;
//Create some offsets based on the sphere size
int xOffSet = Random(sSphereSize);
int yOffSet = Random(sSphereSize);
//Make the offset negative, randomly
if(Random(2) == 1)
{
xOffSet = xOffSet * -1;
}
//Make the offset negative, randomly
if(Random(2) == 1)
{
yOffSet = yOffSet * -1;
}
//Add the offsets to the vector
oNewVector.x = oNewVector.x + xOffSet;
oNewVector.y = oNewVector.y + yOffSet;
//Create a new location, based on the off set vector
location oNewLocation = Location(GetAreaFromLocation(oMyLocation),
oNewVector, 0.0);
//Create a creature using the supplied template
object oMonster = CreateObject(OBJECT_TYPE_CREATURE, sTemplate, oNewLocation, FALSE);
//Create an effect using the supplied effect constant
ApplyEffectAtLocation(DURATION_TYPE_INSTANT,
EffectVisualEffect(iEffect), oNewLocation, 0.5);
if(bInstantAttack == TRUE)
{
//Get the creature that we'll attack
AssignCommand(oMonster, ActionAttack(oObjetaattaquer));
}
//Increase the count
iCount = iCount + 1;
}
//Set the spawn once
SetLocalInt(oSpawnObject, "SPAWN_ONCE", 1);
}
}
JOL Archives 1.0.1
@ JOL / JeuxOnLine