Matute2175
New member
Hello friends!! I have a doubt, I use a script to summon random enemies in the scenarios, and it works correctly, but I am not able to make the command map or item work (they always appear with the default palette, and I would like to put other random palettes on them with the map command ). It looks like I would have to include it in the script, can someone help me? Thanks a lot!!
This is the script:
void main()
{
randomenem();
}
void randomenem()
{//Spawn random Enemy
int pCount = openborvariant("count_players");
if(pCount == 1){
EnemyX(-20, 220, 0);
}else if(pCount == 2){
EnemyX(-20, 220, 0);
}else if(pCount == 3){
EnemyX(-20, 220, 0);
EnemyX(-20, 220, 00);
}else if(pCount == 4){
EnemyX(-20, 220, 0);
EnemyX(-20, 220, 0);
}
}
void EnemyX(float dx, float dy, float dz)
{ //Spawns random enemy next to caller.
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: Z location adjustment.
void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
void vRName = getentityproperty(self,"defaultname"); // Get caller's real name.
int iDir = getentityproperty(self,"direction"); // Get caller's direction.
int iR = rand()%99;
if (iR >= 0 && iR <= 7){
vRName = "abobo";
} else if (iR >= 8 && iR <= 14){
vRName = "afrobo";
} else if (iR >= 15 && iR <= 21){
vRName = "bolo";
}
else if (iR >= 22 && iR <= 28){
vRName = "abobo";
} else if (iR >= 29 && iR <= 35){
vRName = "afrobo";
}
else if (iR >= 36 && iR <= 42){
vRName = "bolo";
} else if (iR >= 43 && iR <= 49){
vRName = "afrobo";
}
else if (iR >= 50 && iR <= 56){
vRName = "abobo";
} else if (iR >= 57 && iR <= 63){
vRName = "eliza";
}
else if (iR >= 64 && iR <= 70){
vRName = "eliza";
} else if (iR >= 71 && iR <= 77){
vRName = "abobo";
}
else if (iR >= 78 && iR <= 84){
vRName = "afrobo";
} else if (iR >= 85 && iR <= 91){
vRName = "badguy";
}
else if (iR >= 92 && iR <= 99){
vRName = "badguy";
}
clearspawnentry(); //Clear current spawn entry.
setspawnentry("name", vRName); //Acquire spawn entity by name.
vSpawn = spawn();
bindentity(vSpawn, self, dx, dz, dy, iDir);
return vSpawn; //Return spawn.
}
This is the script:
void main()
{
randomenem();
}
void randomenem()
{//Spawn random Enemy
int pCount = openborvariant("count_players");
if(pCount == 1){
EnemyX(-20, 220, 0);
}else if(pCount == 2){
EnemyX(-20, 220, 0);
}else if(pCount == 3){
EnemyX(-20, 220, 0);
EnemyX(-20, 220, 00);
}else if(pCount == 4){
EnemyX(-20, 220, 0);
EnemyX(-20, 220, 0);
}
}
void EnemyX(float dx, float dy, float dz)
{ //Spawns random enemy next to caller.
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: Z location adjustment.
void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
void vRName = getentityproperty(self,"defaultname"); // Get caller's real name.
int iDir = getentityproperty(self,"direction"); // Get caller's direction.
int iR = rand()%99;
if (iR >= 0 && iR <= 7){
vRName = "abobo";
} else if (iR >= 8 && iR <= 14){
vRName = "afrobo";
} else if (iR >= 15 && iR <= 21){
vRName = "bolo";
}
else if (iR >= 22 && iR <= 28){
vRName = "abobo";
} else if (iR >= 29 && iR <= 35){
vRName = "afrobo";
}
else if (iR >= 36 && iR <= 42){
vRName = "bolo";
} else if (iR >= 43 && iR <= 49){
vRName = "afrobo";
}
else if (iR >= 50 && iR <= 56){
vRName = "abobo";
} else if (iR >= 57 && iR <= 63){
vRName = "eliza";
}
else if (iR >= 64 && iR <= 70){
vRName = "eliza";
} else if (iR >= 71 && iR <= 77){
vRName = "abobo";
}
else if (iR >= 78 && iR <= 84){
vRName = "afrobo";
} else if (iR >= 85 && iR <= 91){
vRName = "badguy";
}
else if (iR >= 92 && iR <= 99){
vRName = "badguy";
}
clearspawnentry(); //Clear current spawn entry.
setspawnentry("name", vRName); //Acquire spawn entity by name.
vSpawn = spawn();
bindentity(vSpawn, self, dx, dz, dy, iDir);
return vSpawn; //Return spawn.
}