bind works on spawn but does not work on identical follow4

ABK

Well-known member
I want to bind entity and binding works when i bind in spawn animation but when i clone spawn animation and rename it follow4 - it does not work, entity is bind but is invisible and weird glitches happen like spawned objects dont display all frames... so maybe its some aiflag in spawn that is missing in follow4 ? I dont really want to use spawn and it was a placeholder, i just want to make follow4 to act normal - like spawn where bind works fine.
Anim follow3 detects if orc is near - when it is then it goes to follow4
Code:
anim    FOLLOW3
    loop    9 11
    offset 362 264
    bbox 0 0 0 0

delay  8
       
@script
    void self = getlocalvar("self");
    float x = getentityproperty(self, "x");
    float z = getentityproperty(self, "z");

    void vEntity;                                       // Target entity placeholder.
    int iEntity;                                        // Entity enumeration holder.
    int iName;                                          // Entity name.
    int iMax = openborvariant("ent_max");              // Entity count.

    float Tx;
    float Tz;
    float Disx;
    float Disz;

settextobj(2, 220 , 270 , 0, -1, getentityvar(self, "myRider"), openborvariant("elapsed_time")+70);  
 
                 if(frame == 1 ){
  setentityvar(self, "myRider", NULL());
         }
 
    if(frame == 11) {
        // Enumerate and loop through entity collection.
        for(iEntity = 0; iEntity < iMax; iEntity++) {
            vEntity = getentity(iEntity);              // Get target entity from current loop.
            iName = getentityproperty(vEntity, "name"); // Get target name.
         
            // Match against "gobag"
            if(iName == "orc" && vEntity != self) {
                Tx = getentityproperty(vEntity, "x");
                Tz = getentityproperty(vEntity, "z");
                Disx = Tx - x;
                Disz = Tz - z;
 
                if((Disx >= -40 && Disx <= 40) && (Disz >= -30 && Disz <= 30)) {
                 settextobj(1, 220 , 220 , 0, -1, "STAND", openborvariant("elapsed_time")+70);  
                   changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW4"));
                   
                }
            }
        }
    }
@end_script
alphamask      data/chars/dino/rise_009-mask.png
frame           data/chars/dino/rise_009.png


alphamask      data/chars/dino/rise_008-mask.png
frame           data/chars/dino/rise_008.png


alphamask      data/chars/dino/rise_007-mask.png
frame           data/chars/dino/rise_007.png

alphamask      data/chars/dino/rise_006-mask.png
frame           data/chars/dino/rise_006.png
alphamask      data/chars/dino/rise_005-mask.png
frame           data/chars/dino/rise_005.png
alphamask      data/chars/dino/rise_004-mask.png
frame           data/chars/dino/rise_004.png
alphamask      data/chars/dino/rise_003-mask.png
frame           data/chars/dino/rise_003.png
alphamask      data/chars/dino/rise_002-mask.png
frame           data/chars/dino/rise_002.png

alphamask      data/chars/dino/rise_001-mask.png
frame           data/chars/dino/rise_001.png


alphamask      data/chars/dino/rise_000-mask.png
frame           data/chars/dino/rise_000.png

alphamask      data/chars/dino/rise_000-mask.png
frame           data/chars/dino/rise_000.png

alphamask      data/chars/dino/rise_000-mask.png
frame           data/chars/dino/rise_000.png

alphamask      data/chars/dino/rise_000-mask.png
frame           data/chars/dino/rise_000.png

Now follow4 is identical to spawn but only spawn properly binds entity, in follow4 i put debug info and it looks like its "kinda" spawn but its not visible cause i do not get empty in text debug but i do not see the bind orcsit entity .

Code:
anim    spawn
    loop    0
 
    offset    307 269
    bbox 131 59 331 211
    delay    6
        @cmd setentityvar getlocalvar("self") "frozen"  NULL()
       
@script
    void self = getlocalvar("self");
    void rider = getentityvar(self, "myRider");
 
    if(rider == NULL()) {
        clearspawnentry();
        setspawnentry("name", "orcsit");
        rider = spawn();
        setentityvar(self, "myRider", rider); }
        rider = getentityvar(self, "myRider");
    if(rider != NULL()) {
        if(frame == 1) { bindentity(rider, self, 0, 0, 66, 1, 6, 1); }
        if(frame == 2) { bindentity(rider, self, 0, 0, 65, 1, 6, 1); }
        if(frame == 3) { bindentity(rider, self, 0, 0, 64, 1, 6, 1); }
        if(frame == 4) { bindentity(rider, self, 0, 0, 63, 1, 6, 1); }
        if(frame == 5) { bindentity(rider, self, 0, 0, 62, 1, 6, 1); }
        if(frame == 6) { bindentity(rider, self, 0, 0, 61, 1, 6, 1); }
        if(frame == 7) { bindentity(rider, self, 0, 0, 61, 1, 6, 1); }
        if(frame == 8) { bindentity(rider, self, 0, 0, 62, 1, 6, 1); }
        if(frame == 9) { bindentity(rider, self, 0, 0, 63, 1, 6, 1); }
        if(frame == 10) { bindentity(rider, self, 0, 0, 64, 1, 6, 1); }
        if(frame == 11) { bindentity(rider, self, 0, 0, 65, 1, 6, 1); }
        if(frame == 12) { bindentity(rider, self, 0, 0, 66, 1, 6, 1); }
        if(frame == 13) { bindentity(rider, self, 0, 0, 67, 1, 6, 1); }
    }
@end_script
alphamask      data/chars/dino/idle_000-mask.png
frame           data/chars/dino/idle_000.png
alphamask      data/chars/dino/idle_001-mask.png
frame           data/chars/dino/idle_001.png
alphamask      data/chars/dino/idle_002-mask.png
frame           data/chars/dino/idle_002.png
alphamask      data/chars/dino/idle_003-mask.png
frame           data/chars/dino/idle_003.png
alphamask      data/chars/dino/idle_004-mask.png
frame           data/chars/dino/idle_004.png
alphamask      data/chars/dino/idle_005-mask.png
frame           data/chars/dino/idle_005.png
alphamask      data/chars/dino/idle_006-mask.png
frame           data/chars/dino/idle_006.png
alphamask      data/chars/dino/idle_007-mask.png
frame           data/chars/dino/idle_007.png
alphamask      data/chars/dino/idle_008-mask.png
frame           data/chars/dino/idle_008.png
alphamask      data/chars/dino/idle_009-mask.png
frame           data/chars/dino/idle_009.png
alphamask      data/chars/dino/idle_010-mask.png
frame           data/chars/dino/idle_010.png
alphamask      data/chars/dino/idle_011-mask.png
frame           data/chars/dino/idle_011.png
alphamask      data/chars/dino/idle_012-mask.png
frame           data/chars/dino/idle_012.png
alphamask      data/chars/dino/idle_013-mask.png
frame           data/chars/dino/idle_013.png



anim    follow4
    loop    0
 
    offset    307 269
    bbox 131 59 331 211
    delay    6
        @cmd setentityvar getlocalvar("self") "frozen"  NULL()
       
@script
    void self = getlocalvar("self");
    void rider = getentityvar(self, "myRider");
 
    if(rider == NULL()) {
        clearspawnentry();
        setspawnentry("name", "orcsit");
        rider = spawn();
        setentityvar(self, "myRider", rider); }
        rider = getentityvar(self, "myRider");
    if(rider != NULL()) {
        if(frame == 1) { bindentity(rider, self, 0, 0, 66, 1, 6, 1); }
        if(frame == 2) { bindentity(rider, self, 0, 0, 65, 1, 6, 1); }
        if(frame == 3) { bindentity(rider, self, 0, 0, 64, 1, 6, 1); }
        if(frame == 4) { bindentity(rider, self, 0, 0, 63, 1, 6, 1); }
        if(frame == 5) { bindentity(rider, self, 0, 0, 62, 1, 6, 1); }
        if(frame == 6) { bindentity(rider, self, 0, 0, 61, 1, 6, 1); }
        if(frame == 7) { bindentity(rider, self, 0, 0, 61, 1, 6, 1); }
        if(frame == 8) { bindentity(rider, self, 0, 0, 62, 1, 6, 1); }
        if(frame == 9) { bindentity(rider, self, 0, 0, 63, 1, 6, 1); }
        if(frame == 10) { bindentity(rider, self, 0, 0, 64, 1, 6, 1); }
        if(frame == 11) { bindentity(rider, self, 0, 0, 65, 1, 6, 1); }
        if(frame == 12) { bindentity(rider, self, 0, 0, 66, 1, 6, 1); }
        if(frame == 13) { bindentity(rider, self, 0, 0, 67, 1, 6, 1); }
    }
@end_script
alphamask      data/chars/dino/idle_000-mask.png
frame           data/chars/dino/idle_000.png
alphamask      data/chars/dino/idle_001-mask.png
frame           data/chars/dino/idle_001.png
alphamask      data/chars/dino/idle_002-mask.png
frame           data/chars/dino/idle_002.png
alphamask      data/chars/dino/idle_003-mask.png
frame           data/chars/dino/idle_003.png
alphamask      data/chars/dino/idle_004-mask.png
frame           data/chars/dino/idle_004.png
alphamask      data/chars/dino/idle_005-mask.png
frame           data/chars/dino/idle_005.png
alphamask      data/chars/dino/idle_006-mask.png
frame           data/chars/dino/idle_006.png
alphamask      data/chars/dino/idle_007-mask.png
frame           data/chars/dino/idle_007.png
alphamask      data/chars/dino/idle_008-mask.png
frame           data/chars/dino/idle_008.png
alphamask      data/chars/dino/idle_009-mask.png
frame           data/chars/dino/idle_009.png
alphamask      data/chars/dino/idle_010-mask.png
frame           data/chars/dino/idle_010.png
alphamask      data/chars/dino/idle_011-mask.png
frame           data/chars/dino/idle_011.png
alphamask      data/chars/dino/idle_012-mask.png
frame           data/chars/dino/idle_012.png
alphamask      data/chars/dino/idle_013-mask.png
frame           data/chars/dino/idle_013.png

So the real question is, why follow4 does not act like spawn where it all works fine and binds fine, how do i make aiflags for follow4 to make it work like spawn, i dont see aiflag spawning , what aiflags are set in spawn animation ? I dont say that it will fix it but wanna try , what else i can try ?
what is interesting that this also works so looks like spawn is resetting some flags or something ?
How i can do that manually ? Animation before follow3 was rise , so maybe its some fall flags that were not reset in follow4 ?
Code:
                if((Disx >= -40 && Disx <= 40) && (Disz >= -30 && Disz <= 30)) { 
                 settextobj(1, 220 , 220 , 0, -1, "STAND", openborvariant("elapsed_time")+70);   
                 changeentityproperty(self, "animation", openborconstant("ANI_SPAWN"));
                   changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW4"));
                    
                }
 
Without the proper code tag, is kinda hard to read.

Why are you using multiple bindentity like that? Just to change its Z position?
C-like:
if(rider != NULL()) {
        if(frame == 1) { bindentity(rider, self, 0, 0, 66, 1, 6, 1); }
        if(frame == 2) { bindentity(rider, self, 0, 0, 65, 1, 6, 1); }
        if(frame == 3) { bindentity(rider, self, 0, 0, 64, 1, 6, 1); }
        if(frame == 4) { bindentity(rider, self, 0, 0, 63, 1, 6, 1); }
        if(frame == 5) { bindentity(rider, self, 0, 0, 62, 1, 6, 1); }
        if(frame == 6) { bindentity(rider, self, 0, 0, 61, 1, 6, 1); }
        if(frame == 7) { bindentity(rider, self, 0, 0, 61, 1, 6, 1); }
        if(frame == 8) { bindentity(rider, self, 0, 0, 62, 1, 6, 1); }
        if(frame == 9) { bindentity(rider, self, 0, 0, 63, 1, 6, 1); }
        if(frame == 10) { bindentity(rider, self, 0, 0, 64, 1, 6, 1); }
        if(frame == 11) { bindentity(rider, self, 0, 0, 65, 1, 6, 1); }
        if(frame == 12) { bindentity(rider, self, 0, 0, 66, 1, 6, 1); }
        if(frame == 13) { bindentity(rider, self, 0, 0, 67, 1, 6, 1); }
Now follow4 is identical to spawn but only spawn properly binds entity, in follow4 i put debug info and it looks like its "kinda" spawn but its not visible cause i do not get empty in text debug but i do not see the bind orcsit entity .

Try adding two extra debug text to check:
- if "rider" is really not NULL
- "rider" position
 
There is quicker way to change y offset of bind entity ?

But that is the point - i had debug and it says that rider is not null and that it was properly spawned in follow4- but it was not visible.Some buggy stuff started happening when i also spawned fire breath in dino attack when rider was invisible... so thats why i asked about aiflags or a way to make follow4 behave identically to spawn and reset the same flags as spawn anim.


Maybe the issue is that i change to follow3 from idle, so maybe idle flags are still active. But spawn definitely "resets" eveyrthing and bind works fine

Its a dino you can ride, when theres no rider it goes to idle to sleep animation, it waits till enemy named "orc" will be close enough so it obtains enemy and uses its name and map to bind a clone on top of dino named orcsit, orcsit is npc type.

The reason for adjustments of y offsets are cause i want rider enemies to be easier to do - they have basically the same offset in all their anims, and all i ned to do is to get their offsets aligned in dino and well, its what i did, it works ok.
This way i can add more riders , keep offset the same in all their anims, and dino will take care of the proper positioning, doing it the other way around is a waste of time imo.

So my questions is - what aiflags and properties of animations are reset by spawn animation ?
Code:
anim    idle
    loop    1
 
    offset    307 269
    bbox 131 59 331 211
    delay    6
        @cmd setentityvar getlocalvar("self") "frozen"  NULL()
@script
    void self = getlocalvar("self");
    void rider = getentityvar(self, "myRider");
    if(rider != NULL()) {
        if(frame == 1) { bindentity(rider, self, 0, 0, 66, 1, 6, 1); }
        if(frame == 2) { bindentity(rider, self, 0, 0, 65, 1, 6, 1); }
        if(frame == 3) { bindentity(rider, self, 0, 0, 64, 1, 6, 1); }
        if(frame == 4) { bindentity(rider, self, 0, 0, 63, 1, 6, 1); }
        if(frame == 5) { bindentity(rider, self, 0, 0, 62, 1, 6, 1); }
        if(frame == 6) { bindentity(rider, self, 0, 0, 61, 1, 6, 1); }
        if(frame == 7) { bindentity(rider, self, 0, 0, 61, 1, 6, 1); }
        if(frame == 8) { bindentity(rider, self, 0, 0, 62, 1, 6, 1); }
        if(frame == 9) { bindentity(rider, self, 0, 0, 63, 1, 6, 1); }
        if(frame == 10) { bindentity(rider, self, 0, 0, 64, 1, 6, 1); }
        if(frame == 11) { bindentity(rider, self, 0, 0, 65, 1, 6, 1); }
        if(frame == 12) { bindentity(rider, self, 0, 0, 66, 1, 6, 1); }
        if(frame == 13) { bindentity(rider, self, 0, 0, 67, 1, 6, 1); }
    }
 
        if(rider == NULL()) {
    
  performattack(self, openborconstant("ANI_FOLLOW3"));
    }
@end_script
alphamask      data/chars/dino/idle_000-mask.png
frame           data/chars/dino/idle_000.png

alphamask      data/chars/dino/idle_001-mask.png
frame           data/chars/dino/idle_001.png
alphamask      data/chars/dino/idle_002-mask.png
frame           data/chars/dino/idle_002.png
alphamask      data/chars/dino/idle_003-mask.png
frame           data/chars/dino/idle_003.png
alphamask      data/chars/dino/idle_004-mask.png
frame           data/chars/dino/idle_004.png
alphamask      data/chars/dino/idle_005-mask.png
frame           data/chars/dino/idle_005.png
alphamask      data/chars/dino/idle_006-mask.png
frame           data/chars/dino/idle_006.png
alphamask      data/chars/dino/idle_007-mask.png
frame           data/chars/dino/idle_007.png
alphamask      data/chars/dino/idle_008-mask.png
frame           data/chars/dino/idle_008.png
alphamask      data/chars/dino/idle_009-mask.png
frame           data/chars/dino/idle_009.png
alphamask      data/chars/dino/idle_010-mask.png
frame           data/chars/dino/idle_010.png
alphamask      data/chars/dino/idle_011-mask.png
frame           data/chars/dino/idle_011.png
alphamask      data/chars/dino/idle_012-mask.png
frame           data/chars/dino/idle_012.png
alphamask      data/chars/dino/idle_013-mask.png
frame           data/chars/dino/idle_013.png
 
Last edited:
So the real question is, why follow4 does not act like spawn where it all works fine and binds fine, how do i make aiflags for follow4 to make it work like spawn, i dont see aiflag spawning , what aiflags are set in spawn animation ? I dont say that it will fix it but wanna try , what else i can try ?
what is interesting that this also works so looks like spawn is resetting some flags or something ?
How i can do that manually ? Animation before follow3 was rise , so maybe its some fall flags that were not reset in follow4 ?
@bWWd It may be related to a possible bindanimation sync problem, since you are using flag 6 (which syncs the rider's anim/frame with the caller).
Try to put flag 0 and see if it solves the problem, and check if both entities have the exact same anim/frames.

1750134989588.png
 
How do you guys solve the issue with spawning and binding animal on 1st frame , when i collect weapon (sleeping animal as item ) and spawn its walkable clone in get animation - you can see the blink where item is already taken and gone, and spawned clone appears milseconds later.
Ideally id like to solve it with no header external scripts cause i know i can do that with updatescripts, i dont like to use them and hog fps, had bad experiences.

i have this ondrawscript but, is that most compact solution?
Code:
void main() {
    void s = getlocalvar("self");
    if(getentityproperty(s,"animationID")==openborconstant("ANI_GET")){
        int f = getentityproperty(s,"animpos");
        void t = getentityvar(s,"strail");
        if(f<3 && !t){
            clearspawnentry();
            setspawnentry("name","obwdino");
            t = spawn();
            changeentityproperty(t,"parent",s);
            changeentityproperty(t,"animation",openborconstant("ANI_GET"));
            bindentity(t,s,0,0,0,1,6,-1);
            setentityvar(s,"strail",t);
        } else if(f==4) setentityvar(s,"strail",NULL());
    }
}
 
How do you guys solve the issue with spawning and binding animal on 1st frame , when i collect weapon (sleeping animal as item ) and spawn its walkable clone in get animation - you can see the blink where item is already taken and gone, and spawned clone appears milseconds later.
Ideally id like to solve it with no header external scripts cause i know i can do that with updatescripts, i dont like to use them and hog fps, had bad experiences.

i have this ondrawscript but, is that most compact solution?
Code:
void main() {
    void s = getlocalvar("self");
    if(getentityproperty(s,"animationID")==openborconstant("ANI_GET")){
        int f = getentityproperty(s,"animpos");
        void t = getentityvar(s,"strail");
        if(f<3 && !t){
            clearspawnentry();
            setspawnentry("name","obwdino");
            t = spawn();
            changeentityproperty(t,"parent",s);
            changeentityproperty(t,"animation",openborconstant("ANI_GET"));
            bindentity(t,s,0,0,0,1,6,-1);
            setentityvar(s,"strail",t);
        } else if(f==4) setentityvar(s,"strail",NULL());
    }
}
Optionally you can try to fake it with sprites, exclusively for the "get anim". I use this kind of solution sometimes, it's the quickest way.
 
Back
Top Bottom