Jump to content

[LE] Scripting help for specific items and unique stands


MelissaS52

Recommended Posts

For Skyrim Special Edition. So I'm new to modding and I am having trouble creating scripts. I'm trying to create displays to display unique objects (Like Paragons, bugs in a jar, claws, etc.) like on shelves or gem holders and such, in a way that once placed it's static and cannot be moved unless picked up by the player. like how the displays in Dragon Cliff Manor work, where it is just activated and the object is placed. I also wouldn't care if you had to enter a chest screen and put the items in the chest for them to be placed. I've tried doing it the way Darkfox127 did in his one tutorial video called Unique Display Cases, but I couldn't figure out a script. I'm only trying to create a home mod and if anyone can help me write one or teach me I would obviously credit them if I ever uploaded the mod to the public. Any help or advice is appreciated.

Link to comment
Share on other sites

Create a static version of the object.

Pre-place the static version where you want to display the object.

Set the static version to be initially disabled.

Place an activator around that location.

Place a hidden container under the floor.

Apply a script to the activator which will take the object from the player and put it into the container. At which point it will also activate the static version.

This same activator script will be used to disable the static version and give the object back to the player when they so choose.

 

A variation of the script follows:

 

 

ScriptName DisplayActivatorScript Extends ObjectReference

ObjectReference Property DisplayObject Auto
{Assign the static display object}

MiscObject Property myObject Auto ; change the item type as necessary depending upon object to be displayed
{Assign the base object of the player usable item}

ObjectReference Property myHiddenContainer Auto  ; Note can use a shared container for multiple displays
{Assign the container intended to hold the playable version}

Event OnActivate(ObjectReference akActivator)
  If akActivator == Game.GetPlayer()
    If DisplayObject.IsEnabled()  ; is the display active?
      If myHiddenContainer.GetItemCount(myObject) >= 1  ; is the item in the container?
        myHiddenContainer.RemoveItem(myObject,1,true,akActivator)  ; give to player
        DisplayObject.Disable()  ; disable the static
      Else
        Debug.Trace("Oops, something went wrong. Display is enabled but object is not in container.")
      EndIf
    Else
      If akActivator.GetItemCount(myObject) >= 1  ; is the item on the player?
        akActivator.RemoveItem(myObject,1,true,myHiddenContainer) ;put in container
        DisplayObject.Enable() ; enable the static
      Else
        Debug.Notification("You lack the item for this display.")
      EndIf
    EndIf
  EndIf
EndEvent

 

 

Link to comment
Share on other sites

A small tip :

When you create your "trigger box activator" don't set its rotation values to absolute numbers, like.

x = 90.00, y = 180.00, z = 00.00

Instead

x = 91.50, y = 179.60, z = 00.50 (or something like this)

This is cause of a CK bug, that if the rotation valus are absolute numbers you won't be able to activate it most of the times, but if you do it like the second example it'll always get triggered.


Have a happy modding !...

Edited by maxarturo
Link to comment
Share on other sites

  • 2 weeks later...

Create a static version of the object.

Pre-place the static version where you want to display the object.

Set the static version to be initially disabled.

Place an activator around that location.

Place a hidden container under the floor.

Apply a script to the activator which will take the object from the player and put it into the container. At which point it will also activate the static version.

This same activator script will be used to disable the static version and give the object back to the player when they so choose.

 

A variation of the script follows:

 

 

ScriptName DisplayActivatorScript Extends ObjectReference

ObjectReference Property DisplayObject Auto
{Assign the static display object}

MiscObject Property myObject Auto ; change the item type as necessary depending upon object to be displayed
{Assign the base object of the player usable item}

ObjectReference Property myHiddenContainer Auto  ; Note can use a shared container for multiple displays
{Assign the container intended to hold the playable version}

Event OnActivate(ObjectReference akActivator)
  If akActivator == Game.GetPlayer()
    If DisplayObject.IsEnabled()  ; is the display active?
      If myHiddenContainer.GetItemCount(myObject) >= 1  ; is the item in the container?
        myHiddenContainer.RemoveItem(myObject,1,true,akActivator)  ; give to player
        DisplayObject.Disable()  ; disable the static
      Else
        Debug.Trace("Oops, something went wrong. Display is enabled but object is not in container.")
      EndIf
    Else
      If akActivator.GetItemCount(myObject) >= 1  ; is the item on the player?
        akActivator.RemoveItem(myObject,1,true,myHiddenContainer) ;put in container
        DisplayObject.Enable() ; enable the static
      Else
        Debug.Notification("You lack the item for this display.")
      EndIf
    EndIf
  EndIf
EndEvent

 

 

 

Thank you so much!!!

Edited by MelissaS52
Link to comment
Share on other sites

  • 3 months later...

Hi there!

 

I'm using the script above and it works great! But I've ran into a problem, i want to display Miraak's mask but that mask has 6 different ID's.

I know it's possible to define multiple references but I don't know how to make the script work with those... Can someone perhaps help?

 

Thank you.

Link to comment
Share on other sites

Greenston this is tested and working in my project.

* Although i've removed a few things from the original script that might not be useful for you.

 

 

Scriptname aXMDvaultDisplayMiraakMASK extends ObjectReference  
{Script for the Miraak Mask Display Placment with an Link Ref Increment COUNTER function + On Placed Message + a function that Fires the TIMER OF THE MASTER VAULT Script}
 
armor property DLC2MKMiraakMask1L Auto
{Substitute with any other mask if not placing Miraaks mask.}
 
armor property DLC2MKMiraakMask2L Auto
armor property DLC2MKMiraakMask3L Auto
 
armor property DLC2MKMiraakMask1H Auto
armor property DLC2MKMiraakMask2H Auto
armor property DLC2MKMiraakMask3H Auto
 
ObjectReference Property StaticMiraakMask Auto
{Link Ref the static Miraak's mask to enable/disable}
 
Message Property NoItemMSG auto
{The message to show if the player doesn't have the ITEM in their inventory}
 
Bool Property NotMiraaksMask = false auto
{Default = false}
 
int property isPlaced = 0 auto hidden
 
 
Event onActivate(ObjectReference akActivator)
     If akActivator == Game.GetPlayer()
    
          if (isPlaced != 0)
                 if (isPlaced == 1)
                     akActivator.addItem(DLC2MKMiraakMask1L, 1)
           elseIf (notMiraaksMask)
    
           elseIf (isPlaced == 2)
                      akActivator.addItem(DLC2MKMiraakMask2L, 1)
           elseIf (isPlaced == 3)
                      akActivator.addItem(DLC2MKMiraakMask3L, 1)
           elseIf (isPlaced == 4)
                      akActivator.addItem(DLC2MKMiraakMask1H, 1)
           elseIf (isPlaced == 5)
                      akActivator.addItem(DLC2MKMiraakMask2H, 1)
           elseIf (isPlaced == 6)
                      akActivator.addItem(DLC2MKMiraakMask3H, 1)
 
            endIf
                      StaticMiraakMask.Disable()
                      isPlaced = 0
 
       else
 
             if (akActivator.getItemCount(DLC2MKMiraakMask1L) >= 1)
                 akActivator.removeItem(DLC2MKMiraakMask1L, 1)
                 isPlaced = 1
        elseIf (notMiraaksMask)
                  NoItemMSG.show()
 
        elseIf (akActivator.getItemCount(DLC2MKMiraakMask2L) >= 1)
                  akActivator.removeItem(DLC2MKMiraakMask2L, 1)
                  isPlaced = 2
 
        elseIf (akActivator.getItemCount(DLC2MKMiraakMask3L) >= 1)
                  akActivator.removeItem(DLC2MKMiraakMask3L, 1)
                  isPlaced = 3
 
        elseIf (akActivator.getItemCount(DLC2MKMiraakMask1H) >= 1)
                  akActivator.removeItem(DLC2MKMiraakMask1H, 1)
                  isPlaced = 4
 
        elseIf (akActivator.getItemCount(DLC2MKMiraakMask2H) >= 1)
                  akActivator.removeItem(DLC2MKMiraakMask2H, 1)
                  isPlaced = 5
 
        elseIf (akActivator.getItemCount(DLC2MKMiraakMask3H) >= 1)
                  akActivator.removeItem(DLC2MKMiraakMask3H, 1)
                  isPlaced = 6
          else
                 NoItemMSG.show()
                 return
        endif
 
              if (isPlaced >=1)
                 StaticMiraakMask.Enable()
        endIf
 
    endif
EndIf
ENDEVENT

 

 

 

Hope it helps...

 

Edit: Typo...

 

Hey Maxarturo, thx for the reply.

This code looks way better than my ghetto hot-fix, thank you!

 

I just repeated the event 6 times (Example code)

Problem is I still get the "You lack the item" message if I hang the mask.

 

Example code:

MiscObject Property myObject Auto ; change the item type as necessary depending upon object to be displayed
MiscObject Property myObject2 Auto
{Assign the base object of the player usable item}

ObjectReference Property myHiddenContainer Auto  ; Note can use a shared container for multiple displays
{Assign the container intended to hold the playable version}

Event OnActivate(ObjectReference akActivator)
  If akActivator == Game.GetPlayer()
    If DisplayObject.IsEnabled()  ; is the display active?
      If myHiddenContainer.GetItemCount(myObject) >= 1  ; is the item in the container?
        myHiddenContainer.RemoveItem(myObject,1,true,akActivator)  ; give to player
        DisplayObject.Disable()  ; disable the static
      Else
        Debug.Trace("Oops, something went wrong. Display is enabled but object is not in container.")
      EndIf
    Else
      If akActivator.GetItemCount(myObject) >= 1  ; is the item on the player?
        akActivator.RemoveItem(myObject,1,true,myHiddenContainer) ;put in container
        DisplayObject.Enable() ; enable the static
      Else
        Debug.Notification("You lack the item for this display.")
      EndIf
    EndIf
  EndIf
EndEvent

Event OnActivate(ObjectReference akActivator)
  If akActivator == Game.GetPlayer()
    If DisplayObject.IsEnabled()  ; is the display active?
      If myHiddenContainer.GetItemCount(myObject2) >= 1  ; is the item in the container?
        myHiddenContainer.RemoveItem(myObject2,1,true,akActivator)  ; give to player
        DisplayObject.Disable()  ; disable the static
      Else
        Debug.Trace("Oops, something went wrong. Display is enabled but object is not in container.")
      EndIf
    Else
      If akActivator.GetItemCount(myObject2) >= 1  ; is the item on the player?
        akActivator.RemoveItem(myObject2,1,true,myHiddenContainer) ;put in container
        DisplayObject.Enable() ; enable the static
      Else
        Debug.Notification("You lack the item for this display.")
      EndIf
    EndIf
  EndIf
EndEvent

I'll test it later today.

 

Thanks again.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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