#changing attribute and then setting it back to what it was

1 messages · Page 1 of 1 (latest)

grim mist
#

i want to know how would you approach changing some attribute of a mob and then setting it back to what it was.

the only thing i could think of, is this:
think of a zombie named bob. now before changing his attribute i am first going to append a new compound entry in an array {uuid:[],value:0b} then i would store bob's attribute value and uuid into that compound. then i will change the attribute to whatever value i want.

now, if i wanna change the attribute back to what it was, i would iterate over the array until uuid matches to that of bob, and then via macros i would set his attribute back to what it was. this would certainly work, but i dont think this is the most efficient solution, and i hope to get some help brainstorming a better perfoming solution

clever pollenBOT
#

<@&1201956957406109788>

Someone will come and help soon!

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

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

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

frank barn
#

just only change the value via modifiers that you can remove once your done

#

@grim mist

grim yoke
#

From memory: attribute @s <attribute> modifier <name> <uuid> <amount> <operation>

And then later you can remove it with
attribute @s <attribute> remove <same uuid>

#

Use autofill to help, syntax accuracy not guaranteed

clear wraithBOT
#
📜 /attribute

attribute <target> <attribute> get [<scale>]

Returns the total value of the specified attribute.

attribute <target> <attribute> base get [<scale>]

Returns the base value of the specified attribute.

attribute <target> <attribute> base set <value>

Overwrites the base value of the specified attribute with the given value.

attribute <target> <attribute> modifier add <uuid> <name> <value> (add|multiply|multiply_base)

Adds an attribute modifier with the specified properties if no modifier with the same UUID already existed.

attribute <target> <attribute> modifier remove <uuid>

Removes the attribute modifier with the specified UUID.

attribute <target> <attribute> modifier value get <uuid> [<scale>]

Returns the value of the modifier with the specified UUID.

frank barn
grim mist
frank barn
#

an attribute can have multiple modifiers

#

the uuid is there so you can differentiate between them

grim mist
grim yoke
#

Yep

#

The DPH extension can auto-generate a random one for you, depending on your version

grim mist
#

pretty cool, so I add a modifier to say multiple an attribute by 0, and when I remove that modifier and it will get back to what it was on its own?

#

if that's what it is, then it's absolutely insane, thanks y'all

clever pollenBOT
# clever pollen <@&1201956957406109788>
Question Closed

Your question, #1239650038905573386 (changing attribute and then setting it back to what it was), was resolved!

Original Message

#1239650038905573386 message

Duration open

42m

grim mist
#

reopening this

clever pollenBOT
grim mist
#

this doesnt work ```mcf
/attribute @s minecraft:generic.movement_speed modifier add 8aefc60a-b385-4b9a-97f5-15b901a21f43 stun 0 multiply_base

neither does this

/attribute @s minecraft:generic.movement_speed modifier add 8aefc60a-b385-4b9a-97f5-15b901a21f43 stun 0 multiply

#

what am i doing wrong

#

like it doesnt actually change my speed

frank barn
#

that means you are actually multiplying by 1

grim mist
grim mist
#

oh

#

thanks

#

that actually worked

#

perfect.