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

Increasing Attack Range Idea?

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
201
Increasing Attack Range - Sollution?

So I did some research and it seems without directly replacing a unit it is next to impossible to increase or decrease a unit's attack range. One option, the most viable yet flawed, showed some promise.

Upgrades can easily increase a unit's attack range, their flaw being it is impossible to decrease said upgrade level once it has been increased. To work around this, I made two separate upgrades, Attack Bonus Positive and Attack Bonus Negative. On pickup of my Bow item, a level is added to AB-Positve, increasing it's attack range by 600. When the item is dropped, a level is added to AB-Negative, who's upgrade effect is to reduce attack range by -600, thus returning the unit's attack range to normal.

I don't know if this would work all the time of if it is a sound system, but it worked in some early tests. Sorta posting this half an idea/half needs better testing of its limits/Good to know if it does work, since I have found the 'Increase Range' problem often and am facing it myself currently.

EDIT: It works! Using two upgrades and the following triggers, I got a unit to consistently gain and loose attack range:

  • Ranged Distance Gain
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Shortbow
    • Actions
      • Set AB_Positive_Level = (Current research level of Attack Range Bonus for Player 1 (Red))
      • Player - Set the current research level of Attack Range Bonus to (AB_Positive_Level + 1) for Player 1 (Red)
  • Ranged Distance Loss
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Shortbow
    • Actions
      • Set AB_Negative_Level = (Current research level of Attack Range Negative Bonus for Player 1 (Red))
      • Player - Set the current research level of Attack Range Negative Bonus to (AB_Negative_Level + 1) for Player 1 (Red)
The reason I put them into values was because it seemed to be having issues with setting the research level to itself plus one, so I stored it into an integer before hand and added that plus 1.

The unit has both upgrades on it as being used, and the upgrade's base and increment are both 400 and -400 respectively.
 
Last edited:
Level 13
Joined
Mar 4, 2009
Messages
1,156
i see what you want but you need to set
AB_Negative_Level = AB_Negative_Level + 1 - set level of upgrade to AB_Negative_Level
AB_Positive_Level = AB_Positive_Level + 1 - set level of upgrade to AB_Positive_Level
-set available levels to 100

try to find bonus range ability too

or try to do it with this trigger

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 Bow) Not equal to True
      • (Attacking unit) equal to (your unit)
    • 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 --------
          • -------- You must wait " 0 " seconds because unit cannot have 2 orderrs in same time --------
          • Wait 0.00 seconds
          • Set UNITGROUP = (Units within 100.00 of P_1 matching (((Matching unit) belongs to an enemy of (Owner of (Ordered unit))) Equal to True))
          • 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)
 
Last edited:
Level 9
Joined
Apr 25, 2009
Messages
468
There are like 10000000 threads for this, first of all: SEARCH!

Second: Create 2 units that uses the same model and are based on the same values but change the attack range of 1 of the units to (your range) and make it use "missile" attacks.
Once you cast the spell, set the hero level, hp, mana, spells etc as Variables then replace the (Casting Unit) with the unit that has more range. Once that is done, set the level, hp, mana spells etc of the new unit to the Variables you made for the first unit...
You following?
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
There are like 10000000 threads for this, first of all: SEARCH!

Second: Create 2 units that uses the same model and are based on the same values but change the attack range of 1 of the units to (your range) and make it use "missile" attacks.
Once you cast the spell, set the hero level, hp, mana, spells etc as Variables then replace the (Casting Unit) with the unit that has more range. Once that is done, set the level, hp, mana spells etc of the new unit to the Variables you made for the first unit...
You following?
if you have more heroes than it sucks....
for 10 heroes you need 20 ...
BTW i think its all solved in my first post (accept if you will drop and get bow 100 times) ,all you need to do is set available levels to 100
 
Level 6
Joined
Aug 12, 2007
Messages
201
Oh wow, bunch of replies. Okay here I go:

@ALiEN95: There is no range increasing ability, and I'm not sure what you are saying when you corrected the set values as it works fine in game? If you mean to set the upgrade value to itself + 1, that didn't seem to work correctly, which is why I use the variables. And I don't quite follow your trigger as it is doing something totally different to achieve similar results.

@cookies4you: Doesn't that just increase your building health?

@Dr Super Good: I thought about that, and while I'm not totally sure it would even hit the limit, if it does the limit can always be increased to say 9999 levels of upgrades, etc.

@HaniBon: I am well aware of how many threads there are on this, I read just about all of them for months and months back trying to find a solution to this that WASN'T replacing the unit in any way, because when you replace you need to have second types of units for every unit that needs to become ranged, as well as certain stats like tome upgraded points could slip through without complex supporting triggers. I was deliberately not using replacement methods, and I have never seen anyone else to my knowledge use two upgrades like this to get this result.

@ALiEN95 again: This method is not meant for more then a single unit, because you'd need two more separate upgrades for each unit that was using it.

EDIT: and @Dr Super Good: I'd make the upgrade level value really high and give it a delay of some sort in the picking and dropping so that there is no practical way to hit it besides sitting still and picking up/dropping ranged weapons constantly four hours on end.
 
Level 11
Joined
Feb 22, 2006
Messages
752
Make your attack range really high (w/e the max value is), and use SetUnitAcquireRange(). And just to anticipate the usual rebuttals:

1. Yes, acquisition range DOES cap a unit's attack range in all circumstances. It does not just control how close enemies have to be before the unit AI "sees" them.

2. Yes, the in-game UI will actually update to reflect the unit's acquisition range (the tooltip you get when you hover over the attack type icon that displays the unit's attack range will actually display the lower of the two values: attack range and acquisition range, so if acquisition range < attack range, it displays the acquisition range).
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
aznricepuff, sorry but that really does not work. It only works with object editor aquisition range. Trigger editor aquisition range does not alter a units maximum range. It will still display the same range it had when first created even if set to 0 via triggers. It may however mean the unit will not auto attack at full range kind of acting as if the range was reduced.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
... So you mean 10 heroes will use this spell? haha stinky :)
its a bow -.- ,y 10 heroes may use it in a game


People will do that just to show you it breaks lol.
you mean people would drop the Bow 100 times and pick it up 100 times ?than your stupid....besides it would be player´s fault,there is no need to do that 100 times

madmuffin just set available levels to 100 and do this

-unit acquires Bow
-set POSITIVE [Player number of owner of (Hero manipulating an item)] = POSITIVE [Player number of owner of (Hero manipulating an item)] + 1
-set correct research of <positive upgrade> to POSITIVE [Player number of owner of (Hero manipulating an item)]

and same when he loses the bow ....
 
Status
Not open for further replies.
Top