[Solved] - How to make entity deal additional damage

Started by ZarephLae on

Topic category: Help with modding (Java Edition)

Last seen on 19:29, 11. Apr 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Solved] - How to make entity deal additional damage
Mon, 06/19/2023 - 01:34 (edited)

So majority of what I want is done.

 

I have all the procedures made but I don't have them linked to any triggers.

 

Like I have a procedure that defines how the effect is applied. But I can't add it to the potion effect because it doesn't use source entity.

https://imgur.com/59aKJ1R

 

I made a procedure that defines what this status effect does but I can't add it to the potion effect trigger because it doesn't have source entity triggers.

https://imgur.com/FNXoSUm

 

I need to link them to the effect but I can't. Please help.

Edited by ZarephLae on Mon, 06/19/2023 - 01:34
Last seen on 20:49, 23. Jun 2023
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
For your potion effect, what…
Sun, 06/18/2023 - 21:03

For your potion effect, what I would do is go to your triggers and make an "On effect active tick" procedure. This will execute code every tick, so a way that I found to be helpful was within the procedure, you can make a timer that applies the effects you desire, allowing you to choose the frequency so that it doesn't damage you every tick. The way you can do this is use an if: do, else statement, and within the if block, grab an equals (=) block from logic. From entity data, grab a Get custom number NBT tag. Set the tag string to "timer". Drag the custom number NBT block into the equals block's first argument, and after the equals, add an integer (0).

 

Underneath that block, go to entity management and "Set custom NBT tag", string value should be "timer". For the last argument, it requires a number, this will be your number of ticks that it must wait before damaging the player again. I found 50 to work for my effect. Underneath that, apply the logic for damaging the entity/player.  Within the else block, Set custom number NBT tag "timer". For the last argument it requires, go to Math and grab the operator block (+) and set it to Subtract. Within the operator's first argument, drag in a "Get custom number NBT tag", and on the last argument, drag in a "1" integer.

 

What is happening:

As a reminder, this procedure is being executed every tick, and NBT is persistent, so we are using this as a timer as a type of public variable so we can access it to subtract every whatever number of ticks we set, so we can space out the damage. The NBT data is being embedded within the target entity which is whoever has the potion effect. In your case, the player

  1. If our custom number tag is equal to zero, which it is by default, we then set the timer to countdown from 50 or however many ticks
  2. If it is currently zero, we damage the entity
  3. However, if the timer reaches zero, because this procedure is per tick, it will catch that, so it then resets it back to 50 ticks creating a sort of conditional countdown loop, with it being dependent on if the player has the effect or not

 

I hope this makes sense! There honestly may be way better ways to do this, but I was struggling with the same and found that to work

Last seen on 19:29, 11. Apr 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This seems like alot of work…
Sun, 06/18/2023 - 21:47

This seems like alot of work for a procedure that already works. I did create an on effect active tick, that's what the second procedure was. But I can't use it because of the source entity tag.

 

Your solution probably works but it doesn't even mention the mobs in question which is what my effect is for. It's fine though, I'm pretty sure I figured ito out. I used two and statements. One just specifies if the player has the status effect otherwise it won't be enabled.

Last seen on 19:29, 11. Apr 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I take it back, the solution…
Sun, 06/18/2023 - 22:09

I take it back, the solution I had isn't working.

Last seen on 19:29, 11. Apr 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So the effect even though it…
Sun, 06/18/2023 - 22:26

So the effect even though it's applied, the mob isn't dealing an additional .5 damage. I was letting a zombie hit me and it didn't deal any extra. I chose Mob entity and also tried monster entity because I want any hostile mob to afflict this, what about those tags is wrong?