There we go:
Those entities could use the 'target' as the parent bone entity.
What this means is, you would do something like this:
CBaseEntity *pParent = UTIL_FindEntityByTargetname( NULL, STRING( pev->target ) );
GET_BONE_POSITION( ENT( pParent->pev ), 1, pev->origin, pev->angles );
UTIL_SetOrigin( pev, pev->origin );
This is the most basic way. Of course, there would have to be more checks, and stuff.
For example, you can write the entity class to have m_pParent instead of allocating it in the Think() function every time.
A think function is required for the entity to update its position fast enough, basically, or else it'll appear choppy.
So here's what you could do: (alert: this isn't the finished code, it needs some extra security checks to avoid crashing etc.)
CAbbadonChain::SpawnThink( void )
m_pParent = UTIL_FindEntityByTargetname( NULL, STRING( pev->target ) ); // find our target
SetThink( &CAbbadonChain::Think ); // we've spawnthought, now it's time to attach to the bones
pev->nextthink = gpGlobals->time + 0.1;
CAbbadonChain::Think( void )
GET_BONE_POSITION( ENT( m_pParent->pev ), 1, pev->origin, pev->angles );
UTIL_SetOrigin( pev, pev->origin ); // to make me physically move to that origin, after I've visually moved there
pev->nextthink = gpGlobals->time + 0.01;
And of course, somewhere in the Spawn() function, you'll
SetThink( &CAbbadonChain::SpawnThink );
pev->flags ^= FL_ALWAYSTHINK;
if you want your entity to think every frame.
Don't forget to put
in the declarations too:
void EXPORT SpawnThink( void );
void EXPORT Think( void );
Lastly, remember that this method might be a little bit network performance unfriendly, because you're now managing 3 or more entities instead of just 1. But if it's a singleplayer mod, then go for it.
For example, you could make a "chain" of entities that attach to each bone.