Jump to content

Container/Display Scripting Help


StrangeAngelx92

Recommended Posts

I need help trying to write a script for a container, I have been looking for a few days now but i havent found anything.

What i want the script to do is two things.

 

First i need the script to set a limit of x amount of items on a container, setting it up to check the amount of items in the container and kick back to the player any items over the limit.

(Ex. if set a limit of 30 and you add 31 items to a chest, it will kick back the extra 1 maybe with a message saying "that ____ is full")

 

Second i need a script that checks the amount of items in a container and enabled a static object based on how many items the container has.

(Ex. If you add 1-10 health potions its enables 1 static health potion on the display, if you have 11-20 it enables 2 static Health potions, If 21-30 enables 3 and so on)

 

ok figured out both parts (such a pain in the a**)

But now i need help with Figuring out how to reject items not on a formlist

im soo close to completeing this script any help would be appreciated.

 

Ok I totally figured this out FINALLY lol Happy Modding Everyon lol

 

Also

If someone is looking for a similar script as to the above im gonna post it below:

Scriptname A1A1NewChestScript extends ObjectReference

ObjectReference Property DisplayRef_01 Auto
ObjectReference Property DisplayRef_02 Auto
ObjectReference Property DisplayRef_03 Auto
FormList Property Display_FormList_Multi_01 Auto
Actor Property PlayerREF Auto

Int Property IntegerRestrict Auto
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)

If Display_FormList_Multi_01.HasForm(akBaseItem) && GetItemCount(Display_FormList_Multi_01) >= 1
DisplayRef_01.Enable()
EndIf
If Display_FormList_Multi_01.HasForm(akBaseItem) && GetItemCount(Display_FormList_Multi_01) >= 11
DisplayRef_02.Enable()
EndIf
If Display_FormList_Multi_01.HasForm(akBaseItem) && GetItemCount(Display_FormList_Multi_01) >= 21
DisplayRef_03.Enable()
EndIf
If IntegerRestrict == 1 && GetItemCount(Display_FormList_Multi_01) >= 31
RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)
Debug.Notification("Cannot Hold Anymore Objects")
ElseIf IntegerRestrict == 1 && Display_FormList_Multi_01.HasForm(akBaseItem) == False
RemoveItem(akBaseItem, aiItemCount, True, akSourceContainer)
Debug.Notification("That Does Not Go There")
ElseIf IntegerRestrict == 0
;Do Nothing
EndIf

EndEvent
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)

RegisterForSingleUpdate (10.0)

If Display_FormList_Multi_01.HasForm(akBaseItem) && GetItemCount(Display_FormList_Multi_01) <= 0
DisplayRef_01.Disable()
EndIf
If Display_FormList_Multi_01.HasForm(akBaseItem) && GetItemCount(Display_FormList_Multi_01) <= 10
DisplayRef_02.Disable()
EndIf
If Display_FormList_Multi_01.HasForm(akBaseItem) && GetItemCount(Display_FormList_Multi_01) <= 20
DisplayRef_03.Disable()
EndIf

EndEvent
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Event OnUpdate()

If GetItemCount(Display_FormList_Multi_01) <= 0
DisplayRef_01.Disable()
EndIf
If GetItemCount(Display_FormList_Multi_01) <= 10
DisplayRef_02.Disable()
EndIf
If GetItemCount(Display_FormList_Multi_01) <= 20
DisplayRef_03.Disable()
EndIf

UnregisterForUpdate()

EndEvent

The "OnUpdate" is just to make sure the proper statics are enabled/disabled incase you use "Take All" as the script without the "OnUpdate" does not disable the items properly in that instance.

Edited by StrangeAngelx92
Link to comment
Share on other sites

  • Recently Browsing   0 members

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