#Help on implementing dual wielding

1 messages · Page 1 of 1 (latest)

glossy siren
#

Basically what i want to do is take the stats of the item in players hand, store them, turn those stats into straight bonuses with a formula, store that value too then add those flat bonuses to the player. Is that possible, more importantly, how?

tidal sandalBOT
#

<@&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: #1331320664417636484

glossy siren
#

im working on 1.21-snapshots btw (havent decided yet)

tidal sandalBOT
# tidal sandal <@&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)

nova onyx
#

Why not just make the item have attribute modifiers that can apply in either hand?

rich berry
#

So, you'll probably want to use an attribute modifier that gets removed and re-applied whenever the player changes their inventory

#

Using an advancement with the "inventory_changed criteria", you can detect when the player moves items around, preventing the updating from applying constantly

#

Then, you can get the item modifiers of the item in offhand, copy that value into a scoreboard (scaled up), run whatever algorithm you need, copy that score into storage, then run a macro function with that storage to re-apply the attribute modifier with the new value

glossy siren
#

thank you, that really shows a clear road to take

#

though im not sure how i can get the item modifiers and i don't reallt understand the consept of macro functions

#

i would be grateful if someone could shine light on those topics

static galleon
#

https://misode.github.io/
Herr you create item modifier with a YouTube turorial (there are plenty, take a pick)

And macros basically work that way:
“say something”
“$say $(something)”

so if you store variable “something” into storage, you can access it in a function later.
function example:test with storage example:test test

So, if we have storage example:test test like that: {“something”:”Hello!”,”number”:12}
We will get next result:

$say $(something)
$scoreboard players add test test $(number)

[server] Hello!
added 12 to score of test test

rich berry
#

The one big part I'm not too sure about is how to get the item modifier from the offhand item

static galleon
rich berry
#

I'm not certain lol

#

I just know there are item modifier lists you need to parse through

tidal sandalBOT
#
Closed for inactivity

This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.