• 🏆 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!

[Trigger] Shooting and Bullet Collision

Status
Not open for further replies.
Hello, I would like to ask/consult to you guys (who knows alot in spells/triggers) if this spell is actually MUI or just for single unit? I tried it, it works for multiple units, but I am not sure if it actually works properly or there might be something wrong that doesn't appear or not obvious during ingame testing.


Updated

Now I know I shouldn't use waits but it is only computer units who will use this system and computer AI doesn't seem to cancel their attacks therefore waits shouldn't be a problem (I guess?). I had to delay the spawn to fit with the casters animation.

Please temporarily ignore the leak at the ShootEnemy_Angle, I'm aware of that. :)

Edit: Triggers removed.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,013
Not that I am aware of, but someone with more AI knowledge might be able to prove me wrong. Regardless of computers not cancelling attacks, for units with projectiles it can look even more wonky because it happens before their projectile even fires.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
There's no point of doing units with projectiles if you're using a missile system though. I didn't even mention the attacked event because it seemed a concious decision. What bothers me is the fact the bullet actually spawns in the rifleman's head, which is completly weird. Might as well change the location of its creation.
 
Units don't make projectiles, I set the their attacks stats to instant with zero damage without projectile set, and I made a missile dummy that flies so I can control the height of the projectile. I modified it now and the dummy should now spawn at the front of the caster (100 offset). I think the only thing that should bother is that it doesn't detect terrain heights so the projectile line are usually distorted at distorted/bumpy terrains.
 
One has the use the UnitInRange functions as those factor in collision radius of units.

Translate please?

Isn't this part already doing that?

  • Unit Group - Pick every unit in (Units within ShootEnemy_DetectAOE of ShootEnemy_TempLoc) and do (Actions)
    • Loop - Actions
      • Set ShootEnemy_TempUnit = (Picked unit)
      • Set ShootEnemy_TempUnitLoc = (Position of (Picked unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (ShootEnemy_TempUnit is alive) Equal to True
              • (ShootEnemy_TempUnit belongs to an enemy of (Owner of ShootEnemy_Dummy[ShootEnemy_CurrentIndex])) Equal to True
        • Then - Actions
          • Unit - Kill ShootEnemy_Dummy[ShootEnemy_CurrentIndex]
          • Unit - Cause ShootEnemy_Caster[ShootEnemy_CurrentIndex] to damage ShootEnemy_TempUnit, dealing ShootEnemy_Damage damage of attack type Spells and damage type Normal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Unit-type of (Picked unit)) is Mechanical) Equal to False
              • ((Unit-type of (Picked unit)) is A structure) Equal to False
              • ((Unit-type of (Picked unit)) is A flying unit) Equal to False
            • Then - Actions
              • Special Effect - Create a special effect at ShootEnemy_TempUnitLoc using war3mapImported\SmallBloodEX.mdx
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Do nothing
        • Else - Actions
          • Do nothing
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Isn't this part already doing that?
No it is not factoring in unit collision radius. The function Units within ShootEnemy_DetectAOE of ShootEnemy_TempLoc only accounts for unit origin and not their collision radius. One must enumerate all units in a circle of radius {AoE + maximum collision radius} and then filter using the UnitInRange functions.

This is required for correct AoE hit detection logic that mimics standard Warcraft III mechanics. As an example take the standard Blizzard ability of the Human Archmage. A very big unit such as the Tavern Pitlord can be standing outside the AoE circle of Blizzard but as long as any part of his collision circle intersects with the Blizzard AoE circle then he will take damage from Blizzard. If one tried to emulate this by just using Units within ShootEnemy_DetectAOE of ShootEnemy_TempLoc then the Pitlord will not be hit in this case since his origin is outside of the Blizzard AoE circle and so the Pitlord will not be a member of the returned unit group.

This is not just limited to standard Warcraft III abilities. Splash attacks also factor in unit collision radius.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
One must enumerate all units in a circle of radius {AoE + maximum collision radius} and then filter using the UnitInRange functions.
Too bad there is not an enum native for this already, its like performing same operations twice (first enum by range, then InRange check again) just to filter out some units at the edge.
 
Status
Not open for further replies.
Top