A torch that follows the player?

Post » Fri Dec 14, 2012 4:28 am

I want a little fire to follow the player around at about the rate of running (not sprinting). Problems:

I am terrible at trig. Totally baffles me.
I don't know how fast running is (512?)

I think the script will look like this:

Scriptname PCKP_Script_HomingTorch extends ObjectReference  Actor Property PlayerREF autoevent OnLoad()	self.SetMotionType(self.Motion_Keyframed)	Movement()endEventevent OnTranslationAlmostComplete()	Movement()endEventfunction Movement()		 float XPos = PlayerREF.GetPositionX() + (80 * Math.sin(PlayerREF.GetHeadingAngle(self)))		 float YPos = PlayerREF.GetPositionX() + (80 * Math.cos(PlayerREF.GetHeadingAngle(self)))		 float ZPos = PLayerREF.GetPositionZ() + 100		 TranslateTo(Xpos, YPos, ZPos, 512, 0, 0, 0, 512)endFunction

Anyone noticing any glaring trig issues? I'm guessing they're there.

EDIT: Upon testing it seems this does nothing...
I put it as a script upon a light with the fireballinvart01 mesh. It looks right, but doesn't move at all. Frustrating.
User avatar
rheanna bruining
 
Posts: 3415
Joined: Fri Dec 22, 2006 11:00 am

Return to V - Skyrim