Jump to content

How to properly use RemoveAllItem()?


hxhunter15

Recommended Posts

It seems you both did the same thing. You need to keep the original argument names in the function and add = to whatever the transfer target is. Skeleton.RemoveAllItems(ObjectReference akTransferTo = Grave, bool abKeepOwnership = false) native

 

The reason why it's like this is bc child scripts cant change anything in parent scripts and most likely the preset arguments are global so their values can move across scripts ect. I know it's super irritating. Any other language (at least that I've seen) you can change the arguments to whatever and the parent function changes the values automatically.

This is incorrect. You do not need to add the original parameter / argument names to any function calls unless you are skipping parameters. And child scripts can most certainly change properties of their parent scripts so long as they have a reference to the parent object, or you can use the parent variable.

Edited by Reneer
Link to comment
Share on other sites

I deleted that post bc it just seems like sometimes it can sometimes it cant. Like if you register for an event you cant change the arguments of the event, but I guess when you call a function you can... it's just one of many endless list of weird quirks of this language. It definitely keeps u jumping from one foot to the other.

 

I guess in the instance of an event the variable definitions come from the world.

Edited by markyrocks
Link to comment
Share on other sites

I deleted that post bc it just seems like sometimes it can sometimes it cant. Like if you register for an event you cant change the arguments of the event, but I guess when you call a function you can... it's just one of many endless list of weird quirks of this language. It definitely keeps u jumping from one foot to the other.

 

I guess in the instance of an event the variable definitions come from the world.

You can't change the type of arguments when calling a function or registering for an event. What you might be getting confused by is that Papyrus can automatically "cast" some object types to other object types (generally going up the chain like an ObjectReference being cast as a Form). But if you try sticking a MagicEffect into a function which expects an ObjectReference, Papyrus will throw an error.

Link to comment
Share on other sites

Dynamic content like LevelLists don't *SEEM TO* spawn/respawn until the container OnCellAttach() or OnLoad() to ensure it levels with the player ... are you RemovingAllItems when the container Is3DLoaded in the player's uGridsToLoad radius ?

For the source container, definitely. I was standing right next to it. The target container has just been created, however.

 

 

As a brute force method to this problem would be to save the items in the first container in an array and then force the script to add the items to the second container via a loop and containerRef.additem(itemArray, 1, issilent) something like that. I'm finding this scripting to be very finicky so who knows if what I'm describing would actually work.

I don't want to add a hard F4SE dependency, though :/

Link to comment
Share on other sites

Just a guess, but perhaps trying DropFirstObject in a while loop (using GetItemCount) and moving the resultant ObjectReference might work. I don't generally work with LevelList stuff so it still might not work. Edited by Reneer
Link to comment
Share on other sites

Just checked some of my stuff and RemoveAllItems is working fine to consolidate materials from all workshops generated by level list WorkshopInitialResources_Settlement into a central storage container:

WorkshopScript[] WorkshopREFs = pWorkshopParentScript.Workshops
Int iIndex = 0 
While (iIndex < WorkshopREFs.Length)
   If (WorkshopREFs[iIndex] != None) && (WorkshopREFs[iIndex].OwnedByPlayer == TRUE)
      WorkshopREFs[iIndex].RemoveAllItems(pCentralStorageREF, abKeepOwnership = true)
   EndIf
   iIndex += 1
EndWhile 

I had been generating a temp container local to the source, filling it and then moving to the central container when I was worried about the "if containers are not in the same cell you will lose all your stuff" warning, but found with a placed persistent central container in a remote cell its all works fast and fine direct.

 

So, infact 3Dloaded, same cell and level lists do not seem to be issues. Its the bones ...

Edited by SKK50
Link to comment
Share on other sites

So what is actually the point of this? I'm assuming that the OP knows what items are supposed to be in there if it's part of his mod. Does it make more sense to start with nothing in both containers and then use like onactivate() to add the items to the 2nd container and disable the skeleton? I mean it seems like the approach is harder than it needs to be.
Link to comment
Share on other sites

So what is actually the point of this? I'm assuming that the OP knows what items are supposed to be in there if it's part of his mod. Does it make more sense to start with nothing in both containers and then use like onactivate() to add the items to the 2nd container and disable the skeleton? I mean it seems like the approach is harder than it needs to be.

It's not part of my mod. The skeletons are from Boston Interiors, and I just wanted to make it possible to bury them.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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