When the staff is animated with the warlock to stay in place when set to its xyz and pan etc., you can't do anything about it in the script, but have to move the staff in MED in each frame to the origin.
Then it should stay with the vertex of the warlock's hand.
It is kind of a mixture then, keeping the position by vec_for_vertex, but keeping the angles simple by synchronized animations.
Just out of interest, because I give lessons, too: Where do you come from? What is the age of your students?