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.