Topic.
What I am experiencing is people know where an enemy/boss is going to pop out at certain times, so players wait for them and perform meaty attacks on them for guaranteed damage.
I suggest taking a look at my SOR2X game. In the chars/random folder, there's some dummy enemies used to spawn other enemies applying some randomness.Topic.
What I am experiencing is people know where an enemy/boss is going to pop out at certain times, so players wait for them and perform meaty attacks on them for guaranteed damage.
spawn Galsia
@script
void main()
{
if(random >= chance){
changeentityproperty(self, "position", x+amount, z, y);
}
}
@end_script
flip 1
coords 350 150 0
at 0
void main()
{
void self = getlocalvar("self");
int Minz = openborvariant("PLAYER_MIN_Z");
int Maxz = openborvariant("PLAYER_MAX_Z");
int XPos = openborvariant("xpos"); //Get screen edge's position
int Screen = openborvariant("hResolution"); // Get screen width
int r = rand()%50;
int zW = Maxz - Minz;
int zM = Minz + zW/2;
float dz = zM + zW*r/100;
int W = 60;
if(r%2 == 1){
changeentityproperty(self, "position", XPos + Screen + W, dz);
} else {
changeentityproperty(self, "position", XPos - W, dz);
}
}
spawn Enemy
spawnscript data/scripts/RandXZ.c
health 20
coords 400 206
at 0
RandXY.c:
void main()
{
void self = getlocalvar("self");
int x = getentityproperty(self, "x");
int z = getentityproperty(self, "z");
int Minz = openborvariant("PLAYER_MIN_Z");
int Maxz = openborvariant("PLAYER_MAX_Z");
int Wx = 50; // possible spawn length in x
int Wz = 30; // possible spawn width in z
int r = rand()%50;
int s = rand()%50;
float dx = Wx*r/50;
float dz = Wz*s/50;
int Nz = z + dz;
if(Nz < Minz){
Nz = Minz;
} else if(Nz > Maxz){
Nz = Maxz;
}
changeentityproperty(self, "position", x + dx, Nz);
}
void main()
{
void self = getlocalvar("self");
int x = getentityproperty(self, "x");
int b = getentityproperty(self, "base");
int z = getentityproperty(self, "z");
int Wx = 50; // possible spawn length in x
int Wz = 30; // possible spawn width in z
int Nx = RandoXZ(Wx, Wz, "x");
int Nz = RandoXZ(Wx, Wz, "z");
int Cy = checkwall(Nx,Nz);
while(Cy > b){
Nx = RandoXZ(Wx, Wz, "x");
Nz = RandoXZ(Wx, Wz, "z");
Cy = checkwall(Nx,Nz);
}
changeentityproperty(self, "position", Nx, Nz);
}
void RandoXZ(int Rx, int Rz, void C)
{ // Randomizes position
void self = getlocalvar("self");
int x = getentityproperty(self, "x");
int z = getentityproperty(self, "z");
int XPos = openborvariant("xpos"); //Get screen edge's position
int Screen = openborvariant("hResolution"); // Get screen width
int Minz = openborvariant("PLAYER_MIN_Z");
int Maxz = openborvariant("PLAYER_MAX_Z");
int r = rand()%50;
int s = rand()%50;
float dx = Rx*r/50;
float dz = Rz*s/50;
int Nx = x + dx;
int Nz = z + dz;
if(Nx < XPos){
Nx = XPos;
} else if(Nx > XPos + Screen){
Nx = XPos + Screen;
}
if(Nz < Minz){
Nz = Minz;
} else if(Nz > Maxz){
Nz = Maxz;
}
if(C == "x"){
return Nx;
} else if(C == "z"){
return Nz;
}
}