1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Shooting and Bullet Collision

Discussion in 'Triggers & Scripts' started by Strydhaizer, Jul 19, 2019.

  1. Strydhaizer

    Strydhaizer

    Joined:
    Feb 28, 2013
    Messages:
    1,504
    Resources:
    4
    Models:
    1
    Maps:
    1
    Template:
    2
    Resources:
    4
    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: Aug 7, 2019
  2. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,131
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Seems pretty fine to me.
     
  3. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,049
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Don’t use the unit attacked event, it’s abusable. Instead use a damage detection system that can tell you when attack damage occurrs.
     
  4. Strydhaizer

    Strydhaizer

    Joined:
    Feb 28, 2013
    Messages:
    1,504
    Resources:
    4
    Models:
    1
    Maps:
    1
    Template:
    2
    Resources:
    4
    Im aware that this trigger fires even before unit attacks but do computer units cancel their attacks when they are battle? (Only computer units use this system not the player by the way, and all the attacks are set to instant).
     
  5. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,049
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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.
     
  6. Wrda

    Wrda

    Joined:
    Nov 18, 2012
    Messages:
    1,131
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     
  7. Strydhaizer

    Strydhaizer

    Joined:
    Feb 28, 2013
    Messages:
    1,504
    Resources:
    4
    Models:
    1
    Maps:
    1
    Template:
    2
    Resources:
    4
    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.
     
  8. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,594
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Does not appear to factor in unit collision radius when detecting impacts, only unit origins. One has the use the UnitInRange functions as those factor in collision radius of units.
     
  9. Strydhaizer

    Strydhaizer

    Joined:
    Feb 28, 2013
    Messages:
    1,504
    Resources:
    4
    Models:
    1
    Maps:
    1
    Template:
    2
    Resources:
    4
    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
     
  10. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,594
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     
  11. Ceday

    Ceday

    Joined:
    Feb 22, 2010
    Messages:
    1,080
    Resources:
    0
    Resources:
    0
    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.