Can't set my global variables. wut?

Post » Mon Nov 19, 2012 11:08 am

Hi. Is there any reason why these global variables aren't setting? They aren't constant and when I see the notification on the variable in-game, it's ALWAYS "none," whether I told it to set the int to 0 or 1. What am i doing wrong?


GlobalVariable Property LastInterior AutoGlobalVariable Property CanSayEntrance AutoEvent OnLocationChange(Location akOldLoc, Location akNewLoc);last map was exterior, current map is interiorif (LastInterior.GetValueInt() == 0 && Game.GetPlayer().IsInInterior())  Debug.Notification("Can talk about entrance.")  CanSayEntrance.setValueInt(1)Else  CanSayEntrance.setValueInt(0)EndIfDebug.Notification(CanSayEntrance)LastInterior.SetValueInt(Game.GetPlayer().IsInInterior() as int)endEvent

I hope someone can tell me where I screwed up cause my throat hurts from raging at my poor hubby over this for 3 hours... lol...
User avatar
Thema
 
Posts: 3461
Joined: Thu Sep 21, 2006 2:36 am

Post » Mon Nov 19, 2012 3:52 pm

Not sure if it matters, but my globals work without the INT part. Example:

HISLCTotal.SetValue(HISLCTotal.GetValue() + 1)

This obviously just adds 1 to the existing value. You could try:

CanSayEntrance.setValue(1)


EDIT:

Also check your global properties are set up right in your script.
User avatar
JESSE
 
Posts: 3404
Joined: Mon Jul 16, 2007 4:55 am

Post » Mon Nov 19, 2012 1:45 pm

Try:
Spoiler
Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)EndEvent Actor Property PlayerREF AutoGlobalVariable Property LastInterior AutoGlobalVariable Property CanSayEntrance AutoEvent OnLocationChange(Location akOldLoc, Location akNewLoc)	If !LastInterior.GetValue() && PlayerREF.IsInInterior() ; last map was exterior, current map is interior		Debug.Notification("Can talk about entrance.")		CanSayEntrance.SetValue(1.0)	Else		CanSayEntrance.SetValue(0.0)	EndIf	Debug.Notification("CanSayEntrance == " + (CanSayEntrance.GetValue() As Int))	LastInterior.SetValue(PlayerREF.IsInInterior() As Float)EndEvent
PlayerREF and Get/SetValue() As Int will shave some of the expense/speed things up along with avoiding auto-casting as afValue is a float. Also,
Debug.Notification(CanSayEntrance)
won't indicate the value of the global.
User avatar
christelle047
 
Posts: 3407
Joined: Mon Apr 09, 2007 12:50 pm

Post » Mon Nov 19, 2012 9:26 am

Thanks guys! For some reason once I took off the Int part it worked, not sure why but hey, it works! Also, I'll start using the playerREF for now on... Thank you both!
User avatar
{Richies Mommy}
 
Posts: 3398
Joined: Wed Jun 21, 2006 2:40 pm


Return to V - Skyrim