A question about the movement of AI.

DD Tokki

Well-known member
hello. As more and more people test recently, the pros and cons of my game are becoming clearer. It is a very grateful situation.

One of the problems is that it shows a very linear movement even with the naked eye.
Can the AI change its behavior or attack pattern depending on its HP state?
Or is there a script that normally moves more elaborately?

Or something else, if the AI only approaches the wall, it will try to keep jumping. Could it be possible to apply a different behavior?

I want to give a luxurious change to a monotonous movement.
 
Of course it requires loop 1 for the script to work cause entity needs to check its health as often as possible before deciding to change AI.
So the script in question would be like this?
C:
anim    idle

loop 1

@script

  if(frame > 0){

    void self = getlocalvar("self");

    int MHP = getentityproperty(self,"maxhealth");

    int HP = getentityproperty(self,"health");



    if(HP < MHP*0.5){

      changeentityproperty(self, "aimove", openborconstant("AIMOVE1_AVOID"));

    }

  }

@end_script

frame    data/chars/cody/idle.gif
frame    data/chars/cody/idle.gif
frame    data/chars/cody/idle.gif
frame    data/chars/cody/idle.gif
frame    data/chars/cody/idle.gif
 
Hi @Bloodbane, a doubt has arisen in my mind: the script below
C:
anim    idle

loop 1

@script

  if(frame > 0){

    void self = getlocalvar("self");

    int MHP = getentityproperty(self,"maxhealth");

    int HP = getentityproperty(self,"health");



    if(HP < MHP*0.5){

      changeentityproperty(self, "aimove", openborconstant("AIMOVE1_AVOID"));

    }

  }

@end_script

frame    data/chars/cody/idle.gif
frame    data/chars/cody/idle.gif
frame    data/chars/cody/idle.gif
frame    data/chars/cody/idle.gif
frame    data/chars/cody/idle.gif
should also be put in the weapons' anim idle?
C:
name        Cody1_
type        none
shadow        0
mp          100
noquake     1
makeinv     5
playshotno  sp
atchain     1 1 1 1 1
typeshot    1
icon        data/chars/cody/iconw.gif
diesound    data/sounds/pdie2.wav.wav

lifeposition 26   20
namepostion 28   12
iconposition 0      3
lifebarstatus 50 3

anim idle
    loop    1
    delay    13
    offset    81 176
    bbox    61 95 41 79
    frame    data/chars/cody2/swidle.gif
 
Last edited:
Hi @Bloodbane, I made the two scripts more complete. I think they are OK.

C:
@script
  if(frame > 0){
    void self = getlocalvar("self");
    int MHP = getentityproperty(self,"maxhealth");
    int HP = getentityproperty(self,"health");

    if(HP == MHP*0.5){
      changeentityproperty(self, "aimove", openborconstant("AIMOVE1_NORMAL"));
      changeentityproperty(self, "attackthrottle", 0.2);
      changeentityproperty(self, "attackthrottletime", 80);
      changeentityproperty(self, "blockodds", 500);
    }
    
    if(HP < MHP*0.5){
      changeentityproperty(self, "aimove", openborconstant("AIMOVE1_AVOID"));
      changeentityproperty(self, "attackthrottle", 0.4);
      changeentityproperty(self, "attackthrottletime", 100);
      changeentityproperty(self, "blockodds", 1);
    }
  }
@end_script

C:
void main(){
  void self = getlocalvar("self");
  int MHP = getentityproperty(self,"maxhealth");
  int HP = getentityproperty(self,"health");

    if(HP == MHP*0.5){
    changeentityproperty(self, "aimove", openborconstant("AIMOVE1_NORMAL"));
    changeentityproperty(self, "attackthrottle", 0.2);
    changeentityproperty(self, "attackthrottletime", 80);
    changeentityproperty(self, "blockodds", 500);
  }


    if(HP < MHP*0.5){
    changeentityproperty(self, "aimove", openborconstant("AIMOVE1_AVOID"));
    changeentityproperty(self, "attackthrottle", 0.4);
    changeentityproperty(self, "attackthrottletime", 100);
    changeentityproperty(self, "blockodds", 1);

  }
}
 
Back
Top Bottom