Hello everyone. I have a script that gives a 10% chance to spawn a creature when the player kills a mob, and that creature then takes the displayid and level etc of said mob, and should then become the player's Guardian. For those of you who don't know, a guardian is like a pet except it's not like a primary minion (doesn't show up on your HUD or anything, just fights for you). Originally I was just going to set the cerature's faction to 1857, but that just makes it attack hostile mobs, so it won't rally defend you in PvP or against Neutral mobs.
So my question is, how can I set a creature as the guardian of another? (In this case, my player)
Script snippet: http://pastebin.com/DdL9zGGu
Thanks everyone, I really appreciate the help