AI Movement Help

For example on a Mario type platform Openbor mod is there a way to make the player invisible to the AI and have the AI repeatedly move left to right within its boundary or platform like a clueless enemy on autopilot?

Please excuse me if this seems like a dumb question but I would love to create a platform game on the Openbor engine if certain things are possible to achieve.

Also if someone has this Openbor Mod from the video below please PM me because I would like to take a look at its data and learn some things from it.


Thank You,
 
Use the stealth setting. From the manual:

stealth {stealth} {perception}

  • This command sets stealth ability to entity
  • {stealth} defines how ‘invisible’ the entity to hostile entities. Default value is 0
  • {perception} defines how well entity can see stealth entities. Default value is 0
  • For instance, entity with {stealth} 2 is only ‘visible’ to hostile entities with {perception} 2 or higher
  • This command doesn’t affect visual at all IOW entity is still visible to players

HTH,
DC
 
I have several for walking left/right automatically , you have to check them out yourself, i dont remember which was the best one for what scenario
Code:
walllplatform dirchange--------------------------------



void StayPlat(int Rx, int Vx)
{// Finds platform edge within defined range. Turn around if edge is found
// Rx : Check distance in x axis
// Vx : Velocity to move
    void self = getlocalvar("self");
    int Dir = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    void Plat = checkplatformbelow(x, z, y+2);
    void PlatA; void PlatB;

    if(Plat){ // on a platform
      if(Dir==1){
        PlatA = checkplatformbelow(x+Rx, z, y+2);
        PlatB = checkplatformbelow(x+Rx, z, y-2);
      } else {
        PlatA = checkplatformbelow(x-Rx, z, y+2);
        PlatB = checkplatformbelow(x-Rx, z, y-2);
      }

      if(Plat!=PlatA && PlatA==PlatB && Dir==1){
        changeentityproperty(self, "velocity", -Vx);
        changeentityproperty(self, "direction", 0);
      } else if(Plat!=PlatA && PlatA==PlatB && Dir==0){
        changeentityproperty(self, "velocity", Vx);
        changeentityproperty(self, "direction", 1);
      }
    }
}


----------platforma lewoprawo

    @script
    void self = getlocalvar("self");
    int Dir = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    void Plat = checkplatformbelow(x, z, y+2);
    void PlatA; void PlatB;

    if(Plat){ // on a platform
      if(Dir==1){
        PlatA = checkplatformbelow(x+5, z, y+2);
        PlatB = checkplatformbelow(x+5, z, y-2);
      } else {
        PlatA = checkplatformbelow(x-5, z, y+2);
        PlatB = checkplatformbelow(x-5, z, y-2);
      }

      if(Plat!=PlatA && PlatA==PlatB && Dir==1){
        changeentityproperty(self, "velocity", -2);
        changeentityproperty(self, "direction", 0);
      } else if(Plat!=PlatA && PlatA==PlatB && Dir==0){
        changeentityproperty(self, "velocity", 2);
        changeentityproperty(self, "direction", 1);
      }
    }

    @end_script

-------------------- sciana i automatobrot
    @script
    void self = getlocalvar("self");
    int Dir = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int Wall = checkwall(x,z);
    int WallC;

    if(Dir==1){
      WallC = checkwall(x+10,z);
    } else {
      WallC = checkwall(x-10,z);
    }

    if(Wall!=0 && Wall > WallC && Dir==1){
      changeentityproperty(self, "velocity", -2);
      changeentityproperty(self, "direction", 0);
    } else if(Wall!=0 && Wall > WallC && Dir==0){
      changeentityproperty(self, "velocity", 2);
      changeentityproperty(self, "direction", 1);
    }

    @end_script

--
wallplatnofall


@script
    void self = getlocalvar("self");
    int Dir = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    int Width = openborvariant("levelwidth");
    void Plat = checkplatformbelow(x, z, y+2);
    int Length; int Px; void PlatA; void PlatB; int Wall;

    if(x > Width - 10){
      changeentityproperty(self, "velocity", -1);
      changeentityproperty(self, "direction", 0);
    } else if(x < 10){
      changeentityproperty(self, "velocity", 1);
      changeentityproperty(self, "direction", 1);
    } else if(Plat){ // on a platform
      Length = getentityproperty(Plat, "antigrab");
      Px = getentityproperty(Plat, "x");
      if(Dir==1){
        PlatA = checkplatformbelow(x+24, z, y+2);
        PlatB = checkplatformbelow(x+24, z, y-2);
      } else {
        PlatA = checkplatformbelow(x-24, z, y+2);
        PlatB = checkplatformbelow(x-24, z, y-2);
      }

      if(x >= Px + Length/2 - 23 && PlatA==PlatB){
        changeentityproperty(self, "velocity", -1);
        changeentityproperty(self, "direction", 0);
      } else if(x <= Px - Length/2 + 23 && PlatA==PlatB){
        changeentityproperty(self, "velocity", 1);
        changeentityproperty(self, "direction", 1);
      }
    } else { // on a wall
      if(Dir==1){
        Wall = checkwall(x+26,z);
      } else {
        Wall = checkwall(x-26,z);
      }

      if(y > Wall && Dir==1){
        changeentityproperty(self, "velocity", -1);
        changeentityproperty(self, "direction", 0);
      } else if(y > Wall && Dir==0){
        changeentityproperty(self, "velocity", 1);
        changeentityproperty(self, "direction", 1);
      }
    }
@end_script

----
wall bump and turn

@script
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int Dir = getentityproperty(self, "direction");
    int sped = getentityproperty(self, "speed");
    int Sx = 1;
if(Dir==0){
     Sx = -Sx;
     changeentityproperty(self, "velocity", 0-sped );
    }
if(Dir==1){
     changeentityproperty(self, "velocity", sped );
    }
    void Plat = checkwall(x+Sx, z);
if( Dir == 0 && frame > 0 && x-(x-Plat) > 20 ){
     changeentityproperty(self, "direction", 1 );
    }
if( Dir == 1 && frame > 0 && x-(x-Plat) > 20 ){
    changeentityproperty(self, "direction", 0 );
     }
@end_script

---
platform end and turn

@script
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int y = getentityproperty(self, "a");
    int Dir = getentityproperty(self, "direction");
    int sped = getentityproperty(self, "speed");
    void  Plat = checkplatformbetween(x, z, y-100, 200);
if(Dir==0){
  changeentityproperty(self, "velocity", -1  ,0,0);
    }
if(Dir==1){
  changeentityproperty(self, "velocity", 1  ,0,0);
    }
    if(Dir==0 && x+getentityproperty(Plat, "health")/2+2 <= getentityproperty(Plat, "x")){
      changeentityproperty(self, "direction", 1 );
    }
        if(Dir==1 && x-getentityproperty(Plat, "health")/2-2 >= getentityproperty(Plat, "x")){
      changeentityproperty(self, "direction", 0 );
    }
@end_script
 
Ah bWWd, thanks for posting scripts that I made for my platformers :cool: .

@dmolina007 : I may need to browse my HD to find that mod you're referring however judging from the video, I'm sure Goomba and Koopa AI is default and it's not what you're looking for.

If you want to create Goomba type enemy which moves about ignoring player, you only need to force the enemy into looping animation (specifically ATTACK, FOLLOW and FREESPECIAL animation). Despite their hostile setting, enemies locked in a looping animation will be clueless and just perform the animation ignoring player.

I suggest you download one of my platformers to see examples on how such enemies is coded. You can try Cherry On Top.
 
Ah bWWd, thanks for posting scripts that I made for my platformers :cool: .

@dmolina007 : I may need to browse my HD to find that mod you're referring however judging from the video, I'm sure Goomba and Koopa AI is default and it's not what you're looking for.

If you want to create Goomba type enemy which moves about ignoring player, you only need to force the enemy into looping animation (specifically ATTACK, FOLLOW and FREESPECIAL animation). Despite their hostile setting, enemies locked in a looping animation will be clueless and just perform the animation ignoring player.

I suggest you download one of my platformers to see examples on how such enemies is coded. You can try Cherry On Top.
Thank You, I recall that one and kept searching on chronocrash for "platform" and "platformer" but it never came up. Thanks a bunch.
 
I have several for walking left/right automatically , you have to check them out yourself, i dont remember which was the best one for what scenario
Code:
walllplatform dirchange--------------------------------



void StayPlat(int Rx, int Vx)
{// Finds platform edge within defined range. Turn around if edge is found
// Rx : Check distance in x axis
// Vx : Velocity to move
    void self = getlocalvar("self");
    int Dir = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    void Plat = checkplatformbelow(x, z, y+2);
    void PlatA; void PlatB;

    if(Plat){ // on a platform
      if(Dir==1){
        PlatA = checkplatformbelow(x+Rx, z, y+2);
        PlatB = checkplatformbelow(x+Rx, z, y-2);
      } else {
        PlatA = checkplatformbelow(x-Rx, z, y+2);
        PlatB = checkplatformbelow(x-Rx, z, y-2);
      }

      if(Plat!=PlatA && PlatA==PlatB && Dir==1){
        changeentityproperty(self, "velocity", -Vx);
        changeentityproperty(self, "direction", 0);
      } else if(Plat!=PlatA && PlatA==PlatB && Dir==0){
        changeentityproperty(self, "velocity", Vx);
        changeentityproperty(self, "direction", 1);
      }
    }
}


----------platforma lewoprawo

    @script
    void self = getlocalvar("self");
    int Dir = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    void Plat = checkplatformbelow(x, z, y+2);
    void PlatA; void PlatB;

    if(Plat){ // on a platform
      if(Dir==1){
        PlatA = checkplatformbelow(x+5, z, y+2);
        PlatB = checkplatformbelow(x+5, z, y-2);
      } else {
        PlatA = checkplatformbelow(x-5, z, y+2);
        PlatB = checkplatformbelow(x-5, z, y-2);
      }

      if(Plat!=PlatA && PlatA==PlatB && Dir==1){
        changeentityproperty(self, "velocity", -2);
        changeentityproperty(self, "direction", 0);
      } else if(Plat!=PlatA && PlatA==PlatB && Dir==0){
        changeentityproperty(self, "velocity", 2);
        changeentityproperty(self, "direction", 1);
      }
    }

    @end_script

-------------------- sciana i automatobrot
    @script
    void self = getlocalvar("self");
    int Dir = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int Wall = checkwall(x,z);
    int WallC;

    if(Dir==1){
      WallC = checkwall(x+10,z);
    } else {
      WallC = checkwall(x-10,z);
    }

    if(Wall!=0 && Wall > WallC && Dir==1){
      changeentityproperty(self, "velocity", -2);
      changeentityproperty(self, "direction", 0);
    } else if(Wall!=0 && Wall > WallC && Dir==0){
      changeentityproperty(self, "velocity", 2);
      changeentityproperty(self, "direction", 1);
    }

    @end_script

--
wallplatnofall


@script
    void self = getlocalvar("self");
    int Dir = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    int Width = openborvariant("levelwidth");
    void Plat = checkplatformbelow(x, z, y+2);
    int Length; int Px; void PlatA; void PlatB; int Wall;

    if(x > Width - 10){
      changeentityproperty(self, "velocity", -1);
      changeentityproperty(self, "direction", 0);
    } else if(x < 10){
      changeentityproperty(self, "velocity", 1);
      changeentityproperty(self, "direction", 1);
    } else if(Plat){ // on a platform
      Length = getentityproperty(Plat, "antigrab");
      Px = getentityproperty(Plat, "x");
      if(Dir==1){
        PlatA = checkplatformbelow(x+24, z, y+2);
        PlatB = checkplatformbelow(x+24, z, y-2);
      } else {
        PlatA = checkplatformbelow(x-24, z, y+2);
        PlatB = checkplatformbelow(x-24, z, y-2);
      }

      if(x >= Px + Length/2 - 23 && PlatA==PlatB){
        changeentityproperty(self, "velocity", -1);
        changeentityproperty(self, "direction", 0);
      } else if(x <= Px - Length/2 + 23 && PlatA==PlatB){
        changeentityproperty(self, "velocity", 1);
        changeentityproperty(self, "direction", 1);
      }
    } else { // on a wall
      if(Dir==1){
        Wall = checkwall(x+26,z);
      } else {
        Wall = checkwall(x-26,z);
      }

      if(y > Wall && Dir==1){
        changeentityproperty(self, "velocity", -1);
        changeentityproperty(self, "direction", 0);
      } else if(y > Wall && Dir==0){
        changeentityproperty(self, "velocity", 1);
        changeentityproperty(self, "direction", 1);
      }
    }
@end_script

----
wall bump and turn

@script
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int Dir = getentityproperty(self, "direction");
    int sped = getentityproperty(self, "speed");
    int Sx = 1;
if(Dir==0){
     Sx = -Sx;
     changeentityproperty(self, "velocity", 0-sped );
    }
if(Dir==1){
     changeentityproperty(self, "velocity", sped );
    }
    void Plat = checkwall(x+Sx, z);
if( Dir == 0 && frame > 0 && x-(x-Plat) > 20 ){
     changeentityproperty(self, "direction", 1 );
    }
if( Dir == 1 && frame > 0 && x-(x-Plat) > 20 ){
    changeentityproperty(self, "direction", 0 );
     }
@end_script

---
platform end and turn

@script
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int y = getentityproperty(self, "a");
    int Dir = getentityproperty(self, "direction");
    int sped = getentityproperty(self, "speed");
    void  Plat = checkplatformbetween(x, z, y-100, 200);
if(Dir==0){
  changeentityproperty(self, "velocity", -1  ,0,0);
    }
if(Dir==1){
  changeentityproperty(self, "velocity", 1  ,0,0);
    }
    if(Dir==0 && x+getentityproperty(Plat, "health")/2+2 <= getentityproperty(Plat, "x")){
      changeentityproperty(self, "direction", 1 );
    }
        if(Dir==1 && x-getentityproperty(Plat, "health")/2-2 >= getentityproperty(Plat, "x")){
      changeentityproperty(self, "direction", 0 );
    }
@end_script
This is helpful, Thank You.
 
Back
Top Bottom