Jump to content

how to trigger on item created at workbench?


davidlallen

Recommended Posts

I have a recipe which creates an item. The item has a script. The script has an "onadd player" block so I can trigger some stuff to happen when the item is created. However, I get the item in my inventory without the script triggering, which seems wrong. If I "player.additem" the item at the console, then the script triggers, so I know the script is right.

 

Is there another way to be notified when a recipe is finished?

Link to comment
Share on other sites

Thanks for the suggestions. I'd rather avoid a gamemode script on the player, since it will run every frame. For this particular object, it makes sense for it to be very heavy (like 300 pounds). I assume that for most players it will be enough to make them immobile, and they will immediately drop it. It should be possible to trigger on the "drop" action to do what I want. If that doesn't work I will come back.
Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the suggestions. None of them work. It doesn't seem like this should be so hard. Can you help?

 

My goal is to have a script run, when the player creates an item at any workbench (not one particular workbench). I have tried "onadd" for the item, I have tried "gamemode" for the item. Neither of them is triggered when the item is created. Both of them are triggered if the player picks up the item, so I know the scripts work. I have also tried "ondrop" of one of the recipe input items, conditioned on "if menumode 1077". That doesn't trigger either.

 

Please find attached a tiny test mod. It has a free recipe, xyzrecipe, which converts one stimpack into one xyzstimpack. There is a script, xyzscript, attached to xyzstimpack. It has an onadd and gamemode block, each of which will put up a simple message box when they trigger. In geck, you can filter with "xyz" to see all these objects.

 

Please load the mod, go to a workbench, and convert one stimpack into an xyzstimpack. Notice that no message boxes appear. Now drop the xyzstimpack and pick it up. *Now* both of the message boxes appear.

 

If you can suggest a different approach, or show a working script, I would greatly appreciate it.

Edited by davidlallen
Link to comment
Share on other sites

Since scripts don't run on crafted items, you are stuck with a work-around. The only work-around I can think of is a script to monitor the Player's inventory for the crafted item, then replace it with another item (or maybe the same item so the script will run). A quest script that runs every second or so.

 

Edit - probably a different item so your quest script can tell the difference if there are multiples.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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