I need help with armor effects

Started by P'titeLouise on Mon, 07/19/2021 - 00:50

Topic category: Help with modding (Java Edition)

Last seen on 12:27, 19. Jul 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I need help with armor effects
Mon, 07/19/2021 - 10:50 (edited)

I don't know if I put this topic in the right category, sorry ...

So to keep it simple, I spent a good hour researching how to apply an effect when donning armor.
But not just for a single piece of armor!
I would like the effect (fire resistance) to trigger when the armor is fully donned.

Can someone help me please? ^^"

Edited by P'titeLouise on Mon, 07/19/2021 - 10:50
Last seen on 02:01, 27. Aug 2021
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
This prosecute for each item…
Mon, 07/19/2021 - 01:04

This prosecute for each item

 

ItemInInventoryTick

If [helm] in armor slot 0

  • If [chestplate] in armor slot 1
  •  - If [leggings] in armor slot 2
  •  - - If [boots] in armor slot 3
  •  - - - Give Effect
Last seen on 12:27, 19. Jul 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thanks! ^^
Mon, 07/19/2021 - 01:20

Thanks! ^^

Last seen on 21:52, 22. Sep 2021
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
ouh, hold up! armor slot 0…
Mon, 07/19/2021 - 01:57

ouh, hold up! armor slot 0 is actually for boots, slot 1 for leggings, slot 2 for chestplate, and slot 3 for helmet. TechTastic, you got it turned around. it should be:

  • if [helmet] in armor slot 3
  • - if [chestplate] in armor slot 2
  • -- if [leggings] in armor slot 1
  • --- if [boots] in armor slot 0
  • ---- do (give potion effect)

or even better, you can make it more efficient. you don't have to use 4 separate if-statements to check for armor, you can just combine them using "AND" blocks, like so:

  • if [helmet] in armor slot 3 AND [chestplate] in armor slot 2 AND [leggings] in armor slot 1 AND [boots] in armor slot 0
  • - do (give potion effect)

that way, there'll be only 1 condition checking for armor, with 4 checks. if only 1 of the checks is true (e.g. only helmet in slot 3 is true), the condition will result to false and it won't execute. and if only 1 of the checks is false (e.g. only boots in slot 0 is true, others are false), it also won't execute. it'll only run the procedure when, and only when, all 4 checks are true and condition is met, which will result to (you guessed it) true. you know this already if you're a programmer, but it isn't that hard of a concept to learn ;)

Last seen on 21:52, 22. Sep 2021
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
another thing to add: you…
Mon, 07/19/2021 - 02:04

another thing to add: you can use the global trigger of "on player tick update" for this instead of local "item in inventory tick" for each armor piece. simply create a procedure, click the dropdown button on the green "start" block, and select "on player tick update" from the list. then, add everything else needed in the procedure

Last seen on 12:27, 19. Jul 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thank you very much,…
Mon, 07/19/2021 - 06:10

Thank you very much, Sajevius! ^^

By the way, I have another question :3

If I want my pickaxe to smelt the block I am mining, what should I do? ;-;

Last seen on 21:52, 22. Sep 2021
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
hmm, i've done that before,…
Mon, 07/19/2021 - 06:59

hmm, i've done that before, i made a procedurewhere it drops the smelting result of the block mined if the block can be smelted instead of the block's default drop/s itself and it's quite simple! basically all you need is to create a procedure for your pickaxe's "when block destroyed with tool" trigger, make a local itemstack variable there called "block_item" or whatever you want, then set that itemstack variable to the block at x y z (the one we mined), converted into an item. then, if the itemstack variable (aka the block you just mined, now converted into its block item form) can be smelted, destroy the block at x y z which won't spawn the default drops, and spawn the smelting result of the variable instead (again, it's equivalent to the block mined, when converted to item). looks something like:

  • set local:block_item to convert [get block at x y z] to
  • if (can local:block_item be smelted)
  • - do 
  • -- remove block at x y z and spawn break particles
  • -- spawn item/gem [get smelting result of get local:block_item] at x y z

really small but really fun procedure ^^ (oh, and it works with modded ores/smeltable blocks too!)

Last seen on 21:52, 22. Sep 2021
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
and if only 1 of the checks…
Mon, 07/19/2021 - 09:18

and if only 1 of the checks is false (e.g. only boots in slot 0 is true, others are false), it also won't execute

...oh you classic Sajevius. I got it wrong, I can't believe it XD

i meant to say "only boots in slot 0 is false, others are true", sorry for the confusion if any