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

Best Way to Give a Hero Ranged Attack?

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
201
I have a Hero, and a Bow Item. When he carries the bow, I want him to shoot arrow and have a ranged attack. Here is where it starts getting tricky.

So far, my first attempt was to give him an Orb item that unlocks his second, ranged, attack. The problem with this is that he will only use it whenever the first attack is unable to be utilized. So he will always use the first attack on melee targets, and second attack on air targets.

The second attempt was to switch the position of Attacks 1 and 2, the problem with this is now when set to 'Use Attack 2 Only', the attack and damage doesn't appear in the Hero's stat bar with say "20-50 +3" or whatever it is at the time. The attack spot stays empty.

Third attempt was to give him an Upgrade triggered when only holding the Bow item that increased his attack range. Again the problem with this is that upgrades can only be learned, not unlearned, so even if you set the upgrade level of 'Range Increase Upgrade' to something less then it is, he doesn't actually loose any of that additional range.

Is there an easier way to add on a ranged attack that overwrites his basic attack? As far as I know there is no item ability value that increases attack range sadly, and I really need to get this functionality. Replacing the Hero with one who has a ranged attack is not an option as doing the Replace unit command makes the hero loose all powerups from Tomes. Any help is appreciated.
 
Level 6
Joined
May 3, 2009
Messages
214
you could maybe try an aura or some triggers.

i cant help you right now but if tomorow you dint solved it ill help.

good luck
 
Level 6
Joined
Aug 12, 2007
Messages
201
An aura? I'm not sure if there were any attack range increasing auras, I am interested in what you are talking about.
 
Level 6
Joined
Aug 12, 2007
Messages
201
Sadly unit replacement isn't really viable for me as it will make me need to restructure a whole bunch of things. As a last resort I'll go with that but in the mean time I'll look for ways around it.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
lets say that your hero has 200 range without Bow ...
  • hero wants to attack without Bow
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(attack))
      • ((Ordered unit) has an item of type Tome of Bow) Not equal to True
    • Actions
      • Set P_1 = (Position of (Ordered unit))
      • Set P_1 = (Position of (Target unit of issued order))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Distance between P_1 and P_2) Greater than 200.00
        • Then - Actions
          • Unit - Order (Ordered unit) to Stop
          • -------- if you want --------
          • Set UNITGROUP = (Units within 100.00 of P_1 matching (((Matching unit) belongs to an enemy of (Owner of (Ordered unit))) Equal to True))
          • -------- You must wait " 0 " seconds because unit cannot have 2 orderrs in same time --------
          • Wait 0.00 seconds
          • Unit - Order (Ordered unit) to Attack (Random unit from UNITGROUP)
          • Custom script: call DestroyGroup(udg_UNITGROUP)
        • Else - Actions
      • Custom script: call RemoveLocation(udg_P_1)
      • Custom script: call RemoveLocation(udg_P_2)
-make you hero have big range (in object editor)
-make bow give arrow effect
(use ability Freezing Breath from Frost Wyrm (undead unit) and give effect of an arrow or whatever you want,set everything to 0 and add ability to your Bow)
 
Level 12
Joined
Mar 26, 2005
Messages
790
I have a Hero, and a Bow Item. When he carries the bow, I want him to shoot arrow and have a ranged attack. Here is where it starts getting tricky.

So far, my first attempt was to give him an Orb item that unlocks his second, ranged, attack. The problem with this is that he will only use it whenever the first attack is unable to be utilized. So he will always use the first attack on melee targets, and second attack on air targets.

The second attempt was to switch the position of Attacks 1 and 2, the problem with this is now when set to 'Use Attack 2 Only', the attack and damage doesn't appear in the Hero's stat bar with say "20-50 +3" or whatever it is at the time. The attack spot stays empty.

Third attempt was to give him an Upgrade triggered when only holding the Bow item that increased his attack range. Again the problem with this is that upgrades can only be learned, not unlearned, so even if you set the upgrade level of 'Range Increase Upgrade' to something less then it is, he doesn't actually loose any of that additional range.

Is there an easier way to add on a ranged attack that overwrites his basic attack? As far as I know there is no item ability value that increases attack range sadly, and I really need to get this functionality. Replacing the Hero with one who has a ranged attack is not an option as doing the Replace unit command makes the hero loose all powerups from Tomes. Any help is appreciated.

Did you try something with spells like Metamophosis,avatar (any of these kind of spells)
like if he gets a bow, give him this ability, cast it on him. And when he put bow away, just give him ability to change back, and remove?
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Did you try something with spells like Metamophosis,avatar (any of these kind of spells)
like if he gets a bow, give him this ability, cast it on him. And when he put bow away, just give him ability to change back, and remove?

find ability for range bonus or if you know how to put unlimited levels of (some upgrades) i could solve it easy

-unit gets bow
set INTEGER = INTEGER +1
set (upgrade for range) to INTEGER for player to INTEGER

-unit loses bow
set INTEGER_NEG = INTEGER_NEG +1
set (upgrade for range <negative>) to INTEGER_NEG for player to INTEGER
and using array INTEGER[player number of owner of unit triggering unit]
problem solved
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
i also put "or like an instant metamorphosis"

but Chaos is an orc ability that will instantly transform the unit into a different one

EDIT: @ALiEN95, even if you try to set an research to a lower level, it wont do so.
i dint set it to lower......
i just put negative upgrade of range,im sure my trigger is working until you lose all levels of upgrade (need unlimited)

if you have some upgrade -levels 5 you can do it 5 times only :(
 
Level 6
Joined
Aug 12, 2007
Messages
201
I managed to solve it without using a unit-replacement technique, but it seems my separate thread on the technique got lost somewhere, So I'll put a mention here.

I'm using two upgrades based on Long Rifles, one that gives +500 range a level, and another that gives -500 range a level. Every time a bow is picked up or dropped, it levels up one of the two upgrades, thus giving it a sort of 'deleveling' feel to upgrades that is normally impossible. While this only works for a single unit, as well as many other drawbacks, can't be helped, but it works for my single hero purposes.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
I managed to solve it without using a unit-replacement technique, but it seems my separate thread on the technique got lost somewhere, So I'll put a mention here.

I'm using two upgrades based on Long Rifles, one that gives +500 range a level, and another that gives -500 range a level. Every time a bow is picked up or dropped, it levels up one of the two upgrades, thus giving it a sort of 'deleveling' feel to upgrades that is normally impossible. While this only works for a single unit, as well as many other drawbacks, can't be helped, but it works for my single hero purposes.

y but you do need about 20-100 available levels dont you?
 
Level 6
Joined
Aug 12, 2007
Messages
201
Pretty much. At the moment both upgrades go to 100 each, but I haven't tried picking up and dropping a bow 100 times in game to see what happens when it reaches the max, as it is being leveled up via triggers and not naturally. In the worst case, it stops leveling up, which then you just go into the upgrade in the editor, hold shift, and open the level value and set it to something like 1000 or 9000 that is for all intents and purposes unreachable.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Pretty much. At the moment both upgrades go to 100 each, but I haven't tried picking up and dropping a bow 100 times in game to see what happens when it reaches the max, as it is being leveled up via triggers and not naturally. In the worst case, it stops leveling up, which then you just go into the upgrade in the editor, hold shift, and open the level value and set it to something like 1000 or 9000 that is for all intents and purposes unreachable.

500 makes lags already but anyway 100 is enough
 
Status
Not open for further replies.
Top