Jump to content

Script is not working(AddIem is not a function)


Yrdolf

Recommended Posts

hmm...

 

How are you waiting the 24 hours?

 

According to the wiki:

The total wait time may longer in certain cases where the game clock jumps ahead by a large amount (i.e. fast travel).

Waiting via the wait feature may be playing a factor. Try waiting by just standing there and letting time pass by. See if that has an effect. If that is indeed the case, there is a snippet from a script in the modder's resource for the dairy stuff (i.e. milking cow) that does a game time check before allowing the activation to happen. It allows you to just stand there and wait or wait using the wait feature without any oddities in time passing etc... It could be adapted to your purposes as well.

Link to comment
Share on other sites

@Yrdolf: I told you not to declare the native functions. Why have you added back all the crap that I removed from the script? :armscrossed:

You have effectively overridden the parent AddItem and WaitGameTime functions with new functions that do nothing :facepalm:

 

Other than that, you could try placing the AddItem after the second BlockActivation statement, rather than before it.

 

ScriptName duplicateItem extends ObjectReference

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
       If akBaseItem as Ingredient
               BlockActivation() ; don't allow any more ingredients to be added or removed
               Utility.WaitGameTime(24)
               BlockActivation(false) ; can now add more ingredients or remove items from container
               AddItem(akBaseItem, aiItemCount, true)
       Else
               RemoveItem(akBaseItem, aiItemCount, true, akSourceContainer) ; if it is not an ingredient, return it to the player
       EndIf
EndEvent

Edited by steve40
Link to comment
Share on other sites

Well, now I took your script and the WaitGameTime was the problem why the chest did not open anymore :rolleyes: . But now, the script don't stop with adding items to the chest. Even if I remove all the items of the chest it will add items. :confused:

 

Is there a way to told the script to Add the Item only one time?

 

Edit:

Forget the last problem, I have solved it and now my script is complete. :wink:

 

Thank you all for your help :thumbsup:

Edited by Yrdolf
Link to comment
Share on other sites

  • Recently Browsing   0 members

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