Jump to content

[LE] Simple Script Help


huggibee

Recommended Posts

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?

 

 

Scriptname LaundryBrush extends ObjectReference

Event OnActivate(ObjectReference akActionRef)

if PlayerRef.GetItemCount(DL) > 0 ; player is carrying enough laundry
if PlayerRef.GetItemCount(Soap) > 0 ; player is carrying enough soap
PlayerRef.RemoveItem(DL, 1) ; remove the dirty laundry
PlayerRef.RemoveItem(Soap, 1) ; remove the soap
PlayerRef.AddItem(CL, 1) ; add the clean laundry

elseif _anomad_LB_MSG ; there's a message available so show it
_anomad_LB_MSG.Show()

endif
endif
endevent


MiscObject Property CL Auto
MiscObject Property DL Auto
MiscObject Property Soap Auto
Actor Property PlayerRef Auto
Message Property _anomad_LB_MSG Auto

 

Link to comment
Share on other sites

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).

 

 

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 by maxarturo
Link to comment
Share on other sites

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 by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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