Jump to content

Sort Script removes all but 1 item?


Recommended Posts

I have 2 scripts that for some reason aren't working the way they're suppose to. I have one script on a button and it's suppose to remove all items in a formlist (all other buttons set-up the EXACT same way, work as intended). Instead this one removes 1 item in the formlist and the button needs to be activated multiple times.

Formlist Property UHModsList Auto
ObjectReference Property UHModCont Auto
Actor Property PlayerRef1 Auto
Int Property UHobjCount Auto
Message Property ErrorMessage Auto
Event OnActivate(ObjectReference akActionRef)
UHobjCount == PlayerRef1.GetItemCount(UHModsList)
PlayerRef1.RemoveItem(UHModsList, UHobjCount, True, UHModCont)
If UHobjCount == 0
ErrorMessage.Show()
else
debug.notification("Mods stored")
EndIf
EndEvent

 

The second script, can anyone tell me why this script for a container removes all but 1 item? The item is Acid Component, it is in the formlist, i've checked numerous times.

FormList Property UHJunk1 Auto
ObjectReference Property UHJunkContainer Auto
Event OnInit()
AddInventoryEventFilter(UHJunk1)
EndEvent

Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContianer)

If(UHJunk1.Find(akBaseItem) > 0)
UHJunkContainer.AddItem(AkBaseItem, aiItemCount)
; akItemReference.MoveTo(UHJunkContainer)
Self.RemoveItem(akBaseItem, aiItemCount)

EndIf

EndEvent
Code Box is being dumb ^
Edited by ZombicideII
Link to comment
Share on other sites

First one, "==" shouldn't be "=" ?

Event OnActivate(ObjectReference akActionRef)
UHobjCount = PlayerRef1.GetItemCount(UHModsList)
PlayerRef1.RemoveItem(UHModsList, UHobjCount, True, UHModCont)

Second one, it isn't ">=0"?

If(UHJunk1.Find(akBaseItem) >= 0)
Link to comment
Share on other sites

  • Recently Browsing   0 members

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