McTAL Posted February 3, 2019 Posted February 3, 2019 Hello! So, I'm VERY new to scripting but am trying my best to learn and create as I go. I'm currently trying to create an activator that adds and removes certain items from the player inventory. Here is what I have, but it isn't working at all. Would anyone be willing to give me a hint as to what it might be or how to make this script better? Reveal hidden contents Scriptname LaundryBrush extends ObjectReferenceEvent OnActivate(ObjectReference akActionRef)if PlayerRef.GetItemCount(DL) > 0 ; player is carrying enough laundryif PlayerRef.GetItemCount(Soap) > 0 ; player is carrying enough soapPlayerRef.RemoveItem(DL, 1) ; remove the dirty laundryPlayerRef.RemoveItem(Soap, 1) ; remove the soapPlayerRef.AddItem(CL, 1) ; add the clean laundryelseif _anomad_LB_MSG ; there's a message available so show it_anomad_LB_MSG.Show()endifendifendeventMiscObject Property CL AutoMiscObject Property DL AutoMiscObject Property Soap AutoActor Property PlayerRef AutoMessage Property _anomad_LB_MSG Auto
maxarturo Posted February 3, 2019 Posted February 3, 2019 (edited) Experiment yourself with this one until a more experienced scripter post exactly what you want, it adds and remove item from inventory upon activate (assaign it to an activator - pedestal). Reveal hidden contents Scriptname aXMDrenoveItemSCRIPT01 extends ObjectReference {Removes - Adds item from - inventory uppon activate} MiscObject Property Item Auto {assign an item to add & remove} bool Property isTriggered = false auto hidden Event onActivate(ObjectReference akActionRef) if (isTriggered != TRUE && akactionref.getitemcount(Item) >= 1) akactionref.removeitem(Item, 1) isTriggered = true elseif (isTriggered != FALSE && akactionref.getitemcount(Item) >= 0) akactionref.additem(Item, 1) isTriggered = false endif endEvent Hope it helps.... Edited February 4, 2019 by maxarturo
McTAL Posted February 4, 2019 Author Posted February 4, 2019 Thank you for you help, I appreciate it! I'll experiment further with the provided script!
maxarturo Posted February 4, 2019 Posted February 4, 2019 (edited) I forgot to mention that this script works only when a pedestal gets triggered.Example: placing a "Dynamo Core" in the pedestal or a lever is triggered.But you can change the "isTriggered" to "Activate". Edited February 4, 2019 by maxarturo
Recommended Posts