help with deal damage to entity

Started by AetherDarkosZak on

Topic category: Help with modding (Java Edition)

Last seen on 22:58, 13. Aug 2021
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
help with deal damage to entity

So I am new using Mcreator and I was trying to learn as much as possible by myself.

I was trying to create a weapon with a chance of hitting more damage.

I created variables(numbers) to give more damage or more chance if some condition happen 

I only have problems when I use the "Deal damage to entity" procedure, when I put in the amount of damage a variable sometimes I hit an absurd amount of damage. But when I put a normal number like "10" it functions as intended. Is it impossible to do this with variables? or I am doing something wrong. Also I saw in the code that by default the "deal damage to entity" procedure expects a "float"  but my variable is a "double".

Last seen on 16:18, 11. Feb 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What are your random numbers…
Thu, 08/12/2021 - 01:47

What are your random numbers? (What are the Max and Min values?)

Last seen on 05:45, 20. Mar 2024
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hi  
Thu, 08/12/2021 - 02:01

hi

 

Last seen on 22:58, 13. Aug 2021
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Zachmine I was using this…
Thu, 08/12/2021 - 02:24

Zachmine I was using this for tests:

If Random [0,1) < 0.5

 

But my idea was to use something like this:

Set Global: Chance to: 0,18

If Random [0,1)< Get Global: Chance

Last seen on 16:18, 11. Feb 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try adding the procedure…
Thu, 08/12/2021 - 02:28

Try adding the procedure with the "send message to chat" and announce the Chance value whenever the "Deal damage to entity" procedure block is called.

Last seen on 22:58, 13. Aug 2021
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think that the chance…
Thu, 08/12/2021 - 02:43

I think that the chance works but my problem was that when using variables in the deal damage procedure it works randomly. Sometimes it just not works or do a lot of damage(1 shot a whiter boss)

Last seen on 16:18, 11. Feb 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is another way to use…
Thu, 08/12/2021 - 02:48

There is another way to use a random value: "if Random = Number, damage entity by 6." And repeat for every random damage number that you want:
"if Random = 1, damage entity by 6."
"if Random = 2, damage entity by 7."
"if Random = 3, damage entity by 8."
 It might be tedious, but it will certainly work.

Last seen on 22:58, 13. Aug 2021
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also, is there any easy way…
Thu, 08/12/2021 - 02:50

Also, is there any easy way to see the the damage I deal to a mob ? I was testing with the send message and get health of entity procedures

Last seen on 22:58, 13. Aug 2021
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So here is my code. If…
Thu, 08/12/2021 - 03:04

So here is my code. If someone can explain to me what is wrong I will be greetly appreciated.

 

https://imgur.com/a/5ZvjOMj

 

Also, sorry for my english

Last seen on 16:18, 11. Feb 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Your English is pretty good…
Thu, 08/12/2021 - 03:37

Your English is pretty good by the way!
I cannot see anything wrong with the procedure immediately.
Maybe you can brute force the number to something reasonable by dividing the aditionaldamage by 10.

Last seen on 22:58, 13. Aug 2021
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks! I did a test and…
Thu, 08/12/2021 - 04:00

Thanks!

I did a test and this is my results.

https://imgur.com/a/ePYlULu

I think that the problem is the deal damage procedure but i dont know a way to make it work as intended

Last seen on 16:18, 11. Feb 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You multiplied the Value by…
Thu, 08/12/2021 - 04:07

You multiplied the Value by 10, and divided it by 10, effectively not changing your procedure at all.
:shrug:

Remove the " * 10" and it should be good.
Keep the " / 10"

Last seen on 22:58, 13. Aug 2021
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I would like to tell you…
Thu, 08/12/2021 - 04:45

I would like to tell you that it work but it just keep dealing 6.5 damage. However when I multiplied the value by 100 the damage was about 120 so I will be testing more tomorrow

Last seen on 16:18, 11. Feb 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Alright, cya for now! If you…
Thu, 08/12/2021 - 04:58

Alright, cya for now!
If you do want to keep talking with me about this tomorrow, I urge you to contact me through Discord (since there is a lot of back and forth here).
The Discord server link on my account bio should allow you get my contact my directly.
Now, if you don't have Discord/don't want to talk about this tomorrow, that's alright.