Jump to content

Acting on a set variable


volvaga0

Recommended Posts

I've been trying to get my mod to act a certain way depending on a set variable and I can't quite get the correct syntax to do it. The script compiles correctly, but I'm obviously doing something wrong.

 

The mod in question is my Dwemer Goggles and Scouter mod

 

I have an external 'POWER' that brings up an ingame menu, that when options are selected, changes a global variable setting I have set up in the CK. I have tested this to be working correctly by checking the variable values in the console.

My problem now is, I can't get an item to act on that set variable.

 

Here is a snippet of the code I have at the moment:

Scriptname Dwemer_Goggles_Sense extends ObjectReference  

GlobalVariable Property DwemerGoggles_VAR  Auto  
Message Property DwemerGogglesMenu_Begin Auto  


Event OnEquipped(Actor akActor)
;Debug.MessageBox("Equipped")

if (DwemerGoggles_VAR.GetValue() == 0)
Debug.MessageBox("Var is set to 0, show menu")
int button = DwemerGogglesMenu_Begin.Show()

//MENU SCRIPTS

elseif (DwemerGoggles_VAR.GetValue() == 1)
Debug.MessageBox("Var is set to 1, cast night eye")	

//CODE

endif

if (DwemerGoggles_VAR.GetValue() == 2)
Debug.MessageBox("Var is set to 2, cast detect life")

//CODE

endif
endif
EndEvent

 

No matter what value the variable is set at, it always acts as if the value was at '0', so It must not be calling directly from the set variable.

What is the correct syntax to find and call from a variable.

 

Essentialy I would like something like this translated:

if DwemerGoggles_var = 0 then
//DO MODS CURRENT MENU SYSTEM

if DwemerGoggles_var = 1 then
//DO SOMETHING ELSE

if DwemerGoggles_var = 2 then
//DO SOMETHING ELSE

Link to comment
Share on other sites

Ok derp time for me...

Looks like I got it right in the first place, I just didn't connect the two in the script properties.

I though It already was connected but I checked and the source wasn't linked.

 

Sorry guys!

 

But hey if anyone is having trouble doing this then here you go, that is how it's done

Link to comment
Share on other sites

LOL how many times I've edited something and tested ingame just to see that I forgot to set the properties.

 

Don't worry, it can happen to anyone. Too many hours modding are the culprit

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...