Custom Entity Attack range is too big

Started by StellaeLux on

Topic category: Help with MCreator software

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom Entity Attack range is too big
Sun, 10/06/2019 - 08:24 (edited)

So I created a custom Spider:

Mob model: Spider, AI base none.

Task list:

1. Attack targets, call for help check.

2. Attack on melee with speed factor 1.2 chase after lost sight check.

3. Attack in sigh only (check) nearby only of type entity player.

4. Leap at target...

5. Wander around, speed factor 1

6. watch closes entity radius 10 entity player

7. look around

8. swim in water.

1 being the highest priority.

However, strangely enough, whenever the spider attacks, it hits the player way before the spider is even close to the player. I tried setting the width/heigh to a lower value than the starting value 1.4, but whenever I save it to test that out it jumps back to 1.4.

Is there anyway to make the spider attack hitbox more fitting of the spider model?

Edited by StellaeLux on Sun, 10/06/2019 - 08:24
Last seen on 23:50, 27. Mar 2024
Joined Dec 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think it's caused because…
Tue, 08/27/2019 - 11:37

I think it's caused because the Attack on melee has a higher priority than the "basic AI" (wander, look around and swim in water). The basic AI has to be above the attack AI. This is always a must, but if that's not working then idk.

Last seen on 17:18, 11. Feb 2020
Joined Mar 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't must be at the top…
Tue, 08/27/2019 - 12:50

I don't must be at the top.... 

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nope, for me its still the…
Tue, 08/27/2019 - 17:05

Nope, for me its still the mega hitbox. Putting procedures of attack below basic also causes the mobs to sometimes stop chasing for a moment.

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
After over a month and…
Sat, 10/05/2019 - 18:43

After over a month and knowing more about the application stumbling upon this issue again, i figured out what caused it:

When setting entity model bounding box "Width/Depth, Height, Shadowside" changing With/Depth causes the hitbox to scale with it as well.

If you scale it to a value like 3, then the attack hit box will be way up front of the creature completely dis-attached from the model.

Is this fixable for a future update?

bounding box = hitbox I…
Sat, 10/05/2019 - 21:17

bounding box = hitbox

I suggest you to enable hitboxes debug mode in Minecraft to show hitboxes when testing custom mobs.

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I used fn + f3 + B to enable…
Sun, 10/06/2019 - 07:17

I used fn + f3 + B to enable the hitbox mode. What happens at a normal bounding box size is:

There's a distance between the player and the entity's attack box. This allows one to safely hit zombies without the zombies being able to hit back. However, when scaling the bounding box up (causing it to extend let's say 1 block forward, the attack box will extend even beyond that amount, causing the player to be unable to hit the entity.

The creature I have is about 3-4 blocks long, and the current bounding box doesn't even surpasses his head yet, yet the attack range has extended well beyond the actual create as a result of scaling this box.

The problem I think is that the attack box scales disproportionally to the scaling of the bounding box turning:

(Player has 0.5 blocks to safely hit the creature) to (Creature has 2 blocks before the Player can even attack back).

I will look into this, but…
Sun, 10/06/2019 - 08:14

I will look into this, but from this topic I found this: https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/modification-development/2419826-help-needed-bounding-box-hitbox-misaligned

That is weird. The bounding box (used for pathfinding) and hitbox should be the same, and the F3+B should show it accurately. I created a giant entity in 1.8 you can compare your code with mine here: https://github.com/jabelar/MagicBeans-1.8fixed/blob/master/src/main/java/com/blogspot/jabelarminecraft/magicbeans/entities/EntityGiant.java

 

It may be possible that your size is too big, maybe there is some max. Did you try intermediate values? I'm using 4.5F for height in my giant.

I did find that the box is limited to 4.5

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks. Here is some video…
Sun, 10/06/2019 - 08:52

Thanks. Here is some video footage displaying the problem more clearly:

https://www.youtube.com/watch?v=mxYAua5vwGs&feature=youtu.be

The animals are duplicates of each other. The only difference between the 2 are their bounding box settings. I made their name show their bounding box.

This is very strange, as we…
Sun, 10/06/2019 - 09:35

This is very strange, as we set both hitbox and bounding box to the values entered in the UI and the bounding box shown in the debug mode should reflect actual collision box as far as I know. I will google a bit, it might even be a bug in a third party code.

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried some testing around:…
Sun, 10/06/2019 - 10:59

I tried some testing around:

https://pasteboard.co/IAHItGC.png

In this image, the pink wool represents how far the animal an hit me from their cage. Animal with bounding box 3 hits 3 far. Bounding box 5 hits 5 far, bounding box 10 hits (10 far presumably but after the range gets too big the animal loses interest in attacking.)

Additionally, when you use "on player collision", it will get the bounding box correctly, even for the giant sizes Only when you're in the visible fn+f3+b box will this procedure be triggered.

So when it comes to the bounding box, its almost as if the entire bounding box inverts to where the creature is attacking/facing, making it not that noticable when the bounding box is 0.6, but if they have a bounding box of 10, they will also have a range of 10 (to each side?) as if surrounded by a bounding/attack box of 30 by 30 in length and width.

---

Even though On Player Collision always trigger instead of only when the entity is attacking you it appears, the the On Player Collision does work perfectly with any size of bounding box, so dealing damage to the player that way could perhaps work as a possible work around but I'll have to look at how exactly to do that.

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So unlike as suggested in…
Sun, 10/06/2019 - 11:05

So unlike as suggested in the post, it's not a problem with surpassing a specific value. The problem is that the attack range somehow manages to be exactly the width&length of the bounding box.

So it might somehow invert the bounding box for attacking towards the player or somewhere scaling it up by 3.

So weird xD

Possibly downscaling the bounding box (for attacking only) by boundingbox length/3 could solve this issue.

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
"Possibly downscaling the…
Sun, 10/06/2019 - 11:09

"Possibly downscaling the bounding box (for attacking only) by boundingbox length/3 could solve this issue."

EDIT: Or only downscaling it and then adding a new parameter "Attack range" that does length/3 + attack range. The typical attack range would be 0.6 as that is the standard value when creating the living entity mod element.

I will look into options,…
Sun, 10/06/2019 - 12:48

I will look into options, the solution with dividing values like this sounds a bit too hacky, there must be a proper way.

Last seen on 19:04, 10. Jul 2020
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I know this is a year old…
Mon, 07/06/2020 - 10:25

I know this is a year old but did you ever find a solution