Custom Functions unable to set Variables?

Post » Tue Dec 11, 2012 10:39 am

I'm experimenting with Custom Functions, and I've come across something that I'm either doing wrong or just isn't possible, and I'd like the input of those more experience, if possible?

I've basically got this:


[Script]
Float TempStore
GlobalVariable Property ZATestGlobal Auto

Function ZATestFunction(Actor Target)
If ( ZATestGlobal.GetValue() == 0 )
Float TempStore = 10
ZATestGlobal.SetValue(1)
Target.SetAV("WaterWalking", 1)
Target.SetAV("Health", TempStore)
ElseIf ( ZATestGlobal.GetValue() == 1 )
ZATestGlobal.SetValue(0)
Target.SetAV("WaterWalking", 0)
EndIf
EndFunction
[/Script]

what I am finding is that the WaterWalking and the Global are setting fine. When I run this, the Player (who is the target) is able to toggle between Water Walking and Swimming as expected; however, the Player's Health never changes. It seems that TempStore is not being set when the Function runs, but the Flobal SetValue is.

Is this normal behaviour, or have I done something wrong? It seems odd to me that one would set, and the other would not...

The PlayerVampireQuestScript shows that "VampireStatus = 1" works (see Line 200 of that Script), and my own script shows that the SetAV is working, but all floats seem to be unfilled...
User avatar
Madeleine Rose Walsh
 
Posts: 3425
Joined: Wed Oct 04, 2006 2:07 am

Return to V - Skyrim