Moving object references via script.

Post » Mon Jun 18, 2012 3:25 am

I have a script that uses the SetPosition() function on the static mesh which it is attached to. The script runs (I know because I used gratuitous message boxes to debug), but the static mesh doesn't move.

Is this because the new position will only take effect the next time the cell loads? The next time it is reset? What am I missing?
User avatar
Yonah
 
Posts: 3462
Joined: Thu Aug 02, 2007 4:42 am

Post » Mon Jun 18, 2012 5:42 am

Me too!! a little help... This is kinda what I got going. I also tried placeAtMe and some other stuff....


Scriptname zzzTowerEnableTest extends ObjectReference

ObjectReference property Cursor auto
ObjectReference Property Tower auto
Int Distance = 200
float Movement

Event OnActivate(ObjectReference triggerRef)
GotoState("PlaceTower")

EndEvent

Auto State PlaceTower

Event OnBeginState()



; Cursor.PlaceAtMe (Tower, abInitiallyDisabled = true)
; Cursor.PlaceAtMe (Tower)
; Cursor.PlaceAtMe (zzzTowerLvl01)
; Tower.MoveTo (Cursor, afZoffSet = -274)
; Tower.MoveTo (Cursor)
; Tower.Enable(true)
; Debug.TraceAndBox("Tower Enabled")
Movement = Tower.GetPositionZ()
GoToState("Animating")

EndEvent
EndState

State Animating

Event OnBeginState()
If Distance > 0
Distance -= 5
Movement += 5
; Tower.MoveTo (Cursor, afZoffSet = Movement)
Tower.SetPosition(0.0, 0.0, Movement)
GoToState("Animating")
Debug.TraceAndBox("TowerAnimating")

EndIf
EndEvent
EndState
User avatar
Mandy Muir
 
Posts: 3307
Joined: Wed Jan 24, 2007 4:38 pm

Post » Mon Jun 18, 2012 12:35 am

My guess here is you need to make that 'static' object into a 'moveableStatic' object.
In Fallout3, 'static' objects are not allowed to move, where you can move 'movableStatic' objects.
User avatar
JAY
 
Posts: 3433
Joined: Fri Sep 14, 2007 6:17 am

Post » Mon Jun 18, 2012 4:53 am

Good call, I'll give that a shot.
User avatar
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm


Return to V - Skyrim