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

Change attack range with items

Status
Not open for further replies.
Level 18
Joined
Nov 21, 2012
Messages
835
What I am trying to achieve:
hero (for example Paladin) - depending on item - can attack in 100 range(melee) ground targets; or 500range (ground and air targets).
Items like Hammer, Sword - enable melee ground attack (can't attack air)
Items like Shotgun, Bow - enable ranged attack (ground and air targets can be attacked from 500 distance)
I wanted to use attack1 and attack2 in OE, something silimar to orbs - but unfortunatelly normal orb enables attack2 so Paladin can attack air units from distance, but ground units as melee (which I do not want).

If you guys have ideas how to do that, please share. I prefer not to re-code whole warcraft3 attacks.
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
So you actually want to change attack indices?
Looking at your system (Switch Attack) it seems the limiation is the attack UI, so I guess it cannot be fixed by simply enabling/disabling the attack indinces.
Unit morphs is the first thing that comes to my mind, but they often cause a lot of trouble in warcraft 3.

I tried it in the test map and it even works with applied buffs, but there is a problem with the armor rating.
 

Attachments

  • attackmorph.w3x
    17.2 KB · Views: 98

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
Not possible to dynamically change attack range. One has to change the unit type to change the attack range, or permanently (cannot be reversed!) upgrade attack range with an upgrade.

If going a unit type change approach then the best known morph method is to use triggers to add a morph ability like druid of talon bird form where the base type is the desired unit type and morph type does not matter. Or at least that is what I have read a few times.
 
Level 11
Joined
Jun 2, 2004
Messages
849
I was able to successfully have a single unit type be able to switch between a ranged and melee attack, but it required using an orb ability to enable attack 2 and a silence debuff to disable attack 1. Simply enabling attack 2 didn't work since they'd doggedly use their melee attack even though the ranged one could attack ground units.

So yes, you can accomplish what you want with a modified Silence. It has nice fields for disabling ranged, melee, etc. You'll have to deal with the unavoidable buff icon, the possibility of it being dispelled, and the fact it won't stack with other forms of silence, though. It worked fine in my map since I used it in rather controlled conditions, though it might not be good enough for something like an ORPG.
 
Last edited:
There is two methods I know of that work with latest patch to dynamically change attack range of the basic combat system, web/ensnare or a lot of trigger work with changing attack into abilities and moving the unit every so often to until in range for attacking while having max/high map range since without web/ensnare currently you can't change it in-game without new units.

Two disadvantages to the web/ensnare method is currently you are forced to become a turret aka stay still while attacking and the buff is forced to show. I haven't finished fixing the other disadvantage which is requiring melee attack type while the trigger method is rather difficult too however currently far easier then web/ensnare method.

Changing Attack Range in-game
 
Level 18
Joined
Nov 21, 2012
Messages
835
Looking at your system (Switch Attack) it seems the limiation is the attack UI
exactly
Not possible to dynamically change attack range
I just need only 2 values: 100 or 500. I have to try morph you suggesting.
So yes, you can accomplish what you want with a modified Silence
I can do the same with my Swich Attack snippet. But did you try your method on heroes? No problem with UI showing attack icon + values in game?
@Dat-C3 I remember your nice find with web. Its cool if user wants to turn melee-unit into a tower-like unit with ranged attack.
changing attack into abilities and moving the unit every so often to until in range
to much coding for such a simple request I guess.

edit
@Jampion Chaos ability doubles attack damage, add as permanent - green armor bonuses, also adds life/mana bonus from item, it's to bugged for use..
 
Last edited:
Level 11
Joined
Jun 2, 2004
Messages
849
But did you try your method on heroes? No problem with UI showing attack icon + values in game?
Oh yeah, there's that too. Yeah I have that problem with my system but I didn't think too much of it, since it was for a Castle Fight type map and not something players directly control.

I'd probably move over to using two unit types if I wanted to fix that.
 
Status
Not open for further replies.
Top