You need to declare the variable as a global variable.
GlobalVariable Property MyVar Auto
Then use:
MyVar.Getvalue()
And as far as i know you cannot transfer a ObjectReference that way.
However you can in a quest script property:
MyQuest Property myQuestRef auto
actor CombatTarget
CombatTarget = "what ever way you want"
Then other scripts can get the REF using :
actor CombatTarget
actor CombatTarget = myQuestRef.CombatTarget
Sorry for the gaps in my description but I have done this ONCE and it did not always work (I think because of how the combat actor ref would change and the god dam script lag issues). Anyway I gave up on this and went a different way, but I have wanted to revisit this.
Maybe someone else can explain it better off the top of their head.
This is probably a simple syntax thing but I can't find a definitive answer on the wiki.
I have an ObjectReference script and I want it to be able to access a global variable I have defined.
I read that you must use variablename.GetValue() however the CK refuses to compile.
I am still somewhat confused about when I need to define things as Properties.
The example for the above accessing of a global within a script didn't mention you had to declare it as a property or the correct syntax for doing so, but I am assuming that is why it refuses to work.