How to make a entity do BOTH ranged and melee attacks?

Started by AceEntertainment on

Topic category: Help with modding (Java Edition)

Last seen on 00:31, 28. Sep 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a entity do BOTH ranged and melee attacks?

I am making a boss mob for my mod and I am planning to make it so it can shoot projectiles when the player is far enough (like the wither) and attack normally when its close enough (melee, like a zombie)

I am new to coding so I would prefer if this was done with procedure blocks instead. However, any help provided I will graciously accept :)

Last seen on 18:56, 2. Aug 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not experenced when…
Sun, 07/31/2022 - 04:41

I'm not experenced when procedures but I do know a few coding, however this I am not fimilair with yet.

Last seen on 18:56, 2. Aug 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
for instance, I only know a…
Sun, 07/31/2022 - 04:44

for instance, I only know a few things like how to get mobs to be able to shoot tridents, pick up loot, have an inventory, crossbows, bows, act like vanilla entities, and more. So, if you r interested in these things than I can help you.

Last seen on 18:56, 2. Aug 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
sorry for all the grammar…
Sun, 07/31/2022 - 04:45

sorry for all the grammar. making a mod rn

Last seen on 11:34, 9. Oct 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can give him attack…
Sun, 07/31/2022 - 04:52

You can give him attack damage from the properties section and give him projectiles in the ranged attack in the ai/goals section.

If you remove attack damage then it wont do melee and removing ranged attacks well removes ranged attacks.

It doesn't use procedures. Trust me I made a boss using this as well it yeets cobblestone and can also slam you.

Last seen on 18:56, 2. Aug 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
that sounds interesting, for…
Sun, 07/31/2022 - 04:55

that sounds interesting, for the crossbows and bows thingy, I was referring to like a pillager, you know how they load crossbows, yeah I know how to do that. And for the "pick up loot" that ones pretty easy.

Last seen on 11:34, 9. Oct 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
excuse me mister TOPR you've…
Sun, 07/31/2022 - 04:55

excuse me mister TOPR you've been here for 14 minutes so it's not expected you'll know much either so you don't need to mention that and above that he hasn't asked you specifically so he doesn't need your clarification cause he doesn't need that

Last seen on 11:34, 9. Oct 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also don't think i'm yelling…
Sun, 07/31/2022 - 04:56

also don't think i'm yelling cause thats how the username is spelt

Last seen on 18:56, 2. Aug 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Bruh, I've been "coding" for…
Sun, 07/31/2022 - 05:01

Bruh, I've been "coding" for a decent 1 year now. Even though You didn't say "how to make mobs be able to shoot crossbows and bows" I decided that it'd be good to mention that anyways. I'm just telling you what I know.

Last seen on 18:56, 2. Aug 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and also what made me join…
Sun, 07/31/2022 - 05:02

and also what made me join this site was this comment.

Last seen on 18:56, 2. Aug 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah, I know I need some…
Sun, 07/31/2022 - 05:08

Yeah, I know I need some sleep I got backwards.

Last seen on 18:56, 2. Aug 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
now that I reread this…
Sun, 07/31/2022 - 16:17

now that I reread this comment, I don't think this is possible with custom coding. Like if you want a mob to have a ranged weapon in it's mainhand and be able to use that ranged weapon then that will require some coding, and if you want him to do melee attacks when he has a sword or any item like that in his mainhand, then that'll not require any coding. Only the ranged attack part.

Last seen on 18:52, 13. Jan 2024
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you could probably detect…
Tue, 09/12/2023 - 21:20

you could probably detect when the player is far away using the "is entity in cube of size" block but im not sure how the arrow would work using procedures, because it would have to aim towards the player. if you're making a boss, then maybe shooting 4 arrows in different directions may be good.