Jump to content

Recommended Posts

Posted (edited)

I'm trying to make a scenary scroll to give the illusion of moving

(I'm very new to scripting as you can see)

 

I managed to get the scenary moving:

Scriptname ScenaryLoop extends ObjectReference Const Conditional

ObjectReference Property StartPoint Auto Const

ObjectReference Property Scenary Auto Const

ObjectReference Property EndPoint Auto Const

Event OnActivate(ObjectReference akActionRef)

while (game.getplayer() == true)

Scenary.TranslateToRef(EndPoint, 100)

Endwhile

EndEvent

But can't figure ou how to make the scenary reset to it's original position and repeat the loop.

 

Thank you a lot for your time!

Edited by buali
Posted (edited)

Something like this should work:

 

Scriptname ScenaryLoop extends ObjectReference Const Conditional

ObjectReference Property StartPoint Auto Const

ObjectReference Property Scenary Auto Const

ObjectReference Property EndPoint Auto Const

bool moving = false

Event OnActivate(ObjectReference akActionRef)
	if (game.getplayer() == true && moving == false)
		moving = true
		Self.RegisterForRemoteEvent(Scenary, "OnTranslationComplete")
		Self.RegisterForRemoteEvent(Scenary, "OnTranslationFailed")		
		Scenary.TranslateToRef(EndPoint, 100)	
	endif
EndEvent

Event Objectreference.OnTranslationComplete(ObjectReference akSender)
	Scenary.MoveTo(StartPoint)
	Scenary.TranslateToRef(EndPoint, 100)
endEvent

Event Objectreference.OnTranslationFailed(ObjectReference akSender)
	; just in case.
	Scenary.MoveTo(StartPoint)
	Scenary.TranslateToRef(EndPoint, 100)
endEvent
Edited by Reneer
Posted

Thanks for the quick response!

For some reason the scenary moves to the endpoint but stays there, am I doing something wrong?

Posted (edited)

Hmm. Try this and tell me what it outputs on screen:

Scriptname ScenaryLoop extends ObjectReference Const Conditional

ObjectReference Property StartPoint Auto Const

ObjectReference Property Scenary Auto Const

ObjectReference Property EndPoint Auto Const

bool moving = false

Event OnActivate(ObjectReference akActionRef)
	if (game.getplayer() == true && moving == false)
		moving = true
		Self.RegisterForRemoteEvent(Scenary, "OnTranslationComplete")
		Self.RegisterForRemoteEvent(Scenary, "OnTranslationFailed")		
		Scenary.TranslateToRef(EndPoint, 100)	
	endif
EndEvent

Event Objectreference.OnTranslationComplete(ObjectReference akSender)
	debug.notification("Translation complete")
	Scenary.MoveTo(StartPoint)
	Scenary.TranslateToRef(EndPoint, 100)
endEvent

Event Objectreference.OnTranslationFailed(ObjectReference akSender)
	; just in case.
	debug.notification("Translation failed")
	Scenary.MoveTo(StartPoint)
	Scenary.TranslateToRef(EndPoint, 100)
endEvent
Edited by Reneer
Posted

The debug notifications appear perfectly, it looks like the move command doesn't trigger

Posted (edited)

Yes, it looks like MoveTo doesn't work with static objects.

And TranslateToRef only works with statics, so I guess it needs a workaround, gonna keep tinkering with it

Edited by buali
Posted (edited)

MoveTo most definitely works with statics. And TranslateToRef also works with things that aren't statics. You can use it to move actors around easily enough.

Edited by Reneer
Posted (edited)

Found a solution! If the scenary is a static group it works like a charm

 

Thank you very much for your help and patience!

Edited by buali
  • Recently Browsing   0 members

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