• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

How to return a loot container upon close

SlicksGirl

Refugee
I'm still working on starter loot containers. I'd like to know how I might put the container back in the players inventory when they close it. For instance, I'd like to give a backpack of dukes and ammo upon startup (as an example) and when they close the container the backpack goes into their inventory. Or would I need the bag to drop itself on the ground and force them to pick it up before it despawns?

i tried

Code:
<drop event="harvest" name="cntAmmoPileSmall" count="1" />
but i get this error

Code:
2019-03-20T11:37:38 31.860 ERR XML loader: Loading and parsing 'blocks.xml' failed
2019-03-20T11:37:38 31.861 EXC The requested value 'harvest' was not found.
ArgumentException: The requested value 'harvest' was not found.
which i get because obviously "harvest" doesnt work for this event.

any ideas so that the player gets the storage container and it doesnt stay there to respawn loot besides completely destroying the container?

(I also still cannot get the containers to spawn loot at startup, but thats a different issue)

(Valmods modlet for reference https://7daystodie.com/forums/showthread.php?31157-Survivor-s-Pack-Starting-Gear&highlight=starter+pack)

 
Last edited by a moderator:
I would try something along these lines instead....

Didn't do any testing so don't know if that would be what you are looking for.

Code:
xpath="/blocks/block[@name='cntAmmoPileSmall']/drop[@event='Destroy' and @count='0']/@count">1</set>
<setattribute xpath="/blocks/block[@name='cntAmmoPileSmall']/drop[@event='Destroy']" name="name">cntAmmoPileSmall</setattribute>
 
see, i dont want to return vanilla loot containers because i dont want people picking up loot containers from pois.

but i did try dropevent 1 on the modded file loot container string and it says that drop event doesnt exist when i load the game.

i do thank you for helping.

 
I assume this is for A17 ? or is it A16 ?

haven't tried this myself but what could happen if you remove the destroy event <drop event="Destroy" count="0" /> .. or remove the option from the loot destroy_on_close="true"

Remove from XML on A16 or Xpath remove if A17

An interesting thread this one :)

 
Last edited by a moderator:
its a17.2

what i wound up doing is adding the container into the loot list so that they get it when they bust it open.

 
So when i right understand, you would add a new LootContainer with custome loot ?
actually i did that and wanted that loot container to wind up in the players inventory so they could use it as storage. isntead i put the vanilla version of the same loot container into their loot list for that loot container. not as fancy, but same end result

 
Back
Top