Jump to content

[Script] Container akBaseItem and keywords


Zorkaz

Recommended Posts

So I put this on a container. It should refuse items that are not holotapes, bobbleheads, loose mods and books but it now accepts every item.

Did I overlook some simple script logic or might akBaseItem not work with ".haskeyword()"?

Scriptname HCHolotapeInventoryFilterSc extends ObjectReference

Holotape Property HCHolotape Auto
Int Property LeInt Auto
Keyword Property BobbleheadKeyword Auto 
Keyword Property ObjectTypeLooseMod Auto 


Event Oninit()
   Self.AddInventoryEventFilter(akFilter = None)
EndEvent

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

	If Self.getitemcount (HCHolotape) >=1 
	Self.removeitem (HCHolotape)
	Game.Getplayer().Additem (HCHolotape)
	Endif

Elseif (akBaseItem is Book)
;Do nothing

Elseif (akBaseItem.haskeyword (BobbleheadKeyword))
;Do nothing


Elseif (akBaseItem.haskeyword (ObjectTypeLooseMod))
;Do nothing

Else
LeInt = AiItemCount
Game.Getplayer().Additem (AkBaseItem, AiItemCount)
Self.removeitem (AkBaseItem, AiItemCount)
Endif

EndEvent

(I used debug notifications but they won't show up)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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