Jump to content

Recommended Posts

Posted

I am attempting to raise a plane of lava DweSpecialForgeLava01. The object is a static. When I use TranslateTo for my other moving objects I alter the collision of the object in Nifskope to make it moveable. This static has no collision and I haven't found a way to add collision without getting errors in Niksskope, so I decided the onlt other way to move it is with MoveTo and While.

The script compiles fine until I add the line LavaPlane.MoveTo(Xpos, Ypos, Zpos)

Error: (19,10): type mismatch on parameter 1 (did you forget a cast?)

Any other advice on scripting this also welcome.

 

GlobalVariable Property ZLevel Auto
Float Property ZLevelToMoveTo Auto
GlobalVariable Property SMTgv_LavaLevel Auto
ObjectReference Property LavaPlane Auto

Event OnActivate(ObjectReference akActionRef)

Float Zpos = LavaPlane.GetPositionZ(); get object Z position
Float Ypos = LavaPlane.GetPositionY(); get object Y position
Float Xpos = LavaPlane.GetPositionX(); get object X position

While Zpos < ZLevelToMoveTo
Debug.Notification("Moving Up ")
; Math
Zpos = Zpos + 1
Debug.Notification("Lava Level is " + LavaPlane.GetPositionZ())
LavaPlane.MoveTo(Xpos, Ypos, Zpos)
Utility.Wait(5)
EndWhile

Debug.Notification("Done")
EndEvent

 

Posted

You are missing the first parameter of the MoveTo function. You need to enter the target object in which to move the LavaPlane. The X,Y,Z coordinates are relative to that object reference.

 

So if you have a neighboring object that you do move with TranslateTo, move this stubborn object with MoveTo to that neighboring object and set up the X,Y,Z coordinates so that it will end up in the correct position.

Posted

I don't get it. In other scripts where I use MoveTo, I use a xmarker for the x, y, z co-ordinates, Such as MyObject.MoveTo(MyMarker). This is fine for moving objects while player isn't looking - I use it to move an object back to its starting position after a TranslateTo has moved it. The first parameter is ObjectReference akTarget. That would be the xmarker when using a xmarker so what is it when I using co-ordinates that change as in the script I posted?

Posted

This is the line you have:

LavaPlane.MoveTo(Xpos, Ypos, Zpos)

It is missing the first parameter which should be an object reference. The Papyrus Compiler cannot use a float value as an object reference. This is why it is complaining and not compiling.

Posted

Possibly. Or a separate object (possibly invisible) that the TranslateTo works on. Move that with the TranslateTo and then use MoveTo to move this object to that object.

Posted (edited)

Possibly. Or a separate object (possibly invisible) that the TranslateTo works on. Move that with the TranslateTo and then use MoveTo to move this object to that object.

No offence dude but you cold have said that at the beginning.

Thanks.

 

EDIT:

All said and done can't get the lava object to move. Might need to give up on this. Final script attempt...

 

Float Property PosX1 Auto

Float Property PosY1 Auto

Float Property PosZ1 Auto

Float Property RotX1 Auto

Float Property RotY1 Auto

Float Property RotZ1 Auto

 

Float Property RotationVal Auto

Float Property SpeedVal Auto

Float Property Time Auto

Float Property Delay Auto

ObjectReference Property ObjToTranslate Auto; translatable object

ObjectReference Property SndMarker Auto

ObjectReference Property BlockActivator Auto

ObjectReference Property PostMovEn Auto

ObjectReference Property PreMovDis Auto

ObjectReference Property ObjToMove Auto; object to move to translated object position

Sound Property SFX Auto

String Property BUSYMSG Auto

String Property DoneMsg Auto

 

Bool Property SelDel Auto

 

Event OnActivate(ObjectReference akActionRef)

 

Int SoundInstance = SFX.Play(SndMarker)

BlockActivator.Enable()

Utility.Wait(Delay); some sfx have a start up sound

PreMovDis.Disable()

ObjToTranslate.TranslateTo(PosX1, PosY1, PosZ1, RotX1, RotY1, RotZ1, SpeedVal, RotationVal)

 

; Move the non-translatable object with MoveTo

Float ZposOfTransObj = ObjToTranslate.GetPositionZ(); get translating object Z position

While ZposOfTransObj < PosZ1

ZposOfTransObj = ZposOfTransObj + 1

ObjToMove.MoveTo(ObjToTranslate)

Debug.Notification("Lava Level is " + ObjToMove.GetPositionZ())

EndWhile

 

If SelDel == True

Self.Delete()

EndIf

Utility.Wait(Time)

PostMovEn.Enable()

debug.notification(DoneMsg)

 

EndEvent

 

 

Edited by antstubell
Posted

Re-read my first reply. I did state you might need to move one object with TranslateTo and then this object to that object with MoveTo. But whatever...

 

Is the object you are trying to move persistent in some way? Persistence tends to prevent movement of objects.

If you can or have not, test on a game that has not seen the mod at all. Just to rule out save game oddities.

 

Can you create a different type of object that you can use TranslateTo with and give it the appearance of this rather stubborn object? As a last resort...

  • 3 weeks later...
Posted

When in doubt, turn the object into an activator. All movement functions work on those, though the collision updating is a different matter.. but still useful if collision isn't a concern.

  • Recently Browsing   0 members

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