bindentity Issue

msmalik681

OpenBOR Developer
Staff member
Code:
void spawnbind2(void Name, float dx, float dy, float dz, int iDir,int iBind,char name,void self)
{// Bind entity to target, so the target moves, the entity moves.
 // @cmd spawnbind2 "entity" x z a direction bindanimation
 // [Direction]
 //  0 = No change. 
 //  1 = Same direction as target. 
 // -1 = Opposite direction as target. 
 //  2 = Always right.
 // -2 = Always left.
 // [Bindanimation] 
 //  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.

   if(!self){self = getlocalvar("self");}
   void Spawn;
   Spawn = spawn01(Name, dx, dy, 0);
   bindentity(Spawn, self, dx, dz, dy, iDir, iBind);
   changeentityproperty(Spawn, "parent", self);
   if(name){changeentityproperty(Spawn, "name", name);}
   
} 

The above animation script I am using to bind a weapon to a player so I can re-use animations throughout my mod.  I am using Bindanimation 7 to make full use of the Bindanimation option and keep the player and weapon in sync.  My problem is due to on some occasions the weapon is not not showing except for a 1 or 2 frames of fixed animations.  This is a big problem for me as i have taken a lot of time to make sure the animations sync up and now I may have to use physically drawn pictures of players/enemies holding the weapons.

I also had big hopes using this method in future mods.
 
try it for yourself https://www.mediafire.com/file/dcnrcyeop07t1h3/Double_Dragon_Baseline_-_weapon_test.zip/file I have already started moving the animations to real pictures but you can still see the issue try picking up the weapons in different order try the whip first and if you want to change weapon let the enemy hit you. spamming attack with the whip sometimes there is nothing in your hand this is normally when the issues start.

the way I used the bindentity was in the get animation as you play the get animation for whatever weapon you are picking up as long as the weapon has a get animation.

Code:
anim get
	loop	0
	offset	21 67
	delay	15
	frame	data/chars/jimmy/rise02.gif
	@cmd	spawnbind2 "Bat_Player" 0 0 1 1 7
	frame	data/chars/jimmy/get.gif
	frame	data/chars/jimmy/rise02.gif

"bat_player" is in the misc folder
 
I can't try, on the road again... but I do know your issue is not an engine problem, so don't go messing up your work just yet. I use binding VERY extensively - for weapons, motion trails, and even clothing. Never have any issue with syncing or anything else unless I made some mistake.
 
Sometimes all items bind just fine other times only one of the weapons do not work.  Due to inconsistency I have decided to use the old simple method instead.  If you can find what I did wrong please let me know so I can try this again in a future mod.
 
Back
Top Bottom