void spawnToss(void name, float dx, float dy, float dz, float Vx, float Vy, float Vz, void ani, int atk, int dir)
{//Spawn and Toss entity with defined conditions (DEFAULT TOSS SCRIPT USED FOR ALL SPAWNED ENTITIES, LIKE ITEMS)
void self = getlocalvar("self");
void vSpawn = spawn01(name, dx, dy, dz, NULL(), dir);
int direction = getentityproperty(self, "direction");
if(direction == 0){Vx = -Vx;}
tossentity(vSpawn, Vy, Vx, Vz);
//SPAWN WITH A SPECIFIC ANIMATION??
if(ani != NULL()){changeentityproperty(vSpawn, "animation", ani);}
//THIS ENTITY IS USED FOR ATTACKS??
if(atk != NULL()){
void type = getentityproperty(self, "type");
void hostile = getentityproperty(self, "hostile");
void candamage = getentityproperty(self, "candamage");
void anim = getentityproperty(self, "animationID");
float offense = getentityproperty(self, "offense", 0);
int disable = getentityproperty(self, "energycost", "disable", getlocalvar("animnum"));
if(getglobalvar("projectileDamage") == "damage_all"){
candamage = openborconstant("type_player")+openborconstant("type_enemy")+openborconstant("type_npc")+openborconstant("type_obstacle");
}
changeentityproperty(vSpawn, "parent", self);
changeentityproperty(vSpawn, "owner", self);
changeentityproperty(vSpawn, "hostile", hostile);
changeentityproperty(vSpawn, "candamage", candamage);
changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL"), offense);
changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL2"), offense);
changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL6"), offense);
changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL8"), offense);
changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL9"), offense);
changeentityproperty(vSpawn, "offense", openborconstant("ATK_BURN"), offense);
changeentityproperty(vSpawn, "offense", openborconstant("ATK_SHOCK"), offense);
changeentityproperty(vSpawn, "aiflag", "attacking", 1);
setentityvar(vSpawn, "parentAnimation", anim);
setentityvar(vSpawn, "disable", disable);