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.
//fY: Y location adjustment.
//fZ: 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 spawnAt(void Name, float dx, float dy, float dz)
{ // Spawn an entity and place it at exact coords
void self = getlocalvar("self");
void Spawn;
Spawn = spawn01(Name, 0, 0, 0);
changeentityproperty(Spawn, "position", dx, dy, dz);
}
could you point me to a script for random intem drop?
name RandItem
type none
gfxshadow 1
lifespan 2
animationscript data/scripts/enemy.c
load Money
load Meat
load Apple
anim idle
@script
if(frame == 1){
void self = getlocalvar("self");
int r = rand()%30;
if(r < -10){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
} else if(r > 10){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
}
}
@end_script
delay 1
offset 8 14
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
delay 200
@cmd spawn01 "Money" 0 0 0
frame data/chars/misc/empty.gif
anim follow1
delay 1
offset 8 14
frame data/chars/misc/empty.gif
delay 200
@cmd spawn01 "Apple" 0 0 0
frame data/chars/misc/empty.gif
anim follow2
delay 1
offset 8 14
frame data/chars/misc/empty.gif
delay 200
@cmd spawn01 "Meat" 0 0 0
frame data/chars/misc/empty.gif
Bloodbane said:Unfortunately, that script is meant for the entity
AFAIK there's no way to control item dropped by killed entities in level with script
I can imagine a workaround for this but before that, what is exactly you are trying to create here?
bWWd said:use itemalias {name} when enemy spawns item
then iuse it to detect the item in its spawn animation, then change its coords.
spawn enemy
item bone
itemalias bone2
coords 200 300
Then in spawn anim detect bone2 name, and change the coords with script in spawn animation.
int XPos = openborvariant("xpos");
iName = getentityproperty(self, "name");
if(iName == "bone2" && Frame == 1 ){
changeentityproperty(self, "position", 444 - XPos);
Its not entire script but parts that you need.