Jump to content

[LE] Script for adding items randomly to an inventory?


McTAL

Recommended Posts

Hello! I'm looking for some help in the creation of a script that's maybe attatched to an object (notebook) and when placed in an npc inventory, spawns objects (paper entries) at random intervals. Is this possible? If so, would anyone be willing to help me?

 

Thanks in advance!

Link to comment
Share on other sites

Guest deleted12092523

I am also a beginner, so for learning purposes, I will give this one a shot.

 

EDIT - The script has one major flaw, apparently its completely impossible to make inventory items persistent, even forcefully. So OnUpdate() never calls, I am not sure how to work around that without using while loops, and I am not sure if that's even ok to do, for threading reasons.

 

 

  Reveal hidden contents

 

 

If anyone wants to make it better, and explain somethings, please do. I am in this too.

 

This basically spawns a certain number of items in order, starting from the highest index number. It will do it at random intervals, for each container (NPC) it is placed it. This also means the cycle starts over every time its in the players inventory. If you want to make it a finite number, just use a global variable.

Edited by smashballsx88
Link to comment
Share on other sites

Guest deleted12092523
  On 2/12/2019 at 5:59 PM, huggibee said:

Thank you very much for your help! I appreciate it greatly!

Its no problem, I've got to work on my own mod for now, since I haven't even uploaded my first one yet! Hopefully though using the notes and stuff you at least have a general idea on what to do. The Papyrus wiki will always be your absolute best friend.

 

Once you really start to grasp the concept of Papyrus, I would double down on these 4 topics that will pave the way of making you a competent script writer. They are actually gravely important, I wouldn't ship a mod until you begin to implement and practice these concepts.

 

Threading Notes

 

Persistence

 

Using Functions

 

A map of all the Script Objects and their extensions/relationships

Link to comment
Share on other sites

  • Recently Browsing   0 members

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