[SOLVED] Be immune to lightning for player

Started by Gavydog on Mon, 06/22/2020 - 12:50

Topic category: Help with modding (Java Edition)

Last seen on 01:30, 23. Sep 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[SOLVED] Be immune to lightning for player
Wed, 06/24/2020 - 11:57 (edited)

Yeah, so I have this axe which summons lightning when you attack a mob, but the lightning damages the player also. Any way to stop the player from being damaged? 

Also if this is possible I would like the lightning bolt to not cause fire. Thx!

Edited by Gavydog on Wed, 06/24/2020 - 11:57
Last seen on 17:22, 8. Jun 2021
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
 do something like this: …
Mon, 06/22/2020 - 19:16

 do something like this:

https://cdn.discordapp.com/attachments/599250311852458006/724703022575517756/unknown.png

the 1st text field text is: "LivingAttackEvent  event = (LivingAttackEvent)dependencies.get("event");"

the 2nd text field is: "if (event.getSource() != null && event.getSource() == DamageSource.LIGHTNING_BOLT) "

also replace the wooden axe with your custom axe.

this makes all players immune to lightning if he has that axe in main hand.

 

Last seen on 01:30, 23. Sep 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Where am I supposed to put…
Tue, 06/23/2020 - 00:35

Where am I supposed to put this? Because after I put this code I was followed by infinite lightning :/

Last seen on 01:30, 23. Sep 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Wait actually now it doesnt…
Tue, 06/23/2020 - 00:49

Wait actually now it doesnt but i still take lightning damage.

Last seen on 17:16, 22. Jun 2021
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Ahznb, wow nice, with this,…
Tue, 06/23/2020 - 04:49

Ahznb, wow nice, with this, you will be able to make a plugins about making player immune to many kinds of damages?

Last seen on 17:22, 8. Jun 2021
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
create a new procedure…
Tue, 06/23/2020 - 07:23

create a new procedure element and put that in. also note in the top green block, the global trigger is "Entity attacked"

Last seen on 17:22, 8. Jun 2021
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
yes. but note that this is…
Tue, 06/23/2020 - 07:26

yes. but note that this is for 1.12.2. i don't know if 1.15.x changed it or not

Last seen on 01:30, 23. Sep 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Oh maybe thats why im using…
Tue, 06/23/2020 - 08:03

Oh maybe thats why im using 1.15.2

Last seen on 01:30, 23. Sep 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
But here's my scipts
Tue, 06/23/2020 - 08:10

But here's my scipts

Last seen on 17:16, 22. Jun 2021
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
No, I tried 1.15.2 and it's…
Tue, 06/23/2020 - 11:18

No, I tried 1.15.2 and it's still working tho

Last seen on 01:30, 23. Sep 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Then is my scripts wrong
Tue, 06/23/2020 - 12:00

Then is my scripts wrong

Last seen on 01:30, 23. Sep 2020
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
ahznb Does it matter if the…
Wed, 06/24/2020 - 00:01

ahznb Does it matter if the current entity is replaced by source entity is it the same. Cuz Idk what's wrong

Last seen on 17:16, 22. Jun 2021
Joined Jun 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You only use Source Entity…
Wed, 06/24/2020 - 03:53

You only use Source Entity when you hit other entities, but in this case, the lighting damages the entities not you So use Current Entity

Last seen on 17:22, 8. Jun 2021
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
are you calling that…
Wed, 06/24/2020 - 05:41

are you calling that procedure from somewhere? because you shouldn't call it, just create the procedure and don't call it anywhere.