void RspawnU(float fX, float fY, float fZ)
{//Spawns random enemy next to caller.
// Spawned enemy has Upper ability
//
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: Z location adjustment.
void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
void vName; //Spawn object's name.
void vRName = getentityproperty(self,"defaultname"); // Get caller's real name.
void vAlias = getentityproperty(self,"name"); // Get caller's alias.
int iMHealth = getentityproperty(self,"maxhealth"); // Get caller's maximum health.
int iHealth = getentityproperty(self,"health"); // Get caller's health.
int iDirection = getentityproperty(self, "direction"); // Get caller's direction.
int iMap = getentityproperty(self, "map"); // Get caller's remap.
int iR = rand()%3 + 3;
if (iR >= 0 && iR < 2){
vName = "Blood2";
} else if (iR >= 2 && iR < 4){
vName = "Blood3";
} else {
vName = "Blood4";
}
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.
if (vAlias == vRName){ // If this entity doesn't have alias, it will use spawned entity's name.
vAlias = vName;
}
if (vAlias == "Joe"){ // If Joe is spawned, his alias will be adjusted to his remap
if (iMap == 0){
vAlias = "Elang";
} else if (iMap == 1){
vAlias = "Condor";
} else if (iMap == 2){
vAlias = "Hawk";
} else if (iMap == 3){
vAlias = "Eagle";
} else if (iMap == 4){
vAlias = "Rajawali";
} else if (iMap == 5){
vAlias = "Raven";
}
} else if (vAlias == "Donna"){ // If Donna is spawned, her alias will be adjusted to her remap
if (iMap == 1 || iMap == 5){
vAlias = "Althea";
} else if (iMap == 2){
vAlias = "Maria";
} else if (iMap == 3){
vAlias = "Reina";
} else if (iMap == 4){
vAlias = "Zora";
}
}
changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
changeentityproperty(vSpawn, "name", vAlias); //Set alias.
changeentityproperty(vSpawn, "map", iMap); //Set map.
changeentityproperty(vSpawn, "maxhealth", iMHealth); //Set maximum health.
changeentityproperty(vSpawn, "health", iHealth); //Set health.
changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
return vSpawn; //Return spawn.
}