#ADVANCED: Swappable spells 🪄 (Arcana)

1 messages · Page 1 of 1 (latest)

thorny hamlet
#

Hiiyaa! This question is for a datapack I'm working on called Arcana (not my main project It Spreads), where I want to use the new item components to create wands with spell slots you can swap out and switch between. I have a few ideas for how to do this, but I'm interested to see what other people can come up with. Basically, I want to store spells in the custom data of a Wand item, and use the consumable component to give the spells custom cooldowns, casting times, and animations. The biggest problems currently are getting the item back after consuming it, updating the spell when it is swapped, adding and removing spells from the wand, and displaying the selected spell (which changes while shift-clicking). It also needs to work in mainhand and offhand.

proper roostBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

#
⚠️ You already have a question open!

Don't forget to close or resolve your old questions once you're done with them. It makes our lives much easier! :D

Open question: #1305888154573607013

tender galleon
#

I'm not really sure where to start here, is the issue that you don't know how to do any of this? Cause it sounds like you know exactly what to do

#

That's certainly what I would do, so I don't think you're gonna get a whole lot of alternative methods. Only thing I might do differently is not have the wand actually get consumed so you don't need to worry about giving it back

thorny hamlet
#

I know how to use most things that I'll need in order to accomplish this, I'm just really not sure how to do these things specifically

tender galleon
#

The normal consumable-right-click-detection method

thorny hamlet
#

I'm using the consumable component as-intended, since the process has to finish in order to make everything else work

tender galleon
#

Unfortunately it requires you use a scoreboard timer as the method of cooldown, but imo that's a small tradeoff for a much easier system

tender galleon
thorny hamlet
#

I'm not really sure how to get the item back easily

tender galleon
#

Yeah, I'm frankly not super sure either. The fact it's such a dynamic item makes that tough

thorny hamlet
#

Is it possible to make the consume_remainder be the original item?

tender galleon
#

You'd probably need to store the item's data to storage before consumption, but that runs into trickiness when a player has more than one wand

tender galleon
thorny hamlet
#

Hmmm

#

Is it possible to, like, update it whenever it would change?

tender galleon
#

You can make it give back a wand with pre-loaded spells, and make an option for every combination of spells, detecting which ones the old wand had to determine which to give

But obviously that would suck

tender galleon
tender galleon
#

That sounds really janky, I'm not actually certain it's possible or would work

thorny hamlet
#

Hmmmmmm

#

Would I be able to save it to storage, and detect a specific use_remainder item in mainhand/offhand and replace it with the stored item somehow??

tender galleon
#

Presumably

#

I'm not super experienced with using data storage, but that sounds feasible. Certainly detecting the dummy use remainder item is, as is replacing it with something

#

So it just comes down to how easy it is to have that replacement incorporate data from storage

thorny hamlet
tender galleon
#

Sure

tender galleon
#

The armor stand would certainly be jankier by definition

#

But also easier

thorny hamlet
#

I think neither way is straightforward at all 😭😭

#

Like, I'm planning to use advancements to detect the usage

tender galleon
thorny hamlet
thorny hamlet
#

I've decided I'm gonna have a spellcast function when the wand is used that will copy it over

#

Basically, I'll just detect when the wand is eaten and give it to an armor stand/item display/item and stuff it back into itself

#

...

#

we use the weirdest freaking coding language ever don't we 😭

proper roostBOT
# proper roost <@&1201956957406109788>

<@&1166082198152159386> <@&1202694677766348840>

🙇 Helpers Arise!

Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)

zealous ridge
thorny hamlet
#

Ty! I'll check this out

thorny hamlet
#

I think I'll try to do something similar, but make modified versions for swapping vs using

thorny hamlet
#

So ummmm

#

How should I switch like

#

The selected slot

#

actually I have an idea for that nvm

#

Anyways, I'm wondering how to swap out the spells

#

Anyone have any ideas? :3

vocal chasm
#

you want to modify the spell data?

#

what about /data

tender galleon
#

Probably an item modifier

sharp cargo
#

I would use an item modifer.

thorny hamlet
tender galleon
#

What do you know about item modifiers currently?

thorny hamlet
tender galleon
#

So what then isn't clear about how you'd use it to change the custom data component?

thorny hamlet
#

I'm... not really sure how to switch the spells in the different spell slots on it

tender galleon
#

You can't, really. You have to overwrite the entire custom data component. So, you'd need some way to both determine which slot is being replaced, and retain what the other slot is

#

There is the option of using custom enchantments that don't have any behavior of their own to represent the spells, and I could see a few routes to go there

thorny hamlet
#

I was also thinking in, like, a less technical manner

#

Actually umm

tender galleon
thorny hamlet
#

Like

#

Like how should I make the player able to change out the spells? Some kind of custom crafting table? A GUI? Is it possible to basically take each custom data spell slot and turn it into some kind of spellbook or scroll that stores the spell, and then be able to rearrange or add new ones and turn them back into data?

thorny hamlet
#

Anyways, I will try to implement some of these things ^^

tender galleon
#

Really more of a creative question

thorny hamlet
thorny hamlet
#

Alright, I'll try to figure this out and then come back if I need help :3