• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

making a melee and range unit

Status
Not open for further replies.
Level 1
Joined
Jun 19, 2008
Messages
5
Im trying to make a map that has new races to play as and improve the normal races in the game (normal like gaming map) and im trying to make the skeleton fire warrior guy be able to attack with his sword when its target is in close enough range and throw fireballs when his target is far away.

please help
P.S. this is my first map
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
I think the best way to do this is with this trigger:

  • Attack
    • Events
      • A unit is issued an order targeting a unit
    • Conditions
      • And (All Conditions are True)
        • Triggering Unit is equal to YOUR UNIT
        • Issued order equal to Attack
    • Actions
      • Center CheckRegion on Position of Triggering Unit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CheckRegion contains position of Target unit of issued order = True
        • Then - Actions
          • Replace Triggering Unit with MELEEUNIT
        • Else - Actions
          • Replace Triggering Unit with RANGEDUNIT
CheckRegion is a region that's already been made with radius of melee attack range (about 150).
MELEEUNIT is the melee version of your hero.
RANGEDUNIT is the ranged version of your hero.

You'll have to save all info of the hero (like exp, abilities, items, etc.) and load them on the replaced hero. It's a big effort trigger and the range is is only checked in a square, not within range of the unit, but it's the best you can get.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
I think squiggy's way will cause the hero to attack randomly between attack 1 and 2. So the hero will also be attacking with ranged attacks when at melee range. I assume the reason the poster of this thread asked this question, since he wanted to make the hero do different damage when attacking melee then when attacking ranged. Squiggy's way does allow both melee and ranged attack, but mixes it randomly.
 
Status
Not open for further replies.
Top