Jump to content

Help with a script with a mod I currently want to do


AzureRye

Recommended Posts

I want to create a mod and in that mod, there's a script I wanna try to implement but I don't understand how to do it as I'm still a newbie when it comes to scripting. I tried to find it online but with no help or maybe a clear understanding of it. Any help would be great as I'm okay with making houses in the CK, but scripting is not my specialty.

What I want to try and make is: The player finds an item and when they interact with the item in their inventory, that item will disappear from their inventory and it can increase their attributes to a couple of values. I.E. There is a soul gem asset in the inventory, when the player clicks on it, it disappears and it will permanently increase their health by a value of 10, or maybe increase their carry weight by about 15. If that makes any sense.

I don't know if this would be possible on Skyrim's original scripts or if I would need one of those fancy papyrus scripts to download on the Nexus.

Thanks.

Edited by AzureRye
Link to comment
Share on other sites

It is doable, though you may get a pesky "This item cannot be equipped" message in the upper left corner of the screen.

The key is to put a ReferenceAlias script on the player to catch the OnObjectEquipped event.  It will fire when the player clicks on it in inventory even if the object is not equippable, and your script can take it from there.

 

Link to comment
Share on other sites

Alternatively, if the object is a custom one, you can put a script directly on the base object that uses the OnEquipped event.

A basic example that could be modified for your needs:

  Reveal hidden contents

This will prompt the "This item cannot be equipped" message should the item not be a piece of armor or a weapon.  However, the script will still process anything in the OnEquipped event.

Edited by IsharaMeradin
Link to comment
Share on other sites

  On 2/7/2024 at 2:18 PM, IsharaMeradin said:

Alternatively, if the object is a custom one, you can put a script directly on the base object that uses the OnEquipped event.

A basic example that could be modified for your needs:

  Reveal hidden contents

This will prompt the "This item cannot be equipped" message should the item not be a piece of armor or a weapon.  However, the script will still process anything in the OnEquipped event.

Expand  

Wow. Okay, I'll test this out later and see if it works.

Scripting does look complex but I'll see what happens lol.

I was thinking of something other than a soul gem like say a container asset, i.e a satchel, would I need to do anything different to the script you listed or it's just the same?

Thanks.

Link to comment
Share on other sites

For a consumable it would be a magic effect applied to the potion, poison, food, drink, or ingredient. The magic effect would have a script attached which would be very similar to the one I already posted.

  Reveal hidden contents

 

To answer your other question, you can attach my previous example to any object that the player can pick up.  And any such object can utilize whatever mesh you wish to use.  In a couple of my mods, I have used the alchemy satchel mesh and one mod I used a satchel mesh that was cut from an existing set of stock armor.  You would create a new misc object and assign the NIF file that you want to use.   You may need to duplicate the NIF file and make adjustments to it so that the player could drop it and not have the item bounce all over the place or remain stuck in mid-air.

Edited by IsharaMeradin
Link to comment
Share on other sites

  On 2/7/2024 at 5:32 PM, IsharaMeradin said:

For a consumable it would be a magic effect applied to the potion, poison, food, drink, or ingredient. The magic effect would have a script attached which would be very similar to the one I already posted.

  Reveal hidden contents

 

To answer your other question, you can attach my previous example to any object that the player can pick up.  And any such object can utilize whatever mesh you wish to use.  In a couple of my mods, I have used the alchemy satchel mesh and one mod I used a satchel mesh that was cut from an existing set of stock armor.  You would create a new misc object and assign the NIF file that you want to use.   You may need to duplicate the NIF file and make adjustments to it so that the player could drop it and not have the item bounce all over the place or remain stuck in mid-air.

Expand  

I followed the script you gave me seems to work fine as I got no errors, but I can't seem to get it working. I use the item and it does disappear, but my carrying weight is still at 300 and doesn't increase. I don't know if it's related to the script or maybe some other properties.

I have an image of everything from the magic effect, the potion, and even the script below.

https://i.imgur.com/fF1jmEI.jpeg

Link to comment
Share on other sites

  • Recently Browsing   0 members

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