Enemies Jumping to platforms after you..

esn23

Active member
I was wondering if i could get my enemies to come after me when i jump up on platforms and such.. Here is my example..
bor_-_0241.png

Im on top of the barrels, they just attack the barrels and run into them... I want them to be able to chase after me and get on barrels too.. I had a script that was supposed to do it am i using it worng...
anim walk
@script
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int b = getentityproperty(self, "base");
    int z = getentityproperty(self, "z");
    int Dir = getentityproperty(self, "direction");
    int Sx = 50; int Py; int PH;

    if(Dir==0){
      Sx = -50;
    }

    void Plat = checkplatformbelow(x+Sx, z, y+40);

    if(Plat){
      PH = getentityproperty(Plat, "grabforce");
      Py = getentityproperty(Plat, "a");
     
      if(Py+PH <= b+40 && Py >= b){
        changeentityproperty(self, "velocity", 0, 0, 0);
        performattack(self, openborconstant("ANI_FOLLOW8"));
      }
    }
@end_script
        bbox 51 45 24 48
offset 67 114
loop 1
delay 20
        frame data/chars/primefem/w1.png
        frame data/chars/primefem/w2.png
        frame data/chars/primefem/w3.png

anim  follow8
delay 3
        offset  75 153
landframe 5
jumpframe 1 4 1 0
        drawmethod 256 256 0 0 0 6 0 0 0 0
        sound data/chars/emma/fireball.wav
        frame data/chars/primefem/tel1.png
        frame data/chars/primefem/tel2.png
        frame data/chars/primefem/tel1.png
        frame data/chars/primefem/tel2.png
        frame data/chars/primefem/tel3.png
        frame data/chars/primefem/a4-2.png

and here is my platform
name      tin
type      obstacle
onspawnscript data/scripts/carspawn.c
projectilehit enemy obstacle
cantgrab 1
antigrab  31 # platform width
grabforce  35 # platform height
knockdowncount 9999
nodrop 2
falldie 1


anim idle
loop 0
offset 18 51
delay 10
platform 18 51 0 0 38 53 0 51
frame data/bgs/subway/tin.png

anim walk
@script
void self = getlocalvar("self"); //Get calling entity.

changeentityproperty(self, "velocity", 0, 0);
        setidle(self, openborconstant("ANI_IDLE"));
@end_script
delay 10
offset 18 51
bbox 19 36 34 33
platform 18 51 0 0 38 53 0 51
frame data/bgs/subway/tin.png
frame data/bgs/subway/tin.png

TY for the help
 
Ens, please do not do this. If nobody had replied yet, it can be many things, like
- they doesn't know
- they are trying to solve
- they are just busy,

Bumping your own topic complaning that nobody had helped you won't benefict you AT ALL. In fact, makes you look bad.
 
O Ilusionista said:
Ens, please do not do this. If nobody had replied yet, it can be many things, like
- they doesn't know
- they are trying to solve
- they are just busy,

Bumping your own topic complaning that nobody had helped you won't benefict you AT ALL. In fact, makes you look bad.

Was it really necessary to say all this.. You know im not a bad person and im not trying to make myself look bad.. I was joking around :P  Calm down :) 
 
I don't see an answer here so I'll provide what I did with my enemies to make them jump up or down platforms after me, however because of this they will jump after me if I jump over them while trying to attack me, so if you fix this I'd like to see it.

Code:
anim	attack1
	range	20 140
	loop	0
	delay	40
	bbox	56 46 35 52
	offset	76 94
	throwframe	1	-1
	move	0
	@cmd	attack1 0 87 50 250 "ANI_Freespecial2"
	@cmd	attack1 0 87 -250 -20 "ANI_Freespecial1"
	frame	data/chars/Badnick/Attack-1.gif
	delay	5
	frame	data/chars/Badnick/Attack-2.gif
	frame	data/chars/Badnick/Attack-3.gif
	frame	data/chars/Badnick/Attack-4.gif
	frame	data/chars/Badnick/Attack-5.gif
	frame	data/chars/Badnick/Attack-6.gif
	frame	data/chars/Badnick/Attack-7.gif
	frame	data/chars/Badnick/Attack-8.gif
	frame	data/chars/Badnick/Attack-9.gif
	delay	14
	frame	data/chars/Badnick/Idle-1.gif

anim	freespecial1
	loop	0
	delay	6
	offset	76 94
	bbox	68 41 30 54
	Jumpframe	0 1 0
	Landframe	31
	Range	0 70
	Rangea	0 -20
	@cmd	changeentityproperty getlocalvar("self") "Subject_to_Platform" 0
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	@cmd	changeentityproperty getlocalvar("self") "Subject_to_Platform" 1
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
		
anim	freespecial2
	loop	0
	delay	6
	offset	76 94
	bbox	69 41 28 54
	Jumpframe	0 4 1
	Landframe	31
	range	0 70
	rangea	40 100
	@cmd	changeentityproperty getlocalvar("self") "Subject_to_Platform" 1
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF
	frame	data/chars/BadnickH/Hover-1.GIF
	frame	data/chars/BadnickH/Hover-2.GIF

Hope it helps some, it's not perfect.

x)
 
You mean the script for it? If that, here it is.
Code:
void attack1(int RxMin, int RxMax, int RyMin, int RyMax, void Ani)
{// Attack interruption with range check
    void self = getlocalvar("self");
    void target = findtarget(self); //Get nearest player
    float x = getentityproperty(self, "x");
    float y = getentityproperty(self, "a");
    int dir = getentityproperty(self, "direction");

    if(target!=NULL()){
      float Tx = getentityproperty(target, "x");
      float Ty = getentityproperty(target, "a");
      float Disx = Tx - x;
      float Disy = Ty - y;

      if( Disx >= RxMin && Disx <= RxMax && Disy >= RyMin && Disy <= RyMax && dir == 1) // Target within range on right facing?
      {
        performattack(self, openborconstant(Ani)); //Change the animation
      } else if( Disx >= -RxMax && Disx <= -RxMin && Disy >= RyMin && Disy <= RyMax && dir == 0) // Target within range on left facing?
      {
        performattack(self, openborconstant(Ani)); //Change the animation
      }
    }
}

x)
 
After rereading this thread, I need to tell that platforms in his mod uses antigrab and grabforce to define their length and height.
By comparing platform's height with jump height etc, entity can decide whether to jump on the platform or not

I've fixed the script into this:
Code:
anim   walk
   @script
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int b = getentityproperty(self, "base");
    int z = getentityproperty(self, "z");
    int Dir = getentityproperty(self, "direction");
    int Sx = 50; int Sy = 100; int Py; int PH;

    if(Dir==0){
      Sx = -50;
    }

    void Plat = checkplatformbelow(x+Sx, z, y+Sy);

    if(Plat){
      PH = getentityproperty(Plat, "grabforce");
      Py = getentityproperty(Plat, "a");
     
      if(Py+PH <= b+Sy && Py >= b){
        changeentityproperty(self, "velocity", 0, 0, 0);
        performattack(self, openborconstant("ANI_FOLLOW8"));
      }
    }
@end_script
...

This one has higher checking range allowing the enemies to find the platform and jump on it

I gave him this animation script cause the script was still a test. If esn uses this script in multiple enemies and bosses, he should use function version of this instead
 
That's fine, this could be a big help with Sega Brawlers cause I settled for what I use for years. BTW, any chance I could see some platform coding with antigrab and grabforce on it, and can someone post the script function for this?

x)
 
Alright, I've made function version of that script:
Code:
void PlatAct(int Sx, int Sy, void Ani)
{// Checks for platform then perform animation when a platform is found
// Sx : Horizontal check distance
// Sy : Vertical check distance
// Ani : Animation to change to
    void self = getlocalvar("self");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int b = getentityproperty(self, "base");
    int z = getentityproperty(self, "z");
    int Dir = getentityproperty(self, "direction");
    int Py; int PH;

    if(Dir==0){
      Sx = -Sx;
    }

    void Plat = checkplatformbelow(x+Sx, z, y+Sy);

    if(Plat){
      PH = getentityproperty(Plat, "grabforce");
      Py = getentityproperty(Plat, "a");
     
      if(Py+PH <= b+Sy && Py >= b){
        changeentityproperty(self, "velocity", 0, 0, 0);
        performattack(self, openborconstant(Ani));
      }
    }
}

Miru said:
How can one also alter this so that after they jump, they soon perform an attack in mid air if the player is in range?

You don't need to alter this function. All you need to do is to declare ATTACK1 function in the jump animation to attack player. DJ has posted the function in previous page
 
Back
Top Bottom