Jump to content

My Turn to Ask for Scripting Help


paladicprince

Recommended Posts

scn PPTelekeneticStormScript

Float Time
Float Speed
Float Distance
Float Height

Float PlayerX
Float PlayerY
Float PlayerZ

Float ObjectX
Float ObjectY
Float ObjectZ
Float ObjectAngle

Float OffsetX
Float OffsetY


Begin ScriptEffectStart

Set Speed to 50
Set Distance to 50
Set Height to 50

End


Begin ScriptEffectUpdate

Set Time to Time + GetSecondsPassed

If (Time > 1)
Set Time to Time % 1
EndIf

Set PlayerX to Player.GetPos X
Set PlayerY to Player.GetPos Y
Set PlayerZ to Player.GetPos Z

Set ObjectAngle to ObjectAngle  + (Time * Speed * 3.6)

If (ObjectAngle >= 360)
Set ObjectAngle to ObjectAngle % 360
EndIf

Set OffsetX to Distance Cos ObjectAngle
Set OffsetY to Distance Sin ObjectAngle

Set ObjectX to PlayerX + OffsetX
Set ObjectY to PlayerY + OffsetY
Set ObjectZ to PlayerZ + Height

SwirlTestItemRef.SetPos X ObjectX
SwirlTestItemRef.SetPos Y ObjectY
SwirlTestItemRef.SetPos Z ObjectZ

End

 

 

Now what this is supposed to do is cause the swirltestitemref to swirl around the character. You can check my math if you feel like it, but that isn't really my problem. The issue is that it will not move the item at all. However if I move the SetPos lines to the ScriptEffectstart block it will move it. Any idea why it's not running my script all the way through?

 

Edit: After a little more testing it doesn't even work properly in the ScriptEffectStart block. And, when I'm testing this spell the item is in the same cell as me so I know that's not the issue... I tried this but it didn't work:

 

Begin ScriptEffectStart

Set Speed to 50
Set Distance to 50
Set Height to 50
Set PlayerZ to Player.GetPos Z
SwirlTestItemRef.SetPos Z ObjectZ

End

 

And before anyone asks, yes it is marked as a persistent reference. :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...