buali Posted September 7, 2018 Posted September 7, 2018 (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 EndEventBut 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 September 7, 2018 by buali
Reneer Posted September 7, 2018 Posted September 7, 2018 (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 September 7, 2018 by Reneer
buali Posted September 7, 2018 Author Posted September 7, 2018 Thanks for the quick response!For some reason the scenary moves to the endpoint but stays there, am I doing something wrong?
Reneer Posted September 7, 2018 Posted September 7, 2018 (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 September 7, 2018 by Reneer
buali Posted September 7, 2018 Author Posted September 7, 2018 The debug notifications appear perfectly, it looks like the move command doesn't trigger
Reneer Posted September 7, 2018 Posted September 7, 2018 Is the StartPoint Objectreference actually set up?
buali Posted September 7, 2018 Author Posted September 7, 2018 (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 September 7, 2018 by buali
Reneer Posted September 7, 2018 Posted September 7, 2018 (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 September 7, 2018 by Reneer
buali Posted September 7, 2018 Author Posted September 7, 2018 (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 September 8, 2018 by buali
Recommended Posts