Solved question about the spawnbind script.

Question that is answered or resolved.

DD Tokki

Well-known member

In fact, I'm finally posting a problem I've been experiencing before.
Previously, Spawnbind was used to fix Rugal's xenosidecutter synchronization issues.
As the motion progresses, the effect is also fixed together.
If you look at the video, if you get hit by Rugal's attack before the sync action comes out, there's nothing wrong, and if you get hit by Rugal's attack while the sync action comes out, there's a bug where the flash stays like a stamp.
This is a phenomenon that occurs in projectile attacks without any problems such as fist attacks.

Code:
void spawnbind(void Name, float dx, float dy, float dz, int iDir, int iBind)
{ // Spawn and bind other entity
 // [iDir]
 //  0 = No change.
 //  1 = Same direction as target.
 // -1 = Opposite direction as target.
 //  2 = Always right.
 // -2 = Always left.
 // [iBind]
 //  0 = No effect.
 //  1 = Keep same animation as the target.
 //  2 = Also keep same frame as the target.
 //  4 = Kill the entity if the animation doesn't match.
 // You can combine those values for bindanimation, so it can be 6 which means 2 and 4.

   void self = getlocalvar("self");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, 4);
   bindentity(Spawn, self, dx, dz, dy, iDir, iBind);
}

The applied script is as follows.
"4 = Kill the entity if the animation doesn't match." This and #6 seem to be the cause of the symptoms described above, but I would like some help with a definitive solution.
 
I encountered this bug
@DD Tokki
Before considering any issue as an engine bug, we need first make all possible tests and try everything the engine can offer. Please, can you give more details about what bind connection you are trying to achieve? Who is calling the @cmd spawnbind, and what does this energy orb do to the Rugal's spell (reflection or nullify)?

Just posting the spawnbind script does not help too much, we need the animations involved too.

If you are trying to kill a hitflash you can simply put a sucide script in the last frame, like this.

C:
name            Flash
type            none
no_adjust_base    0
subject_to_hole    1
shadow            0
antigravity     100
toflip            0
onspawnscript    data/scripts/onspawn/graphics.c
animationscript    data/scripts/animation/default.c

anim idle
    loop    0
    delay    1
    offset    49 49
    drawmethod scale 0.1
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.2
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.3
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.4
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.5
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.6
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.7
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.8
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.9
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.1
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.2
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.3
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.4
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.5
    frame    data/chars/misc/flash/flash00.png
    @cmd suicide
    frame    data/chars/misc/flash/flash00.png

C:
void suicide()
{//Suicide!!
    void self = getlocalvar("self");

    killentity(self); //SUICIDE!
}
 
@DD Tokki
Before considering any issue as an engine bug, we need first make all possible tests and try everything the engine can offer. Please, can you give more details about what bind connection you are trying to achieve? Who is calling the @cmd spawnbind, and what does this energy orb do to the Rugal's spell (reflection or nullify)?

Just posting the spawnbind script does not help too much, we need the animations involved too.

If you are trying to kill a hitflash you can simply put a sucide script in the last frame, like this.

C:
name            Flash
type            none
no_adjust_base    0
subject_to_hole    1
shadow            0
antigravity     100
toflip            0
onspawnscript    data/scripts/onspawn/graphics.c
animationscript    data/scripts/animation/default.c

anim idle
    loop    0
    delay    1
    offset    49 49
    drawmethod scale 0.1
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.2
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.3
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.4
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.5
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.6
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.7
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.8
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 0.9
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.1
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.2
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.3
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.4
    frame    data/chars/misc/flash/flash00.png
    drawmethod scale 1.5
    frame    data/chars/misc/flash/flash00.png
    @cmd suicide
    frame    data/chars/misc/flash/flash00.png

C:
void suicide()
{//Suicide!!
    void self = getlocalvar("self");

    killentity(self); //SUICIDE!
}
c.PNG

Code:
anim    follow1 (Player)
    hitflash    flash-strong
    hitfx    data/sounds/se/misc/flash-finish1.wav
    loop    0
    delay    8
    offset    34 88
    bbox    11 0 45 163
    attack    0 0 0 0 0 0 0 0 0 0
    @cmd    spawnbind "chinnenob-a1" 60 70 1 1 6
    frame    data/sprites/sprite/chara/chinnen/skill-a01.gif
    offset    34 88
    bbox    11 0 45 163
    frame    data/sprites/sprite/chara/chinnen/skill-a02.gif
    offset    34 88
    bbox    11 0 45 163
    sound    data/sounds/se/chinnen/se-sk1-1.wav
    attack2    23 -20 100 80 2 0 0 0 20 30
    dropv    2.4 1 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a03.gif
    delay    4
    offset    34 88
    bbox    11 0 45 163
    attack2    23 -20 100 80 2 0 0 0 20 30
    dropv    2.4 1 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a04.gif
    attack    0 0 0 0 0 0 0 0 0 0
    frame    data/sprites/sprite/chara/chinnen/skill-a04.gif
    delay    8
    offset    34 88
    bbox    11 0 45 163
    attack    23 -20 100 80 2 0 0 0 20 30
    dropv    2.4 1 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a01.gif
    delay    4
    offset    34 88
    bbox    11 0 45 163
    attack    23 -20 100 80 2 0 0 0 20 30
    dropv    2.4 1 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a02.gif
    attack    0 0 0 0 0 0 0 0 0 0
    frame    data/sprites/sprite/chara/chinnen/skill-a02.gif
    delay    8
    offset    34 88
    bbox    11 0 45 163
    attack2    23 -20 100 80 2 0 0 0 20 30
    dropv    2.4 1 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a03.gif
    delay    4
    offset    34 88
    bbox    11 0 45 163
    attack2    23 -20 100 80 2 0 0 0 20 30
    dropv    2.4 1 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a04.gif
    attack    0 0 0 0 0 0 0 0 0 0
    frame    data/sprites/sprite/chara/chinnen/skill-a04.gif
    delay    8
    offset    34 88
    bbox    11 0 45 163
    attack    23 -20 100 80 2 1 0 0 20 30
    dropv    2.8 1 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a01.gif
    delay    4
    offset    34 88
    bbox    11 0 45 163
    attack    23 -20 100 80 2 1 0 0 20 30
    dropv    2.8 1 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a02.gif
    attack    0 0 0 0 0 0 0 0 0 0
    frame    data/sprites/sprite/chara/chinnen/skill-a02.gif
    delay    8
    offset    34 88
    bbox    11 0 45 163
    attack    23 -20 100 80 2 1 0 0 40 30
    dropv    5 2 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a03.gif
    offset    34 88
    bbox    11 0 45 163
    attack    23 -20 100 80 2 1 0 0 40 30
    dropv    5 2 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/chinnen/skill-a04.gif
    @cmd    anichange "ANI_follow2"
    frame    none

anim    follow2
    loop    0
    delay       4
    offset    34 90
    bbox    28 0 45 165
    sound    data/sounds/se/chinnen/vc-sk1.wav
    frame    data/sprites/sprite/chara/chinnen/skill-a05.gif
    delay       15
    offset    33 88
    bbox    38 0 45 163
    sound    data/sounds/se/chinnen/se-sk1-2.wav
    @cmd    shoot "chinnenob-a2" 60 70 1
    frame    data/sprites/sprite/chara/chinnen/skill-a06.gif
    delay       5
    offset    33 88
    bbox    35 0 45 163
    frame    data/sprites/sprite/chara/chinnen/skill-a07.gif
    offset    33 88
    bbox    35 0 45 163
    frame    data/sprites/sprite/chara/chinnen/skill-a08.gif
    offset    34 91
    bbox    29 0 45 166
    frame    data/sprites/sprite/chara/chinnen/skill-a09.gif

Code:
anim    follow1 (player effect)
    frame    none
    frame    none
    offset    66 64
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a01.gif
    offset    66 66
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a02.gif
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a02.gif
    offset    66 66
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a03.gif
    offset    66 66
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a04.gif
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a04.gif
    offset    67 71
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a05.gif
    offset    68 71
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a06.gif
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a06.gif
    offset    71 81
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a07.gif
    offset    69 86
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a08.gif
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a08.gif
    offset    69 90
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a09.gif
    offset    69 89
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a10.gif
    @cmd    killentity getlocalvar("self")
    frame    none

Code:
name         [B]_RugalOB-A (boss)
type        none
speed            28
shadow        0
offscreenkill    -10
alpha        1
candamage      player obstacle npc

anim    idle
    jugglecost        21
    hitflash        flash-grey
    blockflash        flash-grey
    hitfx    data/sounds/se/misc/flash-hadouken1.wav
    blockfx    data/sounds/se/misc/flash-hadouken1.wav
    loop    1
    offset    102 124
    delay    2
    attack    77 95 50 30 34 1 0 0 30 30
    dropv    3 4 0
    forcedirection    -1
    frame    data/sprites/sprite/chara/rugal/rugalob-a01.gif
    offset    95 124
    attack    70 95 50 30 34 1 0 0 30 30
    dropv    3 4 0
    frame    data/sprites/sprite/chara/rugal/rugalob-a02.gif
    offset    92 117
    attack    67 88 50 30 34 1 0 0 30 30
    dropv    3 4 0
    frame    data/sprites/sprite/chara/rugal/rugalob-a03.gif
    offset    102 122
    attack    77 93 50 30 34 1 0 0 30 30
    dropv    3 4 0
    frame    data/sprites/sprite/chara/rugal/rugalob-a04.gif

The energy ball has been imported into spawnbind for production purposes, and when an enemy approaches during production, it is supposed to be hit by the player.
 
Last edited:
What entities have these follow animations and what purposes? And what effect does this orb need to do (disappear/explode/spawn another entity)?
What purpose of the blockflash in the Rugal's projectile?

1688182132010.png
 
What entities have these follow animations and what purposes? And what effect does this orb need to do (disappear/explode/spawn another entity)?
What purpose of the blockflash in the Rugal's projectile?

View attachment 4041
The energy ball is for the player's special move and has no effect. When the production is over, there is nothing but disappearance.

The blockflash is set up in case the player character defends it later, but it's likely not used.
 
The blockflash is set up in case the player character defends it later, but it's likely not used.
Unless the manual is wrong, the blockflash works for the defender and not for the attacker, but specific for one exclusive animation only.
We can see that the manual says BLOCK animation, but this projectile is not blocking anything. Try removing this command and see if the problem still happens.

EDIT: Another suggestion is try to put the suicide script I posted above in your hitflash effect.
 
Unless the manual is wrong, the blockflash works for the defender and not for the attacker, but specific for one exclusive animation only.
We can see that the manual says BLOCK animation, but this projectile is not blocking anything. Try removing this command and see if the problem still happens.

EDIT: Another suggestion is try to put the suicide script I posted above in your hitflash effect.
bor - 0001.png

I removed the block flash on Rugal's projectile and created the exact same situation, but the flash still sticks.
 
I looked at the Rugal projectile again and you are not using the remove command too. I don't know if the projectile has other animations, but in case it needs to instantly disappear, I suggest using remove 1.

1688184068804.png

EDIT: Here's how I coded the Particle's laser used in the video.

C:
name                Particle_Laser
type                none
health                1
nolife                1
lifespan            2
offscreenkill        50
remove                1
shadow                0
antigravity            100
didhitscript        data/scripts/didhit/default.c
ondoattackscript    data/scripts/ondoattack/default.c
animationscript        data/scripts/animation/default.c

anim idle
    attackone 1
    fastattack 1
    jugglecost 16
    forcedirection -1
    otg 1
    loop    0
    delay    8
    offset    26 26
    @cmd hitfx "data/sounds/sor3_hit6.wav"
    attack 0 22 50 7 4 1 0 0 0 12
    frame    data/chars/bosses/particle/laser/laser00.png

anim fall
    loop    0
    delay    2
    offset    26 26
    @cmd stop
    @cmd spawn01 "Flash" 24 0 1
    @cmd sound "data/sounds/sor3_hit6.wav"
    frame    data/chars/bosses/particle/laser/laser00.png
    @cmd suicide
    frame    data/chars/bosses/particle/laser/laser00.png
 
@DD Tokki
I'm still doing the tests but I'm curious why are you using an engine an old version compiled in 2017. In case I confirm it's an engine issue, I will test other versions and maybe you will need to upgrade your project's engine build.

1688189180174.png

EDIT: I saw a lot of "frame none" too, I'm replacing them with real paths to see if it solves the problem, but maybe it can have other side effects. I suggest fixing it.

1688189405041.png
 
@DD Tokki
I'm still doing the tests but I'm curious why are you using an engine an old version compiled in 2017. In case I confirm it's an engine issue, I will test other versions and maybe you will need to upgrade your project's engine build.

View attachment 4044

EDIT: I saw a lot of "frame none" too, I'm replacing them with real paths to see if it solves the problem, but maybe it can have other side effects. I suggest fixing it.

View attachment 4045
I'll change the build and fix the frame.
 
@DD Tokki
I'm still doing the tests but I'm curious why are you using an engine an old version compiled in 2017. In case I confirm it's an engine issue, I will test other versions and maybe you will need to upgrade your project's engine build.

View attachment 4044

EDIT: I saw a lot of "frame none" too, I'm replacing them with real paths to see if it solves the problem, but maybe it can have other side effects. I suggest fixing it.

View attachment 4045
I changed the build and also changed the frame from none to the path but still the same result.
Build is 6391.
 
I changed the build and also changed the frame from none to the path but still the same result.
Build is 6391.
Ok, I'm checking the entire game to see if I discover something wrong. Maybe I was not able to fix it today but I will post as soon as I have any solution.

EDIT: I noticed just now that the "ChinnenOB-A1" entity starts in the "follow" animation, if I'm not wrong you must have the idle animation by default in any character and then change to another animation through anichange or in the onspawnscript. I will make tests and check the source code to confirm this information.
 
Last edited:
@DD Tokki

I would need to deeply check both engine/game to see if there's some conflicts but I have a very simple solution for this problem using one of my scripts for binded projectiles.

My code works like the bindanimation but I created this custom one to make more checks instead of just animation and frame, I tested and it fits perfectly for your purpose. I sent the full game by PM but I will post the code here too, this way everyone can see the solution applied.

This file is the projectile, I added an update script called bindKill to constantly check the parent animation and kill it if it does not match (and changed the base animation to IDLE too).
Code:
name         ChinnenOB-A1
type         none
shadow        0
alpha        1
script data/scripts/bindKill.c

anim    idle
    loop 1
    delay 4
    offset    66 64
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a01.gif
    offset    66 66
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a02.gif
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a02.gif
    offset    66 66
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a03.gif
    offset    66 66
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a04.gif
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a04.gif
    offset    67 71
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a05.gif
    offset    68 71
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a06.gif
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a06.gif
    offset    71 81
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a07.gif
    offset    69 86
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a08.gif
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a08.gif
    offset    69 90
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a09.gif
    offset    69 89
    frame    data/sprites/sprite/chara/chinnen/chinnenob-a10.gif

Here's the spawnbind script but with the native bindanimation disabled.
C:
void spawnbind(void Name, float dx, float dy, float dz, int iDir, int iBind)
{ // Spawn and bind other entity
 // [iDir]
 //  0 = No change.
 //  1 = Same direction as target.
 // -1 = Opposite direction as target.
 //  2 = Always right.
 // -2 = Always left.
 // [iBind]
 //  0 = No effect.
 //  1 = Keep same animation as the target.
 //  2 = Also keep same frame as the target.
 //  4 = Kill the entity if the animation doesn't match.
 // You can combine those values for bindanimation, so it can be 6 which means 2 and 4.

   void self = getlocalvar("self");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, 4);
   bindentity(Spawn, self, dx, dz, dy, iDir, 0);
   changeentityproperty(Spawn, "parent", self);
}

Here's the file that contains the bindKill script that will causes the projectile to suicide if the animation does not match. However, different from the native bindanimation, you can fully customize to check many other conditions or put specific animations.
C:
void main()
{
  void self = getlocalvar("self");
  void parent = getentityproperty(self, "parent");
  void pAnim = getentityproperty(parent, "animationID");
 
  if(pAnim != openborconstant("ANI_FOLLOW1")){killentity(self);}
}

And here you see the spawnbind using the flag 0 for the bindanimation.
1688194383958.png

Here's the result.
 
Back
Top Bottom