void spawn01(void vName, float fX, float fY, float fZ)
{
//spawn01 (Generic spawner)
//Damon Vaughn Caskey
//07/06/2007
//
//Spawns entity next to caller.
//
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: Z location adjustment.
void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
int iDirection = getentityproperty(self, "direction");
clearspawnentry(); //Clear current spawn entry.
setspawnentry("name", vName); //Acquire spawn entity by name.
if (iDirection == 0){ //Is entity facing left?
fX = -fX; //Reverse X direction to match facing.
}
fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
vSpawn = spawn(); //Spawn in entity.
changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
return vSpawn; //Return spawn.
}
void spawnbind(void Name, float dx, float dy, float dz, int iDir,int iBind)
{ // Spawn and bind other entity
// [iDir]
// 0 = No change.
// 1 = Same direction as target.
// -1 = Opposite direction as target.
// 2 = Always right.
// -2 = Always left.
// [iBind]
// 0 = No effect.
// 1 = Keep same animation as the target.
// 2 = Also keep same frame as the target.
// 4 = Kill the entity if the animation doesn't match.
// You can combine those values for bindanimation, so it can be 6 which means 2 and 4.
void self = getlocalvar("self");
void Spawn;
Spawn = spawn01(Name, dx, dy, 0);
bindentity(Spawn, self, dx, dz, dy, iDir, iBind);
}