Code:
void _apply_sword(){
   VECTOR _ang, _pos;
   while (you){ // do as long player != NULL
      // move with players animation
      vec_for_bone(_pos, you, "Right Hand"); // get xyz pos of hand bone
      ang_for_bone(_ang, you, "Right Hand"); // get rotation of hand bone
      vec_set(my.x, _pos.x); // set xyz
      vec_set(my.pan, _ang); // set rotation

      // optional animation
      //my.skill1 += time_step;
      //ent_animate(me, "idle", my.skill1, ANM_CYCLE);
      wait(1);
      }
      ptr_remove(me); // no more player ? remove weapon
}
..
action myPlayer()
{
  player = me;
  // create the sword and apply to players hand
  ent_create("sword.mdl", vector(player.x, player.y, player.z), _apply_sword);
}


Last edited by rayp; 12/21/12 16:19.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;