Jump to content

1.12 How do I make my entity or item breathe fire?


TheRPGAdventurer

Recommended Posts

One of the dumbest ways might be checking if there are entities in front of the attacker, and deal damage to these entities, while spawning fire particles. The tricky thing might be making the particles flow in the correct direction, because you will have to use trigonometry for that.

  • Like 1
Link to comment
Share on other sites

5 hours ago, Alexiy said:

One of the dumbest ways might be checking if there are entities in front of the attacker, and deal damage to these entities, while spawning fire particles. The tricky thing might be making the particles flow in the correct direction, because you will have to use trigonometry for that.

Basically this is the most efficient way for the computer. The only difficulty is that you'll hit people who aren't in line of sight, but even this could technically be fixed by  doing raytracing between the entity and whoever is getting hit. . You can figure out where a mob's mouth is using maths. Then spawn a bunch of particles and hurt people in a cone in front of it.

 

The second, much easier but much convoluted and CPU-intensive  way is to make projectiles shoot from the mob's mouth in a spray. This would also make sure that the 'fire' is stopped by walls. Make a big, square invisible projectile and simply force it to spawn a ton of fire/different particles behind it. Then make it set on fire and deal fire damage on hit. 

 

You can look at the EntitySmallFireball for hints on how to spawn particles and whatnot. 

Edited by oldcheese
Link to comment
Share on other sites

1 hour ago, KittenKoder said:

I would use the arrow logic, as if it was an arrow fired from a bow, but use tiny fires instead of arrows. So I would recommend looking into how the bow and arrows work.

 

It's more usefull to look into the ghast, in this case.  Since the ghast launches a projectile as part of it's AI already. 

 

Either way. I'd strongly advise using raytracing and particles rather than firing a ton of tiny arrows. Or at the very least fire a few arrows instead of one for each particle.  Unless it's only used sparsely. Otherwise having 10-20 of these fire monsters would shoot 100 entities every attack.

Link to comment
Share on other sites

1 minute ago, oldcheese said:

 

It's more usefull to look into the ghast, in this case.  Since the ghast launches a projectile as part of it's AI already. 

 

Either way. I'd strongly advise using raytracing and particles rather than firing a ton of tiny arrows. Or at the very least fire a few arrows instead of one for each particle.  Unless it's only used sparsely. Otherwise having 10-20 of these fire monsters would shoot 100 entities every attack.

I was talking about using it for the physics logic as it makes sense that there would be a falloff point, unlike the ghast fireballs. It would also need to be dodgeable, would it not? You won't be able to avoid spawning in more entities with something like this, limiting the number of mobs which use it that spawn in at any given point would be a better choice anyway. Another place to check would be Mekanism's flame thrower for the best example of the mechanisms involved.

 

Mekanism has issues, but the flamethrower worked well and used a "spawning in a bunch of entities" method. 

  • Like 1
Link to comment
Share on other sites

23 minutes ago, KittenKoder said:

I was talking about using it for the physics logic as it makes sense that there would be a falloff point

 

Yeah, that's the only thing you can't do with the raytrace method, dodging.  I guess it depends on what the player wants. Either way, you raise some fair points.

 

Also, does the bow actually do less damage when you hit from afar? I thought it based it on the charge time.

 

It'd be a lot easier to just implement the ticksexisted time and then base damage on the reverse of that.   I imagine you woudln't want gravity for a flamethrower, or even reverse the gravity, then setDead() if ticks existed goes too high.

Edited by oldcheese
  • Like 1
Link to comment
Share on other sites

6 minutes ago, oldcheese said:

 

Also, does the bow actually do less damage when you hit from afar? I thought it based it on the charge time.

 

I don't think it does, but it would be easy to add such a thing. Since the entity has to tick anyway, just add some modifier to the damage that ticks with it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.