Jump to content

Need scripting help


buali

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Recently Browsing   0 members

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