Problems of switching ranged to melee mode.

I was creating a custom hero that can switch from ranged to melee mode or melee to ranged mode, when I clicked on the melee mode, it has a ranged melee attack but no damage. Is there any solution?

The Trigger:
Raiden Captain Ranged to Melee Attempt.png

The Video:
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Nothing about your triggers will affect the Melee/Ranged status of a unit. All you're doing is Adding/Removing some unrelated abilities.

You can determine whether a unit is Melee or Ranged in the Object Editor by changing it's Combat settings:
1741605523440.png


For example, Demon Hunter is melee, but after using Metamorphosis he transforms into an entirely new unit that uses a Ranged attack. You could do this with your Hero as well.

Also, assuming you're on 1.31+, you can try to modify the Weapon using this Action but I recall it being buggy or at least needing extra steps:
  • Actions
    • Unit - Set Unit: (Triggering unit)'s Weapon Boolean Field: Attacks Enabled ('uaen')at Index:0 to Value: False
    • Unit - Set Unit: (Triggering unit)'s Weapon Boolean Field: Attacks Enabled ('uaen')at Index:1 to Value: True
 
Last edited:
Nothing about your triggers will affect the Melee/Ranged status of a unit. All you're doing is Adding/Removing some unrelated abilities.

You can determine whether a unit is Melee or Ranged in the Object Editor by changing it's Combat settings:
View attachment 516841

For example, Demon Hunter is melee, but after using Metamorphosis he transforms into an entirely new unit that uses a Ranged attack. You could do this with your Hero as well.

Also, assuming you're on 1.31+, you can try to modify the Weapon using this Action but I recall it being buggy or at least needing extra steps:
  • Actions
    • Unit - Set Unit: (Triggering unit)'s Weapon Boolean Field: Attacks Enabled ('uaen')at Index:0 to Value: False
    • Unit - Set Unit: (Triggering unit)'s Weapon Boolean Field: Attacks Enabled ('uaen')at Index:1 to Value: True
Even abilities have changed?
 

Rheiko

Spell Reviewer
Level 26
Joined
Aug 27, 2013
Messages
4,214
Even abilities have changed?
Yes, you only removed and added the abilities in the trigger. You didn't do anything to transform that unit in your trigger. You need to actually transform the unit into a different unit that has different attack range and weapon type, take metamorphosis as example.

I don't know what you base your Melee/Range Mode ability on. But if they're something like Bear/Crow form then you need to modify the unit's object data like uncle suggested.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Here's a way to do it on the latest patch without needing to use a Morph ability.

It's a little tricky and has the downside that the Hero Skill menu will always show the default hero abilities.

Note that this Action is buggy:
  • Unit - Set Unit: (Triggering unit)'s Weapon Real Field: Attack Range ('ua1m')at Index:0 to Value: 600.00
To get it working I had to change the Demon Hunter's "Attack 2 - Range" to 0.00, otherwise, that seemed to interfere with the "Attack 1" values.
 

Attachments

  • Switch Stances 1.w3m
    20.8 KB · Views: 2
Top