Jump to content

Run script when enabling item?


Recommended Posts

it is possible to get a script to run when an item is enabled?

 

I can't find an event that would be relevant.

 

The item I have in mind is itself enabled by a script fragment ina quest and I don't want to of mess with that, because I've never dealt with such stuff before.

The item is persistent and is initially disabled.

 

 

diziet

Link to comment
Share on other sites

Use "OnLoad", but the script will run only when you enter the cell it is in.

If you want to run the script either you are in the same cell or not and you dont want to mess around with your quest, then you can make a "Master Controller Script" that it can run anything you want and it can live in any cell and in any object (preferable an xMarker Activator), it will just need to be activated by some means to run your script.

 

Have a happy modding.

Edited by maxarturo
Link to comment
Share on other sites

The item is an xmarker that is enabled as part of the housebuilding quest, when disabled the crafting tables and stuff disappear which is nice, but some child items are then re-enabled and look ugly since they collide with the house walls, also some other items such as wood chopping blocks are also disabled which I'd like to keep.

 

Now for single character run throughs, my esp that disables just the drafting table etc. is fine when you activate the plugin after building the house. But I've been asked to find a way to allow for simultaneous character playthroughs, to have one character disable the tables etc. but leave them for other characters.

 

If it wasn't for the long list of other items that are children to the xmarker in question, this would be easy, no plugin required, just disable the xmarker in the console.

My idea then, is to transfer all the items that i do not want to disable to another marker and have that new marker enable at the same time as the original one. Now when disabling the original marker just the drafting tables disappear, the fallen trees no longer come back under the house and the chopping block stays. _IF_ I can get the new xmarker to enable when the original does.

 

I could add the new marker to the byohhousescript but I'm uncomfortable with overwriting such a basic Hearthfire script. If I knew exaxtly what a script frgment was and how they worked I might try to add the new marker to the house building quest, but as I said, this would be new territory for me.

 

It would seem from your reply that I may have to delve into the quest part and script fragments, other than the Bethesda docs would anyone know of a good primer on this?

 

 

diziet

Link to comment
Share on other sites

Work with the system, not against it.

 

Give this thread a read (https://forums.nexusmods.com/index.php?/topic/8979643-using-hearthfires-workbenches-to-add-new-items/), especially near the end when we hammer out a possible solution.

You are basically wanting to do the same thing, allow the player to craft your mod variation or the stock variation. When your mod variation is crafted it will block the stock variation. If done right, you won't have any clipping of objects through the whole process.

 

EDIT: Added the link that I forgot

Edited by IsharaMeradin
Link to comment
Share on other sites

  • Recently Browsing   0 members

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