1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. 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
  3. 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
  4. 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
  5. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  6. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  7. The results are out! Check them out.
    Dismiss Notice
  8. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  9. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  10. 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.

Attack System v1.1 [vJass | + GUI Support]

Submitted by AGD
This bundle is marked as awaiting update. A staff member has requested changes to it before it can be approved.
CUSTOM ATTACK SYSTEM

A custom attack system that aims to closely mimic the default Warcraft 3 attack system that is more dynamic and

provides full (almost) control over the launched attacks' behavior as well as events for the different phases in the
attacking process




THE SYSTEM CONTAINS:


AttackSystem
(Main)

- Allows you to do more attack-related operations than what is currently provided by Blizzard. It
does this primarily by using custom projectiles instead of the default game attack projectiles
(which are one of the most untouchable - meaning unreadable and non-modifiable, yet significant
things in the game). Unlike the game's default attack system, this one if very dynamic and does
not have much of a hard-coded limit.

Below are some cool things you can easily achieve using this system:

~ Switch a unit from being melee to a ranged attacker in an instant
~ Attach many special effects to ranged attacks
~ Make ranged attacks accelerate/decelerate
~ Destroy ranged attacks while in mid-air
~ Divert attacks to another target
~ Stop ranged attacks from moving (Especially in time-stop spells like Chronosphere, you must
stop projectiles as well!)
~ ... and the list goes on!

The things mentioned above are just the basic things you can achieve with this system. There are
so much more wonderful things that you can do with it. For more information, read the documentation
inside the test map.



EvasionSystem (Add-on library)

- Allows you to dynamically modify the evasion chance of units. Aside from that, you can also set the
accuracy of a unit, and of an attack.



AttackModifier (Add-on library)

- This library ensures the correct behavior when making an attack modifier. Use this for making
things like orb-effects, true-strikes, critical-strike, bash, etc. For more information on why you
should use this library and what are those issues it tries to solve, more documentation can be
found on this library's header inside the test map.



AttackMissileUtils (Add-on library)

- This library provides utility functions for enumerating ranged attacks' missiles with certain constraints.
This can be especially useful in creating spells (like chronosphere), force-fields, etc.



REQUIREMENTS:

JassHelper

Libraries

Optional Libraries



The complete documentation regarding the system can be found inside the map.
Feel free to report bugs and/or leave some feedback.



Version History

v1.0
- First Release

v1.0b
- Added a new add-on library 'AttackModifier'
- Fixed a bug affecting the enabling/disabling of attacks (as well as other bugs)
- Added a new event
EVENT_ATTACK_DESTROY

- Changed some event firing behavior
- Added more function APIs for completeness
- Fixed some documentation errors
- Greatly improved the test map to showcase more of what the system can do
- Other changes

v1.0c
- Added a GUI support
- Added a short demo for the GUI plugin
- Added the function
DestroyEventAttack()

- Fixed a number of bugs
- Other changes

v1.0d
- Not released

v1.0e
- Made compatible for patches 1.29+
- Fixed recursion problems on the GUI plugin
- Added an Evasion event callback handlers for the Evasion add-on lib
- Added a method for manual Attack allocation
- Added a boolean field for enabling an Attack missile's shadow
- Few API changes
- Bux fixes and other changes

v1.1
- Added a new add-on library named 'AttackMissileUtils'
- Fixed the bug regarding manual attack destruction
- Now truly compatible for patches 1.29.x
- Other changes

Previews
Contents

Attack System v1.1 (Map)

Reviews
IcemanBo
It's negliable, but maybe you could just cause 0 damage. In case the unit gets fully healed it stays at 100%, and extra trick removed here: call SetWidgetLife(target, GetWidgetLife(target) - attack.damage + 0.001) /*...
MyPad
Based from the inputs above, it would be safe to say that this should be set to Awaiting Update. Once all issues above are addressed in a sufficient manner or avoided entirely, another review will be released. Status: Awaiting Update
  1. Daffa the Mage

    Daffa the Mage

    Map Moderator

    Joined:
    Jan 30, 2013
    Messages:
    7,731
    Resources:
    28
    Packs:
    1
    Maps:
    8
    Spells:
    17
    Tutorials:
    2
    Resources:
    28
    A custom attack system, this is... ambitious :D
     
  2. AGD

    AGD

    Joined:
    Mar 29, 2016
    Messages:
    399
    Resources:
    13
    Spells:
    7
    Tutorials:
    1
    JASS:
    5
    Resources:
    13
    Indeed :) This is one of my most fragile system so far. One wrong tweak on some parts of the system's code could cause significant bugs in other seemingly unrelated aspect.
     
  3. Hazop

    Hazop

    Joined:
    Jul 2, 2015
    Messages:
    771
    Resources:
    2
    Maps:
    2
    Resources:
    2
    I dont quite get what it does..
     
  4. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    You could use the new natives to replace dummy units by special effects and the GetUnitCollision by the BlzGetUnitCollision native.
     
  5. AGD

    AGD

    Joined:
    Mar 29, 2016
    Messages:
    399
    Resources:
    13
    Spells:
    7
    Tutorials:
    1
    JASS:
    5
    Resources:
    13
    I haven't updated to patch 1.29 yet, because of slow and limited data access :(

    It is an alternative system to handle units' attacks. If you look at the test map, you can see that the footman's ranged attacks have multiple special effects used for its projectile (Something you can't do with the game's default attack system).
     
  6. Ofel

    Ofel

    Joined:
    Mar 29, 2012
    Messages:
    443
    Resources:
    10
    Spells:
    10
    Resources:
    10
    Can be super useful for a new kind of gameplay.

    This makes me wonder if warcraft 3 battle gameplay can include a more realistic rushing, striking, and dodging than just watching every units strike each other with a static position and wait who dies first.
     
  7. AGD

    AGD

    Joined:
    Mar 29, 2016
    Messages:
    399
    Resources:
    13
    Spells:
    7
    Tutorials:
    1
    JASS:
    5
    Resources:
    13
    UPDATED to v1.0b
    - Added a new add-on library 'AttackModifier'
    - Fixed a bug affecting the enabling/disabling of attacks (as well as other bugs)
    - Added a new event
    EVENT_ATTACK_DESTROY

    - Changed some event firing behavior
    - Added more function APIs for completeness
    - Fixed some documentation errors
    - Greatly improved the test map to showcase more of what the system can do
    - Other changes


    Added more testing opportunities in the test map. More explanation and examples in the first post are also added.


    EDIT:
    GUI Plug-in coming soon (maybe).
     
    Last edited: Jul 30, 2018
  8. AGD

    AGD

    Joined:
    Mar 29, 2016
    Messages:
    399
    Resources:
    13
    Spells:
    7
    Tutorials:
    1
    JASS:
    5
    Resources:
    13
    Updated to v1.0c

    - Added a GUI support
    - Added a short demo for the GUI plugin
    - Added the function
    DestroyEventAttack()

    - Fixed a number of bugs
    - Other changes
     
  9. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,324
    Resources:
    7
    Models:
    1
    Icons:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    7

    Notes:


    • (Potential bug) In the Evasion System, even if you were to set evasion up a notch, it might still affect the unit. Experienced with buildings. Is this intentional?
    • When pausing the game, a unit whose attack is disabled will have the attack ability display a green icon. (Workaround is to export the disabled icon and treat it as an active icon.)

    Nitpicks:


    • This takes up a bit more of resource than the internal attack system, and with more units, the performance drops quite a lot (nigh exponential). (Perhaps your MasterTimer library can come into play or Nes' Timer library)

      (Tested with the following specifications:
      Intel(R) Celeron(R) CPU N2840 @2.16 GHz
      2.00 GB RAM (1.88 GB usable)
      64 - bit Operating System, x64-based processor.
      Intel HD - Graphics

      Test Conditions:
      Google Chrome running in the background.
      File Explorer, Calculator, Control Panel, and World Editor and its' modules running.
      )

    Status:


    • Awaiting Update
     
  10. AGD

    AGD

    Joined:
    Mar 29, 2016
    Messages:
    399
    Resources:
    13
    Spells:
    7
    Tutorials:
    1
    JASS:
    5
    Resources:
    13
    You mean even with something like
    call SetUnitEvasion(target, 2.00)
    , the target still has a chance of getting hit? Haven't tested it with buildings indeed so I'm gonna check it out.

    Right. Will be fixed next update.

    A major contributor to this might be the spamming of units for every ranged attack's missile (2 dummies per missile in fact). I hope I can update to 1.29+ soon to get rid of the need for dummies. As for using timer systems I'll just try to optimize my internal timer usage instead.
     
  11. MyPad

    MyPad

    Spell Reviewer

    Joined:
    May 9, 2014
    Messages:
    1,324
    Resources:
    7
    Models:
    1
    Icons:
    2
    Spells:
    3
    JASS:
    1
    Resources:
    7
    Ouch. That's going to be very painful to process, with my test having 50 footmen attackers, and with 2 missiles, that means 4 dummy units per footman. Multiply that by 50, and the map is dead, on my pc, that is.
     
  12. AGD

    AGD

    Joined:
    Mar 29, 2016
    Messages:
    399
    Resources:
    13
    Spells:
    7
    Tutorials:
    1
    JASS:
    5
    Resources:
    13
    Updated to v1.0e
    - Made compatible for patches 1.29+
    - Fixed recursion problems on the GUI plugin
    - Added an Evasion event callback handlers for the Evasion add-on lib
    - Added a method for manual Attack allocation
    - Added a boolean field for enabling an Attack missile's shadow
    - Few API changes
    - Bux fixes and other changes
     
  13. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,183
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    @AGD, I'm on patch 1.29.2, and get syntax error, because a function
    BlzGetUnitZ
    is used which I don't have.
    1.29 introduced
    native BlzGetLocalUnitZ takes unit whichUnit returns real
    . I can't seem to find your used function inside patch notes.
     
  14. AGD

    AGD

    Joined:
    Mar 29, 2016
    Messages:
    399
    Resources:
    13
    Spells:
    7
    Tutorials:
    1
    JASS:
    5
    Resources:
    13
    Noted. I will use the other native next update.

    EDIT: Manual attack destruction is currently bugged btw.
     
    Last edited: Aug 28, 2018
  15. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,058
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    Man this looks cool AF. I will check this out soon and see what kind of crazy stuff you've added.

    I dig the use of the new natives. I've barely seen any resources using them.

    One thing I recommend is to split the projectile resource into its own library. I might, for example, not want to overhaul the entire attack engine of the game and prefer to use just custom projectiles.
     
  16. AGD

    AGD

    Joined:
    Mar 29, 2016
    Messages:
    399
    Resources:
    13
    Spells:
    7
    Tutorials:
    1
    JASS:
    5
    Resources:
    13
    Updated to v1.1
    - Added a new add-on library named 'AttackMissileUtils'
    - Fixed the bug regarding manual attack destruction
    - Now truly compatible for patches 1.29.x
    - Other changes

    Thanks. I used BPower's Missile lib at the beginning, but it doesn't support arcing movements for homing missiles and then there also comes the natives from the new patch which rendered the dummy method obsolete so I was forced to write an internal one. I wonder if there's any chance @BPower 's gonna update his lib.. would be nice =). If not, I'm not sure I can write a full projectile system.
     
    Last edited: Aug 28, 2018
  17. Bribe

    Bribe

    Joined:
    Sep 26, 2009
    Messages:
    8,058
    Resources:
    25
    Maps:
    3
    Spells:
    10
    Tutorials:
    3
    JASS:
    9
    Resources:
    25
    If I was able to write Table, which was also mostly a spin-off at the beginning, then you can spin off your own projectile handler.

    What you could consider doing is trying to imitate BPower's API, which would give it the same syntax (thus easier to integrate for users already on his missile system).

    Btw, I have tested it on my Mac and have the following feedback:

    Blood Mage attack cooldown interacts weirdly with its animation. You'll need to figure out how to make that work, as currently the timing is quite off (what Nestharus does is use a 0 damage, super fast projectile to detect when the launch should occur. You should try it)

    Also the re-targeting is awful. I issue an Attack or Smart order and the BM takes almost a second or two to get the hint. Your engine should intrinsically know his attack cooldown is ready and that the missile should launch at the same time.

    For the demo, you should implement a barrier-type thing which showcases how the attack projectiles work.

    Lastly, maybe give the BloodMage a melee attack without the orbs, to show off that it can switch seamlessly as you put it.
     
  18. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,183
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    It's negliable, but maybe you could just cause 0 damage. In case the unit gets fully healed it stays at 100%, and extra trick removed here:
    Code (vJASS):

                call SetWidgetLife(target, GetWidgetLife(target) - attack.damage + 0.001)
                /*
                *   If the damage is negative, it's still needed to deal damage to the target to maintain the desired
                *   behavior of an attacked target (ex: units with 'build' ability should retreat from the attacker)
                */

                call UnitDamageTarget(u, target, 0.001, true, ranged, attack.attacktype, attack.damagetype, attack.weapontype)

    Is there a a way to know if the dummy dealt damage in
    function DealDamage
    , or the original source unit did it? I'm not sure if it would be useful for user, like operating at an event with unit type of the source, which would not exist anymore. Maybe UnitTypeId information makes sense, too, to save as member of source attacker? - the user could still check for source's GetUnitTypeId if needed, I guess, to check if he needs to read it.

    Even if a widget is targeted, maybe targetX/Y could be assigned to widgetX/Y then, instead of 0? (still a value, but wrong value) But sure user could read it out of widget natives.

    imo
    Table(KEY).
    could be
    table = KEY
    ->
    table.
    but yeh haha..^^

    attackOrderType
    could be a struct for tiny bit more readability. (in sense of an enum)

    'ncop'
    could be on top config

    Demo doesn't work for me... after some gooood time testing I found out it's not your system's fault, but because the a filter does return wrong result..:
    Code (vJASS):

        private function TargetUnitFilter takes unit attacker, unit target returns boolean
            return attacker != target                                                                   and/*
                */
    UnitAlive(target)                                                                    and/*
                */
    GetUnitAbilityLevel(target, 'Aloc') == 0                                             and/*
                */
    (IsUnitVisible(target, GetOwningPlayer(attacker)) or GetUnitTypeId(attacker) == 0)   and/*
                */
    not IsUnitType(target, UNIT_TYPE_ETHEREAL)                                           and/*
                */
    not BlzIsUnitInvulnerable(target)
           
        endfunction


    BlzIsUnitInvulnerable
    works very wrong, and no attack was properly launched, and always canceled at some point -- auto acquire didn't work, too. With removing the invulnerable check, all seems to work, and demo is running, too. In patch notes 1.30 I then found "[World Editor] BlzIsUnitInvulnerable returns the correct boolean value" . :( I guess no problem ultimately for you, but it's not 1.29 compatible with it. (will personally patch soon anyways, after fixes)

    A last remark, or just note.. but not sure myself how to handle it the best. When a unit teleports away ,for example, then the projectile follows to the target's new position, and it might look some ugly because the projectile might abruptly turn, change the curve looks, and change speed in extreme. Not sure if users should be notified about such extreme position changes, being able to cancel the peojectile flight, or what ever.. but yeh, maybe you had some thought about it already. Just as note.

    I must say it's a very impressive piece of code you made there. Very clean, nicely structured, not unnecessarily complex. All at once is a bit big to read, but anyways good. :thumbs_up: Maybe the one or other comment could be added to ease the read even a bit more. A very definite 5/5 , keep doing!
     
  19. AGD

    AGD

    Joined:
    Mar 29, 2016
    Messages:
    399
    Resources:
    13
    Spells:
    7
    Tutorials:
    1
    JASS:
    5
    Resources:
    13
    I might do this but it will be only after the other basic features are already stable.

    I think this is because of the dummy ability I used which is based off channel. I tested it and for some reason, even if you set both the casting time of the channel ability and the unit to 0, the spell will still have a short casting time. Anyway, I'll check that technique using attack with 0 damage.

    Will add

    One can know if the damage source is the dummy by checking if
    GetUnitTypeId(attack.source) == 0
    is true. However, there is currently no way of knowing the unitId of the removed unit source. I'll add it as I also think it's necessary.

    The targetX/Y is intended for storing values of the target point when attacking a point. Before reaching to the target point, the unit may auto-acquire enemy targets on its way and therefore by doing that, it would overwrite the targetX/Y values and the users will no longer have access to the original target point.

    The speed of the missile will not be affected by teleport but it does abruptly change its height and orientation though. The sudden change in orientation of fine I guess but the sudden change in height is really a problem.. Thanks for pointing this out. Will find a way for this.

    Thanks for the input guys :)