Jump to content

My script is only half working. Any tips?


Recommended Posts

So the script in question is supposed to close your inventory and open a custom skill tree when you click on a specific item. At the moment it only closes my invintory. You can open the skill tree in question using the following console command

 

set myskillopenmenu to 1

 

Essentially the console command temporarily sets the global variable "Myskillopenmenu" to 1. which open the the skill tree. I was trying to do something similar with a script but no luck so far.

 

Scriptname Companionscriprta3 extends ObjectReference

GlobalVariable Property MySkillOpenMenu Auto

Event OnEquipped(Actor akActor)

if akActor == Game.GetPlayer()

if Utility.IsInMenuMode()

Game.DisablePlayerControls()

utility.wait(0.01)

Game.EnablePlayerControls()

endif

MySkillOpenMenu.SetValueInt(1)

endIf

endEvent

All the script does at the moment is close your invintory. That part is intential. But its also suppose to set the "Myskillopenmenu" variable to 1. Which it doesn't seem to do. As doing so would open the menu. The script compiled fine. Any ideas where I am going wrong?
Essentially I am failing at changing a global veriable with a script. At least I am fairly sure that's what the problem is.
Edited by JamesTParker
Link to comment
Share on other sites

Did you assign the correct global variable record to the property?

Did you check the value of the global variable to ensure that it did or did not get set?

And how does setting the global variable trigger opening a menu?

 

I think so. The Global in question is MySkillOpenMenu. I might be missing something though. As I don't really have a good understand of scripting. Does it look correct?

 

28431390-1628886553.png

 

As for checking if the Global did or didn't get set. I am not 100% sure what you mean by this. Do you mean checking in game to see if the Global changed after I activated the object?

 

"And how does setting the global variable trigger opening a menu?"

 

I am using "Custom Skills Framework" to make a perk tree. And it uses global variables to open its menus. I am 99% sure this part is working, as I can open my perk tree just fine by setting the Variable to 1 with console commands. My script doesn't seem to be work though.

Link to comment
Share on other sites

Yes, I meant checking in game via the console to see what the current value is before and after attempting to run the script. Also notification and / or trace statements can help to see how far along the code gets processed or when things fail to go the way intended.

 

As far as it working now, already active quests do not update mid-game. It may be that you recently tested on a new game or restarted the quest, either way would trigger the new changes and allow it to work.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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