Help with making a custom armor work like a lightning tod

Started by ktkyo_4 on

Topic category: Help with modding (Java Edition)

Last seen on 00:51, 28. Aug 2024
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with making a custom armor work like a lightning tod

Hello everyone, I am trying to get my custom armor to have a higher probability to get struck by lightning like vanilla lightning rods but I get lightning spammed onto me instead of them behaving like regular lightning bolts in thunder weather. How could I implement that mechanic? Also is it possible to avoid the lightning going through blocks like vanilla ones? Thanks in advance

Last seen on 04:06, 14. Sep 2024
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
while you are wearing each…
Fri, 08/16/2024 - 04:39

while you are wearing each part of armor, use the random chance that mcreator has in procedure templates, or use the random number and if it equals a high number then strike lightning 

Last seen on 00:51, 28. Aug 2024
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey, thanks for the tip. I…
Sat, 08/17/2024 - 03:01

Hey, thanks for the tip. I got it running. i thought of making it 1/100000 per tick like regular lightning but i figured that would make it really rare as regular lightning strike per chunk hence having more probability. I lowered it to 1/1000 and it's doing good. Only problem I have the lightning is still going through blocks. Is there any way to fix it?

Last seen on 04:06, 14. Sep 2024
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you can check if the player…
Sat, 08/17/2024 - 07:41

you can check if the player can see the sky, but that might still strike you when under transparent blocks like glass, but you should test that out, using a higher chance to get struck will help with the tests

Last seen on 00:51, 28. Aug 2024
Joined Aug 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Worked just as you said. It…
Sat, 08/17/2024 - 14:26

Worked just as you said. It still goes through transparent blocks. I'll have to think something out with solid block procedures I guess?

Last seen on 04:06, 14. Sep 2024
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could also check every…
Sun, 08/18/2024 - 09:35

You could also check every block above the player using a counter, get the y level, subtract it from the max world height, and count up checking for any blocks not equal to air and strike if there is none, though this one is more work to make, and will be more intensive since it will be checking 4 times with each piece of armor.