Solved A question about blocks.

Question that is answered or resolved.

DD Tokki

Well-known member
I'm making a defense system by making blues (proto man) this time.
bor - 0033.png

The code is below.

Code:
void block(int Flag)
{
    void self = getlocalvar("self");

    if(Flag == 1)
    {
        changeentityproperty(self, "aiflag", "blocking", 1);
        changeentityproperty(self, "takeaction", "common_block");
    } else {
        changeentityproperty(self, "aiflag", "blocking", 0);
    }
}


com u freespecial5


anim freespecial5
loop 0
delay 30
offset 8 23
bbox 1 0 19 24
@cmd block 1
frame data/sprites/chara/blues/block-01.gif



In this way, I wrote a script to press the command upward to bring out the defense action.
However, as you can see in the screenshot, the result was that the missile penetrated.

What I expected was that the defense would be successful in freespecial5 with the script applied.

Maybe something went wrong?
 
I'm making a defense system by making blues (proto man) this time.
View attachment 3484

The code is below.

Code:
void block(int Flag)
{
    void self = getlocalvar("self");

    if(Flag == 1)
    {
        changeentityproperty(self, "aiflag", "blocking", 1);
        changeentityproperty(self, "takeaction", "common_block");
    } else {
        changeentityproperty(self, "aiflag", "blocking", 0);
    }
}


com u freespecial5


anim freespecial5
loop 0
delay 30
offset 8 23
bbox 1 0 19 24
@cmd block 1
frame data/sprites/chara/blues/block-01.gif



In this way, I wrote a script to press the command upward to bring out the defense action.
However, as you can see in the screenshot, the result was that the missile penetrated.

What I expected was that the defense would be successful in freespecial5 with the script applied.

Maybe something went wrong?
The script is correct. Maybe the hitboxes are not colliding or the block animation is ending too early.
 
Looks like the projectile's facing direction is affecting the collision. Can you post the projectile entities that are shown in the video?
This is Pharaoh Man's projectile.

name Pharaoh-B_
type none
nomove 1
antigravity 100
shadow 0
offscreenkill 0
candamage player

animationscript data/scripts/scriptb.c

anim idle
loop 1
fastattack 1
delay 4
offset 6 5
attack -1 -1 14 14 12 0 0 0 8 0
hitflash hit-b
hitfx data/sounds/hit2.wav
dropv 2 2 0
forcedirection -1
frame data/sprites/chara/pharaoh/buster-b01.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b01.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b02.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b03.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b04.gif
@cmd updateframe getlocalvar("self") 1
frame data/sprites/chara/pharaoh/buster-b04.gif
 
Looks like the projectile's facing direction is affecting the collision. Can you post the projectile entities that are shown in the video?
Ah.. If there is one thing I found out, it is correct that Pharaoh Man's projectile was made to penetrate. It was because there was no reaction from the blues.
 
This is Pharaoh Man's projectile.

name Pharaoh-B_
type none
nomove 1
antigravity 100
shadow 0
offscreenkill 0
candamage player

animationscript data/scripts/scriptb.c

anim idle
loop 1
fastattack 1
delay 4
offset 6 5
attack -1 -1 14 14 12 0 0 0 8 0
hitflash hit-b
hitfx data/sounds/hit2.wav
dropv 2 2 0
forcedirection -1
frame data/sprites/chara/pharaoh/buster-b01.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b01.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b02.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b03.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b04.gif
@cmd updateframe getlocalvar("self") 1
frame data/sprites/chara/pharaoh/buster-b04.gif
At first sight it looks correct, I suggest removing the "nomove" command and see the effect.
 
You can set loop with certain frame like this without needing updateframe for it to repeat its loop for repeating to the second frame after the last.

Code:
anim idle
loop 1 1 # loop {loop} {start} {end}
fastattack 1
delay 4
offset 6 5
attack -1 -1 14 14 12 0 0 0 8 0
hitflash hit-b
hitfx data/sounds/hit2.wav
dropv 2 2 0
forcedirection -1
frame data/sprites/chara/pharaoh/buster-b01.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b01.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b02.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b03.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b04.gif

Just in case for simplicity purpose unless the looping goes very weird and unstable.
 
You can set loop with certain frame like this without needing updateframe for it to repeat its loop for repeating to the second frame after the last.

Code:
anim idle
loop 1 1 # loop {loop} {frame}
fastattack 1
delay 4
offset 6 5
attack -1 -1 14 14 12 0 0 0 8 0
hitflash hit-b
hitfx data/sounds/hit2.wav
dropv 2 2 0
forcedirection -1
frame data/sprites/chara/pharaoh/buster-b01.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b01.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b02.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b03.gif
@cmd groundkill
frame data/sprites/chara/pharaoh/buster-b04.gif

Just in case for simplicity purpose unless the looping goes very weird and unstable.
Were you able to set it right in the loop? Thanks, this was a feature I needed every time.
 
Yes. I use it a lot. :) Oh! I forgot to show you this one.

loop {bi} {start} {end}

  • Determines how loop effect is applied in current animation
  • {bi} toggles looping on or off.
    • 0 = looping off
    • 1 = looping on
  • {start} determines the number of frame the animation loops to. Defaults to 0 or 1st frame.
  • {end} determines the number of frame which starts the loop. If left blank, the animation will loop at the end of animation.
  • Some animations should NOT be set to loop (loop temporary at least). Examples include most attacks and injured animations.
 
Which script you use to spawn the projectile? I would like to take a look.
Code:
void shoot(void Shot, float dx, float dy)
{ // Shooting targetted projectile
   void self = getlocalvar("self");
   float Vx = getlocalvar("x"+self);
   float Vy = getlocalvar("y"+self);
   void vShot;

   if( Vx!=NULL() && Vy!=NULL() ){
     vShot = shooter(Shot, dx, dy, Vx, Vy);
     changeentityproperty(vShot, "velocity", Vx, 0, 2*Vy); //Move projectile towards target!
   }
}

I used this script and target.h to create a projectile that detects players like a shooter.
By the way, I tested it with missiles from other bosses, and seeing that Blues didn't respond, I think I was missing something from Blues.
 
Code:
void shoot(void Shot, float dx, float dy)
{ // Shooting targetted projectile
   void self = getlocalvar("self");
   float Vx = getlocalvar("x"+self);
   float Vy = getlocalvar("y"+self);
   void vShot;

   if( Vx!=NULL() && Vy!=NULL() ){
     vShot = shooter(Shot, dx, dy, Vx, Vy);
     changeentityproperty(vShot, "velocity", Vx, 0, 2*Vy); //Move projectile towards target!
   }
}

I used this script and target.h to create a projectile that detects players like a shooter.
By the way, I tested it with missiles from other bosses, and seeing that Blues didn't respond, I think I was missing something from Blues.
I want to see the script that generates the projectile, in this case the "shooter" function.
Sometimes the problem is in places where we never imagine, I suggest considering every option like having a problem with the projectile too instead of the "Blues" entity.

EDIT: Question, are you using the shield with an additional entity? If I'm not wrong, you asked about it on another topic. I see that the projectile is programmed to only hit type "player" entities in the candamage section, and certainly the additional shield is not considered a player.
 
Last edited:
I want to see the script that generates the projectile, in this case the "shooter" function.
Sometimes the problem is in places where we never imagine, I suggest considering every option like having a problem with the projectile too instead of the "Blues" entity.
#include "data/scripts/library/target.h" (*****.h contains void shoot and void target.)

target

Code:
void target(float Velx, float Vely, float dx, float dy, int Stop, int Flip)
{// Targetting opponent before leaping or dashing.
// Velx = x Velocity
// Vely = y Velocity
// dx = x added distance
// dy = y added distance
// Stop = flag to stop moving if no target is found

    void self = getlocalvar("self");

    setlocalvar("T"+self, findtarget(self)); //Get nearest player

    void target = getlocalvar("T"+self);
    setlocalvar("x"+self, target1(target, Velx, Vely, dx, dy, Stop, "x", Flip) );
    setlocalvar("y"+self, target1(target, Velx, Vely, dx, dy, Stop, "y", Flip) );
    setlocalvar("T"+self, NULL()); //Clears variable
}

shoot

Code:
void shoot(void Shot, float dx, float dy)
{ // Shooting targetted projectile
   void self = getlocalvar("self");
   float Vx = getlocalvar("x"+self);
   float Vy = getlocalvar("y"+self);
   void vShot;

   if( Vx!=NULL() && Vy!=NULL() ){
     vShot = shooter(Shot, dx, dy, Vx, Vy);
     changeentityproperty(vShot, "velocity", Vx, 0, 2*Vy); //Move projectile towards target!
   }
}

anim freespecial3
range 60 200
loop 0
jumpframe 0 4 1
landframe 6
delay 4
offset 15 29
bbox 7 0 16 30
sound data/sounds/jump-.wav
attack 7 0 16 30 16 1 0 0 30 0
hitfx data/sounds/hit2.wav
hitflash hit-b
dropv 2 3 0
forcedirection -1
@cmd degravity 0
@cmd immunity 0.6
frame data/sprites/chara/pharaoh/jump.gif
delay 10
offset 12 29
bbox 4 0 16 30
attack 4 0 16 30 16 1 0 0 30 0
dropv 2 3 0
forcedirection -1
frame data/sprites/chara/pharaoh/jump-attack-b01.gif
delay 7
offset 12 34
bbox 4 5 16 30
attack 4 5 16 30 16 1 0 0 30 0
dropv 2 3 0
forcedirection -1
frame data/sprites/chara/pharaoh/jump-attack-b02.gif
delay 20
offset 12 36
bbox 4 7 16 30
attack 4 7 16 30 16 1 0 0 30 0
dropv 2 3 0
forcedirection -1
frame data/sprites/chara/pharaoh/jump-attack-b03.gif
delay 6
offset 12 32
bbox 4 4 16 29
attack 4 4 16 29 16 1 0 0 30 0
dropv 2 3 0
forcedirection -1
sound data/sounds/pharaoh/buster1.wav
@cmd target 1.7 1.7 0 0 9999
@cmd shoot "pharaoh-b_" 12 18 1
frame data/sprites/chara/pharaoh/jump-attack-b04.gif
delay 999
offset 12 30
bbox 4 2 16 29
attack 4 2 16 29 16 1 0 0 30 0
dropv 2 3 0
forcedirection -1
frame data/sprites/chara/pharaoh/jump-attack-b05.gif
delay 20
offset 12 24
sound data/sounds/landing-b.wav
@cmd degravity 0.5
frame data/sprites/chara/pharaoh/rise.gif

Here are the Pharaoh Man moves.
There is a script applied in the middle.

Blues doesn't respond to the normal missiles of other robot masters, so it doesn't seem to be Pharaoh Man's problem.
 
I want to see the script that generates the projectile, in this case the "shooter" function.
The void shoot you already posted, instead I want to see the void shooter.
I need to know how this function is coded because I'm trying to replicate this issue in my game.

1679785479152.png
 
The void shoot you already posted, instead I want to see the void shooter.
I need to know how this function is coded because I'm trying to replicate this issue in my game.

View attachment 3485
delay 6
offset 12 32
bbox 4 4 16 29
attack 4 4 16 29 16 1 0 0 30 0
dropv 2 3 0
forcedirection -1
sound data/sounds/pharaoh/buster1.wav
@cmd target 1.7 1.7 0 0 9999
@cmd shoot "pharaoh-b_" 12 18 1
frame data/sprites/chara/pharaoh/jump-attack-b04.gif

If you set @cmd target and @cmd shoot together, projectile will automatically aim at the player position.
 
@DD Tokki
Sorry friend, I can't replicate the issue in my game without seeing how the shooter function is coded.
I can take a look at your game file directly if you send me a copy.
 
Back
Top Bottom