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

[General] How to increase att. range ingame?

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2010
Messages
344
Hi guys,

I've been trying to make a unit gain additional attack range when picking up and item - and have it decreased again when the item is lost.

People around tries with upgrades, but it seems impossible to degrade an upgrade back to 0?
Now this was from a post back in 2007 linked in the bottom. I don't know if updates have modified that later on.
They also mentioned other solutions but took them back.
Any ideas? :)

Also, if it is possible, I would like to change the attack (probably by barrage) to another missile model and remove melee sounds. Does barrage change the attack damage, or should I use searing arrows, with damage +0?

I have been searching across google mostly, and found only this:
http://www.hiveworkshop.com/forums/...ditor-unlimited-change-unit-range-game-41607/


A whole other question:
I have 3 types of item classifications made into level 1, 2 and 3.
You can only wear one of each at a time.
Now if you wear item lvl 1, you cannot wear items with level 2 or 3.
You can wear items with level 2 and 3 at the same time.
I do also have a 4'th item classification, which is non-stackable, but does not interact with any other item levels than its own.

I've made this so far:
  • IDS
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set ItemCounter_Limiter = 0
      • Set ItemCounter_Item = (Item being manipulated)
      • Set ItemCounter_Level = (Item level of ItemCounter_Item)
      • Set ItemCounter_PickUpUnit = (Triggering unit)
      • Set ItemCounter_Inventory = (Size of inventory for ItemCounter_PickUpUnit)
      • For each (Integer ItemCounter_Loop) from 1 to ItemCounter_Inventory, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item level of (Item carried by ItemCounter_PickUpUnit in slot ItemCounter_Loop)) Equal to ItemCounter_Level
            • Then - Actions
              • Set ItemCounter_Limiter = (ItemCounter_Limiter + 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemCounter_Limiter Greater than 1
        • Then - Actions
          • Hero - Drop ItemCounter_Item from ItemCounter_PickUpUnit
          • Game - Display to (All players controlled by a ((Owner of (Triggering unit)) controller) player) the text: |cffff0000You canno...
        • Else - Actions
      • Set ItemCounter_Item = No item
      • Set ItemCounter_PickUpUnit = No unit
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
It is one of the things that aren't technically possible.

The upgrade workaround works, however it has a limit.
You can't de-level an upgrade on any way so you can't have the effect removed properly.
You can do it with simply making an inverse upgrade, but you will be limited to the amount of levels the upgrade has.
Example: if your upgrade has 5 levels and you pick up the item and drop it 5 times, the upgrade won't work any more.
(The upgrade also works on all units and cannot be used individually.)

Another option (which can suit your situation best) is to change the unit type rather than the attack range.
There is a tutorial Instant Unit Transformation which clearly explains how to change a unit to another type.
With that you can have the melee attack for your first unit and the ranged attack with your second unit.
(This will get problematic when you use this method for a lot of other stuff or want to have a lot of different ranges/attack-types/sounds/etc.)

A third option (which still requires testing) is to disable all attacks of all units.
And then with dummy orb abilities, you enable one index so that one will be used.
Then you can switch between attack indexes for each unit.
(This method is not implemented in any system I know nor is there a proof of the concept.)

An option for more advanced map makers is to not use any basic attacks at all.
I for example have started BasicAttack which would allow you to change the sounds, attack range, attack speed (without limits), etc with simple functions.
However, it is not completely finished and you would have to set the attack damage and speed yourself. (Attack Damage/Speed bonus items and stuff won't work any more. All stats have to be created code-wise.)

I think option 2 would fit your needs.
 
Level 8
Joined
Jun 13, 2010
Messages
344
It is one of the things that aren't technically possible.

The upgrade workaround works, however it has a limit.
You can't de-level an upgrade on any way so you can't have the effect removed properly.
You can do it with simply making an inverse upgrade, but you will be limited to the amount of levels the upgrade has.
Example: if your upgrade has 5 levels and you pick up the item and drop it 5 times, the upgrade won't work any more.
(The upgrade also works on all units and cannot be used individually.)

Another option (which can suit your situation best) is to change the unit type rather than the attack range.
There is a tutorial Instant Unit Transformation which clearly explains how to change a unit to another type.
With that you can have the melee attack for your first unit and the ranged attack with your second unit.
(This will get problematic when you use this method for a lot of other stuff or want to have a lot of different ranges/attack-types/sounds/etc.)

A third option (which still requires testing) is to disable all attacks of all units.
And then with dummy orb abilities, you enable one index so that one will be used.
Then you can switch between attack indexes for each unit.
(This method is not implemented in any system I know nor is there a proof of the concept.)

An option for more advanced map makers is to not use any basic attacks at all.
I for example have started BasicAttack which would allow you to change the sounds, attack range, attack speed (without limits), etc with simple functions.
However, it is not completely finished and you would have to set the attack damage and speed yourself. (Attack Damage/Speed bonus items and stuff won't work any more. All stats have to be created code-wise.)

I think option 2 would fit your needs.

I don't think the Unit Type is an ideal.. Since it is in an RPG and I have over 20 Hero Classes.. It could work.. But it is ALOT of small triggerings..

The upgrade thing. Can't I make an upgrade degrade in level?
So I make level 1 give +0 attack range, and level 2 +100 attack range?
So everyone starts with level 1 and goes to level 2 when picking up the item. So when they lose the item, it is not unresearchable, but it just goes back in level to level 1, removing the attack range bonus?

I am not able to test it atm with this PC, so that's the reason the I dont just test it myself. ^^
 
A third option (which still requires testing) is to disable all attacks of all units.
And then with dummy orb abilities, you enable one index so that one will be used.
Then you can switch between attack indexes for each unit.
(This method is not implemented in any system I know nor is there a proof of the concept.)
I can confirm that this doesn't work. Orbs work a bit arbitrary... they don't actually disable the original attack index and just add the second on top of it that is used simultanously.
They also seem to bug out if you use them on a unit that has no index enabled by default.

However, what I can confirm working (and what I implemented successfully in a system) is using the Warclub ability of mountain giants. This one actually *disables* the other attack index properly and allows switching back and forth between the two.
This has an annoying bug, unfortunately:
As heroes only have one attack index displayed on their command card (the second one is replaced with the hero stats), it will not show the attack icon and damage when switching to the second index via warclub. Instead, it will just show a black space where the attack icon was before.

If you can live with that, use warclub. If not, there is no way around morphing your unit into another one with a different attack range.

@SnowYell:
No, it is not possible to "go back" with upgrades. Upgrades can only be incremented, not decremented. Use attack indices or transformation. Those are the only two options you have.

But here is a thing to consider: why even care about attack range? Just have two default range values (melee & ranged) and only alternate between those two. Do you really need values inbetween in an RPG? If so, what for?
This only requires one morphed alternate form per hero and you're done and have a clean solution.

If you are angsty about having to deal with two different unit types per hero (in conditionals), there would be a simple solution of a:
hook GetUnitTypeId that could intercept all GUI retrievals of Unit Types and manually overwrite returns with the original type ids.

Ask in the trigger help section for such a snippet if you don't know how.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
I can confirm that this doesn't work. Orbs work a bit arbitrary... they don't actually disable the original attack index and just add the second on top of it that is used simultanously.
They also seem to bug out if you use them on a unit that has no index enabled by default.
Then you didnt hear me.
You disable both attack indexes and enable the first one by giving all units an orb that enables the first one when they spawn on the map.
This will make the first one enabled via orbs so when you remove the orb, you disable it again. Then you add the orb dummy for the second index and you will have the second index enabled.
However, that last line "They also seem to bug out if you use them on a unit that has no index enabled by default." sounds pretty annoying to this concept.

However, what I can confirm working (and what I implemented successfully in a system) is using the Warclub ability of mountain giants. This one actually *disables* the other attack index properly and allows switching back and forth between the two.
This has an annoying bug, unfortunately:
As heroes only have one attack index displayed on their command card (the second one is replaced with the hero stats), it will not show the attack icon and damage when switching to the second index via warclub. Instead, it will just show a black space where the attack icon was before.
War Club is an active ability so you will have to be able to cast it even when the unit is stunned, silenced or better yet dead (for heroes for example).

If none helps, you could try the testmap in that BasicAttack link I sent.
It will only help you if you can set the attack damage and speed via a function (preferably via a stat system).
However, I am afraid that is too hard for you to achieve as it is not to be taken lightly.
 
However, that last line "They also seem to bug out if you use them on a unit that has no index enabled by default." sounds pretty annoying to this concept.
Which is why I added it. Don't assume by default that I haven't read your post... ;)

War Club is an active ability so you will have to be able to cast it even when the unit is stunned, silenced or better yet dead (for heroes for example).
As he wants to change range when equipping/unequipping items, that doesn't seem like a problem to me. You can not pick/drop items when stunned or dead. Silence does not block Warclub afaik.
 
Level 8
Joined
Jun 13, 2010
Messages
344
But here is a thing to consider: why even care about attack range? Just have two default range values (melee & ranged) and only alternate between those two. Do you really need values inbetween in an RPG? If so, what for?
This only requires one morphed alternate form per hero and you're done and have a clean solution.

What is was for?
Well, it is simply because I wanted all my Heroes to be melee at start point. Now all my classes can be various from damage/support/tank, depending on items and playstyle. So I just wanted to make it optional whether you wanted to be ranged or melee.
I did not realize it would be so difficult to make it change between melee and 800 attack range by using items.

But I appreciate the helpful ideas and most of all your time.
Thanks guys.
 
You can give your unit infinite range and limite their infinite range with aquisition range that is modifiable with triggers.
  • Unit - Set (Triggering unit) acquisition range to ((Current acquisition range of (Triggering unit)) + 200.00)
  • Unit - Set (Triggering unit) acquisition range to ((Current acquisition range of (Triggering unit)) - 200.00)
Actual range cannot exceed aquisition range.
The only probleme is that for melee unit their aquisition range will be so small they won't autoaquire or defend themselves unless the target is next to them.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
You can give your unit infinite range and limite their infinite range with aquisition range that is modifiable with triggers.
  • Unit - Set (Triggering unit) acquisition range to ((Current acquisition range of (Triggering unit)) + 200.00)
  • Unit - Set (Triggering unit) acquisition range to ((Current acquisition range of (Triggering unit)) - 200.00)
Actual range cannot exceed aquisition range.
The only probleme is that for melee unit their aquisition range will be so small they won't autoaquire or defend themselves unless the target is next to them.

Have you confirmed that this method works?
 
I have confirmed that this method does not work.
Acquisition range set by triggers is not the same acquisition range set by the object editor.
Blizzard is quite confusing.

Actually it is the same however you can't change range in-game unless by upgrades or new unit types or attack type 2. Maybe we can find some kind of work-around like we did for the ability to change armor in-game. Though the only one I can think of without remaking the entire attack system is using what you guys have already been suggesting...

Acquisition range and then just check distance every order, will think about other possible methods however that's the best one anyone's thought of so far.
 
Status
Not open for further replies.
Top