Script Help Again..

Post » Tue Sep 22, 2009 9:41 pm

This is a script that is intended to move an object to just infront of where the player is facing but it is not working (and record the vector for where the player is facing):

Scn RPSICProjectileSpellScriptMelonRef CasterFloat XangFloat Zang;Unit VectorFloat XiFloat YiFloat Zi;Initial PosistionFloat XposFloat YposFloat ZposBegin ScriptEffectStart	Set Caster to GetSelf	Set Xang to Caster.GetAngle x	Set Zi to sin Xang	Set Zang to Caster.GetAngle z	Set Xi to sin Zang	Set Yi to cos Zang	Set Xpos to Xi*20	Set Ypos to Yi*20	Set Zpos to 118 - 25*(Caster.IsSneaking) + Zi*20	RPSICTestHead.Moveto Caster Xpos Ypos Zposend


What is occurring is that the reference that is meant to be moved (RPSICTestHead) does not move at all from its original position.

Any help would be greatly appreciated, thank you :)
User avatar
Beat freak
 
Posts: 3403
Joined: Thu Dec 14, 2006 6:04 am

Post » Tue Sep 22, 2009 1:20 pm

You need to disable the object before moving it and enable it after so the world art is updated to the new position.

So something like this:
Scn RPSICProjectileSpellScriptMelonRef CasterFloat XangFloat Zang;Unit VectorFloat XiFloat YiFloat Zi;Initial PosistionFloat XposFloat YposFloat ZposBegin ScriptEffectStart	RPSICTestHead.disableEndBegin ScriptEffectFinish	Set Caster to GetSelf	Set Xang to Caster.GetAngle x	Set Zi to sin Xang	Set Zang to Caster.GetAngle z	Set Xi to sin Zang	Set Yi to cos Zang	Set Xpos to Xi*20	Set Ypos to Yi*20	Set Zpos to 118 - 25*(Caster.IsSneaking) + Zi*20	RPSICTestHead.Moveto Caster Xpos Ypos Zpos	RPSICTestHead.enableend


Also, just to make sure...

Is the spell on self?

The script is attached to the spell, right? (I've forgotten this a million times, so it is why I'm asking :lol: )
User avatar
Kaley X
 
Posts: 3372
Joined: Wed Jul 05, 2006 5:46 pm

Post » Tue Sep 22, 2009 5:12 pm

Ok, thanks! :) I'll give it a go.

Yup, the spell is on self, and has the script attached - I forget this so often that I double checked before posting! :P
User avatar
Catharine Krupinski
 
Posts: 3377
Joined: Sun Aug 12, 2007 3:39 pm


Return to IV - Oblivion