Jump to content

Running a script on item activation


kefka95

Recommended Posts

I feel like this is probably a really basic thing, but it's the last piece of my mod that I don't know how to do, so I figured I'd just ask. I'm trying to get a script to run when the player selects a specific "Misc" item in their inventory (the purpose of the item is to launch a mod menu). The script is fully written, I just need to get it to fire when the item is selected. I attached the script to the item, but I'm not sure what to do from there. I thought I could just add some code to the OnActivate() event in the script, but it doesn't seem to be that simple.

 

Any help would be appreciated!

 

EDIT: I did get this working eventually. I determined that the OnActivate() event only fires when an actual instance of an item is activated in the game world (as opposed to an item sitting in your inventory). I ended up creating a Magic Effect that in turn held the script and ran the code, and then attached that Magic Effect to a Potion item.

Edited by kefka95
Link to comment
Share on other sites

  • Recently Browsing   0 members

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