Jump to content

Recommended Posts

Posted

I considered a single script but given that not all functions / events are called on items when in a container / inventory, I prefer to move as much as possible off of the individual items. I'd rather have something that does work than beat myself over the head trying to figure out why something does not work. If someone wants to test the single script and determine that it actually works and share the way to do it, that would probably be for the best.

Posted (edited)

Ishara maybe next is working, I didn't test it in game. In fact quest is required, this script should be adjusted for extending as ReferenceAlias.

 

LinenObjectScript

  Reveal hidden contents

 

 

Happy new Year to all. Freedom all over the world.

Edited by ReDragon2013
Posted

Hello all -- thanks so much for all your help! thus far I've been trying for the life of me these past few days in my free time to get Ishara's lovely script to work, but I just can't. It compiles just fine, and the properties line up. I apply the script to both the clean and dirty linens, and management quest is set to run at the start of the game -- but no dice. I'm not quite sure what it is I'm doing wrong? Any suggestions?

Posted

It may very well be that the OnUpdate event won't run because the object is within the player inventory. I cannot say for certain as I avoid placing scripts directly on objects that will be in the player's inventory whenever possible.

 

Another possible script route would be to create a player alias on the management quest and use a single script there. Instead of OnContainerChanged, the event would be OnItemAdded. An Inventory Event Filter would be a good idea too. Something like:

 

 

  Reveal hidden contents

 

Downside that I foresee is that the player will still be able to manually remove the item from inventory. This may or may not be desired. If it is not, you may wish to create aliases of both objects and change the property type for the two objects from MiscObject to ReferenceAlias and point to the specific aliases added to your quest. Thus as quest aliases you can flag the check box to indicate that they are quest objects that cannot be manually moved from inventory.

Posted

Thank you very much for your help and timely reply! I well get right on to working in this script right away --- but with this new script, it is no longer applied to npc inventories anymore, correct?

Posted
  On 1/8/2019 at 5:04 PM, huggibee said:

Thank you very much for your help and timely reply! I well get right on to working in this script right away --- but with this new script, it is no longer applied to npc inventories anymore, correct?

 

That would be correct. However, you could create an alias for each unique NPC and do the same thing. Highly doubt you'd need to be that concerned about randomly spawned bandits and such. But that would also leave your mod not working with mod added NPCs. And it may be a bit weird to encounter some NPCs with your system and some without.

Posted (edited)

All things considered I myself would approach this by adding the script to the clean cotton.

With a one time timer triggered when added to inventory (or equipped) that simply adds the dirty cotton then remove itself.

That approach would solve 90% of any problems not considered.

 

Jucoking script is very close to how I would do it. (btw, that is more phytocode than actual code but his concept is sound).

Edited by NexusComa
Posted
  On 1/8/2019 at 7:30 PM, IsharaMeradin said:

 

  On 1/8/2019 at 5:04 PM, huggibee said:

Thank you very much for your help and timely reply! I well get right on to working in this script right away --- but with this new script, it is no longer applied to npc inventories anymore, correct?

 

That would be correct. However, you could create an alias for each unique NPC and do the same thing. Highly doubt you'd need to be that concerned about randomly spawned bandits and such. But that would also leave your mod not working with mod added NPCs. And it may be a bit weird to encounter some NPCs with your system and some without.

 

 

I wonder about adding magic effects? You could run your timer through the effect's duration. Failing that you could avoid needing to specify an alias for each unique NPC if you had some sort of registration call-in to a generic pool of aliases and just fill the first available.

(Also, with the OnUpdate approaches, they should probably be done with OnUpdateGameTime() instead, to account for things like fast travel, sleep, and waiting)

Posted

Ah hah! It worked! The script worked! I can't thank you enough, IsharaMeradin for your timely replies and unwavering patience for a modding newbie like myself! :laugh:

Posted
  On 1/8/2019 at 10:26 PM, foamyesque said:

 

  On 1/8/2019 at 7:30 PM, IsharaMeradin said:

 

  On 1/8/2019 at 5:04 PM, huggibee said:

Thank you very much for your help and timely reply! I well get right on to working in this script right away --- but with this new script, it is no longer applied to npc inventories anymore, correct?

 

That would be correct. However, you could create an alias for each unique NPC and do the same thing. Highly doubt you'd need to be that concerned about randomly spawned bandits and such. But that would also leave your mod not working with mod added NPCs. And it may be a bit weird to encounter some NPCs with your system and some without.

 

 

I wonder about adding magic effects? You could run your timer through the effect's duration. Failing that you could avoid needing to specify an alias for each unique NPC if you had some sort of registration call-in to a generic pool of aliases and just fill the first available.

(Also, with the OnUpdate approaches, they should probably be done with OnUpdateGameTime() instead, to account for things like fast travel, sleep, and waiting)

 

I suppose it might be possible. Not sure.

 

In theory, one could track all NPCs that get the item(s) added via a formlist and use a single global game timer. The formlist could be cycled through and have all NPCs swap their items at the same time. But the processing time would increase as more NPCs are added to the list. Checks would be needed to bypass any that may have been killed etc etc...

 

Nonetheless, it can sometimes be a good thing to have one setup dedicated to the player and a different dedicated to NPCs. After all, the player many times needs additional or different conditions than the NPCs would require.

  • Recently Browsing   0 members

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