• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Rect Barrier with Hp

Status
Not open for further replies.
Level 7
Joined
Feb 9, 2021
Messages
301
I am making a barrier system, which summons a barrier, which blocks missiles. If missile damage > barrier, then missile goes through, but its damage is reduced by barrier's hp. The barrier can be damaged by auto-attacks and AOE spells as well. It is impossible for units to go through a barrier.

My questions are:
1. How to make it dynamically that units can't go through the barrier? Since barrier's length can vary, I need different numbers of path blockers every time.
2. How to make that barrier receives damage from AOE, which is only in its rect? The problem is illustrated on a screenshot I attached.
3. I want to make a barrier as an effect. How do I make it that it is possible to attack it? (Unit without a model, which can be selected)

Would appreciate any help. I code in vJass

Edit: One of the ideas I have is to make a barrier of multiple invisible dummy units (determine the number of dummies by calculating length of the barrier/pathing of the dummy). And then have the main unit (barrier in the center). This solves problems 1 and 3. In terms of problem 2, I need to transfer all the damage from these units to the main one. The problem here is how to avoid double counting? Just checking whether dummy 1 and dummy 2 receives the same damage from the same source might not do it because some aoe spells are gradual (eg. they increase their aoe of dmg overtime). So, if another aoe hits and rewrites the memory the last damage and owner, it creates bugs.

Maybe someone has ideas on this? Or more optimal ideas, since creating and deleting so many units every time is heavy (and I can't use dummy recycling for this).
 

Attachments

  • 1647358552123.png
    1647358552123.png
    47.6 KB · Views: 20
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
I would try something like this:

- have the barrier be one unit, who has the proper size, but no collision (I forget what the proper setting is to make units be able to walk through you, maybe collision, maybe ghost ability.... you can look it up). this way it will be selectable, attackable and take damage from AOE.

- make it block other units from entering by using knockback.

the main problem you would have with this is that it might not be possible to target the units "inside" the barrier while this is on... would have to play around with that to see... not sure if there is some way to set priority for units with overlapping models. maybe just by making sure it is lower down.
 
Level 7
Joined
Feb 9, 2021
Messages
301
I would try something like this:

- have the barrier be one unit, who has the proper size, but no collision (I forget what the proper setting is to make units be able to walk through you, maybe collision, maybe ghost ability.... you can look it up). this way it will be selectable, attackable and take damage from AOE.

- make it block other units from entering by using knockback.

the main problem you would have with this is that it might not be possible to target the units "inside" the barrier while this is on... would have to play around with that to see... not sure if there is some way to set priority for units with overlapping models. maybe just by making sure it is lower down.
Doesn't your solution encounter the same problem? The barrier has a rect form and the unit's selection is in radius. So, the barrier will be selected even if aoe does not touch the barrier. (as on the screen)
 
Status
Not open for further replies.
Top