YouDoNotKnowMyName Posted April 26, 2021 Posted April 26, 2021 Good evening everybody! Ok, so I know how to get the rotation and positon of an object reference.But how can I get those values for the object to which the script is attached to? I tried to do something like this: float Xpos = self.GetPositionX(); but got an error: no viable alternative at input 'self'So, how can this be done?
niston Posted April 26, 2021 Posted April 26, 2021 Try this: float xPos = (Self as ObjectReference).GetPositionX();
YouDoNotKnowMyName Posted April 26, 2021 Author Posted April 26, 2021 Try this: float xPos = (Self as ObjectReference).GetPositionX();Nope, didn't work.Now I get the following error: GI_Rotate_on_Queststage.psc(11,13): no viable alternative at input '(' GI_Rotate_on_Queststage.psc(11,19): required (...)+ loop did not match anything at input 'as' GI_Rotate_on_Queststage.psc(11,6): Unknown user flag self
DocClox Posted April 27, 2021 Posted April 27, 2021 What is it that you want to take the position of, exactly? Generally speaking, if it's not an object reference, or a subclass of objref, then it doesn't exist in-world and has no meaningful co-ordinates.
YouDoNotKnowMyName Posted April 27, 2021 Author Posted April 27, 2021 What is it that you want to take the position of, exactly? Generally speaking, if it's not an object reference, or a subclass of objref, then it doesn't exist in-world and has no meaningful co-ordinates.It is one of those "rotation markers".So it is an object reference. But I can't use the ref id as a property, because apparently you can't pass the object to which the scirpt is attached to to the script as a property.
LarannKiar Posted April 27, 2021 Posted April 27, 2021 (edited) Event if the script is attached to an object reference, you can still use that object reference as a property: Scriptname TEMP extends ObjectReference Const ObjectReference Property TEMP_ObjRef Auto Const ;you can fill this property with "itself" Event OnLoad() JustAFunction() EndEvent Function JustAFunction() float xPos = TEMP_ObjRef.GetPositionX() EndFunction Edited April 27, 2021 by LarannKiar
DocClox Posted April 27, 2021 Posted April 27, 2021 But I can't use the ref id as a property, because apparently you can't pass the object to which the scirpt is attached to to the script as a property. So you placed a rotation helper in a cellstuck a script on a the rotation helperand then tried to give the rotation marker script a property pointing at the rotation markerIs that about right? Because you wouldn't need a property in that case - just use "self"
YouDoNotKnowMyName Posted April 27, 2021 Author Posted April 27, 2021 But I can't use the ref id as a property, because apparently you can't pass the object to which the scirpt is attached to to the script as a property. So you placed a rotation helper in a cellstuck a script on a the rotation helperand then tried to give the rotation marker script a property pointing at the rotation markerIs that about right? Because you wouldn't need a property in that case - just use "self" Yes, that's what I tried to do! If I use "self" for anything else other then self.TranslateTo(....) I get errors.
DocClox Posted April 27, 2021 Posted April 27, 2021 I admit, I never tried attaching a script to the helper. I had a ring and a pivot and I put the script in the pivot. The rotation of the helper is absolute, so you don't need to query it's rotation, just have the script remember where you sent it last. Look at the one in Big John Salvage for an example
Recommended Posts