Problem with setting a global variable

Post » Sun Feb 16, 2014 7:34 am

Hi im having trouble with setting my global variable in my ActiveMagicEffect Script.

debug.messageBox("FormID: " + ID)ConjureArmorLink01.SetValueInt(ID)debug.messageBox("VarID: " + ConjureArmorLink01.GetValueInt())

I get the following Ouput in game:

FormID: 738207588

VarID: 738207616

Im confused because all I do is saving the value and retrieve it, so there must be something wrong with the way i do that. =(

Also i get the same VarID for all Mannequins.

- I have created ConjureArmorLink01 in Miscellaneous->Global. Type is long, initial value is 0 and it is no constant.

- Added ConjureArmorLink01 to the Properties of my Script and Autofilled it.

- The variable is not used in any other Script.

Here is the complete script:

Spoiler
Scriptname RegisterMannequin extends ActiveMagicEffect  import GameActorBase Property PlayerHouseMannequin  Auto  GlobalVariable Property ConjureArmorLink01  Auto  EVENT OnEffectStart(Actor akTarget, Actor akCaster)    ObjectReference closestMannequin  = Game.FindClosestReferenceOfTypeFromRef(PlayerHouseMannequin, akCaster, 150)    if (closestMannequin == None)        Debug.Notification( "There is no mannequin near!" )    else        int ID = closestMannequin.GetFormID()        debug.messageBox("FormID: " + ID)        ConjureArmorLink01.SetValueInt(ID)        debug.messageBox("VarID: " + ConjureArmorLink01.GetValueInt())    endifendEVENT

What i tried this far:

- Using "value" and "getValue()/setValue()" instead

- Recreating Variable and Script

I hope someone can help me. q.q

User avatar
Arnold Wet
 
Posts: 3353
Joined: Fri Jul 07, 2006 10:32 am

Post » Sun Feb 16, 2014 12:20 am

I don't have much knowledge on this subject, but I'd imagine this error would have to be due to the way floating point numbers work. All global variables are actually stored as floats. Looking at this wiki page, the error might be due to the number of significant figures in the number you're trying to store. http://www.creationkit.com/Literals_Reference#Float_Literals

As a work around, you could create an int property in a quest script or something, and manipulate the variable there.

User avatar
chinadoll
 
Posts: 3401
Joined: Tue Aug 22, 2006 5:09 am


Return to V - Skyrim