YesBloodbane said:Are referring to something like in 1vs1 game where characters can't pass through opponent and they push opponent instead?
for (i = 0; i < openborconstant("MAX_ENTS"); ++i) {
void opp = getentity(i);
float x = getentityproperty(player, "x");
float z = getentityproperty(player, "z");
float a = getentityproperty(player, "a");
float xo = getentityproperty(opp, "x");
float zo = getentityproperty(opp, "z");
float ao = getentityproperty(opp, "a");
for (p = 0; p < 4; ++p) { //is this entity a player???
void player = getplayerproperty(p, "entity");
if ( player != self && player == opp ) {
// COLLIDE
if ( x > xo-width && x < xo+width && z > zo-height && z < zo+height ) {
// self is at left of the other player, so shifts self back
if ( getentityproperty(self, "x") < xo ) changeentityproperty(self, "position", xo-width-1,z,a);
else if.. etc etc
}
}
}
}
bWWd said:does it work white dragon? if it works then would be very nice in vs mode, nobody succesfully coded collision yet.
//COLLISION EDIT 2
for (i = 0; i < openborconstant("MAX_ENTS"); ++i) {
void opp = getentity(i);
float x = getentityproperty(player, "x");
float z = getentityproperty(player, "z");
float a = getentityproperty(player, "a");
float xo = getentityproperty(opp, "x");
float zo = getentityproperty(opp, "z");
float ao = getentityproperty(opp, "a");
for (p = 0; p < 4; ++p) { //is this entity a player???
void player = getplayerproperty(p, "entity");
if ( player != self && player == opp ) {
// COLLIDE
if ( x > xo-width && x < xo+width && z > zo-height && z < zo+height && a > ao-altitude && a < ao+altitude) {
// self is at left of the other player, so shifts self back
if ( getentityproperty(self, "x") < xo ) changeentityproperty(self, "position", xo-width-1,z,a);
else if ( getentityproperty(self, "x") > xo) changeentityproperty(self, "position", xo+width+1,z,a);
else if ( getentityproperty(self, "z") < zo) changeentityproperty(self, "position", x, zo-height-1,a);
else if ( getentityproperty(self, "z") > zo) changeentityproperty(self, "position", x, zo+height+1,a);
else if ( getentityproperty(self, "a") < ao) changeentityproperty(self, "position", x,z, ao-altitude-1);
else if ( getentityproperty(self, "a") > ao) changeentityproperty(self, "position", x,z, ao+altitude+1);
}
}
}
}
//COLLISION EDIT 4
for (i = 0; i < openborconstant("MAX_ENTS"); ++i) {
void opp = getentity(i);
float x = getentityproperty(player, "x");
float z = getentityproperty(player, "z");
float a = getentityproperty(player, "a");
float xo = getentityproperty(opp, "x");
float zo = getentityproperty(opp, "z");
float ao = getentityproperty(opp, "a");
for (p = 0; p < 4; ++p) { //is this entity a player???
void player = getplayerproperty(p, "entity");
if ( player != self && player == opp ) {
// COLLIDE
if ( x > xo-width && x < xo+width && z > zo-height && z < zo+height && a > ao-altitude && a < ao+altitude) {
// self is at left of the other player, so shifts self back
if ( getentityproperty(self, "x") < xo ){
changeentityproperty(self, "position", xo-width-1,z,a);
}
else if ( getentityproperty(self, "x") > xo){
changeentityproperty(self, "position", xo+width+1,z,a);
}
else if ( getentityproperty(self, "z") < zo){
changeentityproperty(self, "position", x, zo-height-1,a);
}
else if ( getentityproperty(self, "z") > zo){
changeentityproperty(self, "position", x, zo+height+1,a);
}
else if ( getentityproperty(self, "a") < ao){
changeentityproperty(self, "position", x,z, ao-altitude-1);
}
else if ( getentityproperty(self, "a") > ao){
changeentityproperty(self, "position", x,z, ao+altitude+1);
}
}
}
}
}