void spawnopp(void vName, float fX, float fY, float fZ)
{ 
       void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	void opp     = getentityproperty(self,"opponent");
	int  vAlias  = getentityproperty(self, "name");
	int  iHealth = getentityproperty(self, "health");
	int  iDirection = getentityproperty(self, "direction");
        float FY;
	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(opp, "x"); //Get X location and add adjustment.
      fY = fY + getentityproperty(self, "a");
      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, "name", vAlias); //Set name.
	changeentityproperty(vSpawn, "health", iHealth); //Set health.
	changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
    
	return vSpawn; //Return spawn.



}