#(empyrealpa) saving, clearing and restoring inventory on region exit
61 messages ยท Page 1 of 1 (latest)
(empyrealpa) saving, clearing and restoring inventory on region exit
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>
@spiral spoke
Thread was closed either automatically by timeout or by the Discord manual close button. If closing was intentional, please use </resolved:1028673926114594866> or </invalid:1028673926898909185>.
@spiral spoke
Thread was closed either automatically by timeout or by the Discord manual close button. If closing was intentional, please use </resolved:1028673926114594866> or </invalid:1028673926898909185>.
sorry, tried closing it as I realised I'd posted it in the wrong place
sorry
No worries, see that message ^
Also note:
!rule 8
Don't overuse the edit/delete buttons. https://denizenscript.com/discord_rules#rule8
Use the edit button to fix typos, and the delete button to remove an accidental post shortly after posting.
Do not remove a post that pings someone, do not edit or delete a post that people have already replied to.
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@spiral spoke
ahhh sorry, my bad
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@spiral spoke
But also uh, this looks like the correct place? if you're trying to make a Denizen script then this is the right channel to ask in @spiral spoke
Otherwise, please close the post as explained here ^
Oh sorry, I thought it might be classed as a question and therefore the wrong place to ask
This channel is for questions, it's the Denizen support channel
right so I was in the right place ๐
I was trying to wrap my head around saving, clearing and then restoring players inventories based on worldguard regions, I was looking through the inventory commands but wasn't quite sure which ones to use
WorldGuard doesn't seem to have any useful API for detecting that, so your best bet is probably to use Denizen notes - can either note them with the same area the WG region or replace the WG region with them
!g special memory
View the guide page 'Special Memory: Notable Objects' at: https://guide.denizenscript.com/guides/advanced/notables.html
!t WorldGuardRegionTag.area
Returns the region's block area as a CuboidTag or PolygonTag.
Depenizen, WorldGuard
conversion
AreaObject
Not sure if you want it to be dynamic or not, but can use that to easily get a region's area ^
After you have the area noted, can use
!e enters exists
Did you mean to search for entity enters portal?
!e enters|exists area
Did you mean to search for entity enters|exits area?
Entity
cancelling this event will have different results depending on the cause. Teleporting the entity away 1 tick later might be safer.
<entity> enters|exits <area>
when an entity enters or exits a noted area (cuboid, ellipsoid, or polygon). On Spigot servers, only fires for players. Paper is required for other mob types.
When the entity is a player. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.
<context.area> returns the area object that was entered or exited.
<context.cause> returns the cause of the event. Can be: WALK, WORLD_CHANGE, JOIN, QUIT, TELEPORT, VEHICLE.
<context.to> returns the location the entity moved to (might not be available in exit events).
<context.from> returns the location the entity moved from (when available, depending on cause).
<context.entity> returns the entity that entered/exited an area.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
That ^ to detect a player going in/out
You can then store all of the items currently in their inventory:
!t PlayerTag.inventory
Returns a InventoryTag of the player's current inventory.
Works with offline players.
InventoryTag
!t InventoryTag.list_contents
Returns a list of all items in the inventory.
properties
ListTag(ItemTag)
InventoryTag.contents
!g flags
View the guide page 'Long Term Memory: Flags' at: https://guide.denizenscript.com/guides/basics/flags.html
Flag the player with their current inventory contents, and then clear their inventory
!c inventory u
item
inventory [open/close/copy/move/swap/set/keep/exclude/fill/clear/update/adjust <mechanism>:<value>/flag <name>(:<action>)[:<value>] (expire:<time>)] (destination:<inventory>) (origin:<inventory>/<item>|...) (slot:<slot>)
Edits the inventory of a player, NPC, or chest.
- inventory open d:<context.location>
- inventory open d:generic[size=27;title=BestInventory;contents=snowball|stick]
- inventory open d:<[player].inventory>
- inventory keep d:<context.location.inventory> o:snowball|ItemScript
- inventory exclude origin:stick|stone
... and 5 more.
See the clear option there ^
And that should handle clearing and saving it once they exit the region, for setting it back once they enter, all you need to do is get their items from the flag
!t FlaggableObject.flag
Returns the specified flag from the flaggable object.
If the flag is expired, will return null.
Consider also using !tag FlaggableObject.has_flag.
See !language flag system.
ObjectTag
And set it back into their inventory - can use inventory set ^
Feel free to ask here if you're having any trouble / anything is unclear, we're always happy to help :D
Amazing! thank you so much ๐
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@spiral spoke