antiwall problem

It's over my head, but the way you merged them you're simply loading both commands.  antiwall script needs to have the stop function added, I think it would just be more like this.

void antiwall(int Dist, int Move, int Distz)
{// Checks if there is wall at defined distance
// If there is wall, entity will be moved away with defined movement
  void self = getlocalvar("self");
  int Direction = getentityproperty(self, "direction");
  int x = getentityproperty(self, "x");
  int z = getentityproperty(self, "z");
  float H;
  float Hz;

  if (Direction == 0){ //Is entity facing left?               
      Dist = -Dist; //Reverse Dist to match facing
      Move = -Move; //Reverse Move to match facing
  }

  H = checkwall(x+Dist,z);
  Hz = checkwall(x+Dist,z+Distz);

  if(Hz > 0)
  {
    changeentityproperty(self, "position", x, z-Distz);
    changeentityproperty(self, "velocity", 0, 0, 0); //Stop moving!
  }

  if(H > 0)
  {
    changeentityproperty(self, "position", x+Move);
    changeentityproperty(self, "velocity", 0, 0, 0); //Stop moving!
  }
}

Or something like that, just kinda guessing but looking at the script it seems thats where u want the stop part.
 
Back
Top Bottom