Jump to content

Display Items w/ A Button


Recommended Posts

Hello, as the title says I'm trying to display items with the push of a button, that is linked from a container but, having difficulty in the ItemCount area. As the script is currently it displays both refs when only 1 item is removed from the container. The items removed are misc objects and I don't know if you can enable or disable a misc object to spawn in the cell based off ItemCount of the container.

 

The script as is, works minus my comments. I'm sure there is a much easier way (depending on level of coding) then what I am using to allow it to work. I substituted the misc objects for Static Items (for now) and using a delete container to simulate the object being grabbed from the container. If you could help me out that would be amazing. If you can I want; activate button, removes 1 of item (or more depending on # of refs linked to this item). Enabled # of Refs are based of itemcount removed. if ItemCount of container is = 1 display only 1 item and remove it from the container. If ItemCount of container = 0 no refs are enabled linked to that container and no items are removed.

Scriptname UHDisplayScript extends ObjectReference
Potion Property UHItemToRemove1 Auto
Potion Property UHItemToRemove2 Auto
ObjectReference Property UHHoldingContainer1 Auto
ObjectReference Property UHHoldingContainer2 Auto
ObjectReference Property UHDeleteContainer Auto
ObjectReference Property UHEnableRef1 Auto
ObjectReference Property UHEnableRef2 Auto
ObjectReference Property UHEnableRef3 Auto
ObjectReference Property UHEnableRef4 Auto
Message Property UHMessageToShow1 Auto
Message Property UHErrorMessage Auto
Event OnActivate(ObjectReference akActionRef)
if (UHHoldingContainer1.GetItemCount( )== 0)
UHErrorMessage.show()
ALL STOCKING REFS FOR THIS CONTAINER IS DISABLED
else
UHMessageToShow1.Show()
EndIf
if (UHHoldingContainer1.GetItemCount(UHItemToRemove1) >= 1)
UHHoldingContainer1.RemoveItem(UHItemToRemove1 , 2 , False, UHDeleteContainer)
OnItemRemoved(UHHoldingContainer1, 2, None, UHDeleteContainer)
If UHEnableRef1.IsDisabled()
UHEnableRef1.enable()
If UHEnableRef2.IsDisabled()
UHEnableRef2.enable()
If OnItemRemoved(UHHoldingContainer1, = 1)
One ref is enabled----------------------------------The way it is currently, can't set it to a specific ref, will enable both static refs, not one.
the other disabled
BROKEN UNTIL 1ST HALF FIXED
else
if (UHHoldingContainer2.GetItemCount(UHItemToRemove2) >= 1)
UHHoldingContainer1.RemoveItem(UHItemToRemove2 , 1 , False, UHDeleteContainer)
OnItemRemoved(UHHoldingContainer2,1, None, UHDeleteContainer)
If UHEnableRef3.IsDisabled()
UHEnableRef3.enable()
If UHEnableRef4.IsDisabled()
UHEnableRef4.enable()
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndEvent

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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