HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Melee + ranged hero attack.

02-07-2006, 08:41 AM#1
Moss
I thought it would be cool if you could make a hero use a melee or ranged attack based on the distance to the unit it is attacking. I thought it would be as simple as adjusting the min and max ranges of attack 1 and attack 2, except min range applies to both. Any other ideas how this could be rigged?
02-07-2006, 12:04 PM#2
Drakim
Quote:
Originally Posted by Moss
I thought it would be cool if you could make a hero use a melee or ranged attack based on the distance to the unit it is attacking. I thought it would be as simple as adjusting the min and max ranges of attack 1 and attack 2, except min range applies to both. Any other ideas how this could be rigged?

You could use orb of lightning (new), and giving it a skill that has an melee animation (like searing arrows with low range and attack as the animation (and set an blank missile effect)) Then the unit would try to use the spell while he attacks, but fail because of its short range, attacking only normal. While near any ennemy it would use the skill and cause the extra damage.


I haven't tried this, so It may not work....
02-07-2006, 12:20 PM#3
Whitehorn
If yuo don't want it automated, its easy enough to make a 'attack switch' that flips the unit between ranged and melee.
02-07-2006, 12:31 PM#4
Fulla
Cant you give the ranged attack a minimum range?

Not sure if it would auotmatically use melee attack thou.
02-07-2006, 12:40 PM#5
Whitehorn
He already pointed out that minimum range affects both attacks.
02-07-2006, 03:07 PM#6
Blair46
I know this is probably not what you want, but, couldn't you always just, either make it a ranged or melee hero, and then incorporate a skill or two that have no cooldown/mana cost and have that as a ranged/melee "attack"?

Can you even give skills min/max damage with the use of dice/randomization?
02-07-2006, 04:32 PM#7
qwertyui
Quote:
Originally Posted by Whitehorn
If yuo don't want it automated, its easy enough to make a 'attack switch' that flips the unit between ranged and melee.

Wonder if its possible to do this in a combination with "a unit attacks" trigger to create an automated system.
02-07-2006, 04:50 PM#8
Immoralis
Use "a unit is attacked" then detect distance and chaos accordingly.
02-07-2006, 04:52 PM#9
qwertyui
Yes, but the imortant bit is - does attack animation start before the unit is attacked trigger fires off, or after it.
If before, i'm afraid it won't work.
No way to know it other than testing it out though.
02-07-2006, 04:53 PM#10
Immoralis
the "a unit is attacked" detects it the instant before the animation starts
02-08-2006, 06:10 AM#11
BBDino
There is a relativly simple way to simulate a "bayonet" type attack if you want to avoid triggers. (Perhaps you just want it as a gimmick and don't intend to put tonnes of effort into it.)

Set the units minimum attack range to about 150-200 and stat his attack for ranged. Also give him a modified ability based on "phoenix fire" with a melee range that will recreate the "melee" attack. He will now periodically, automatically damage an adjacent target, for an amount of pre determined spell damage, that he would otherwise be unable to attack.

Sure it's not a perfect representation, but it is a simple and easy to implement ability.
02-08-2006, 07:39 AM#12
Moss
I do want it to use the real attacks if possible, and then you could get items that enhance just one attack or the other. Like bows and swords. I don't really want to do it with triggers.

The problem with orb effects, I believe, is that they are attached to the actual attack and have no range of there own. (Someone correct me if I am wrong). But I am curious what exactly does the "enabled attack index" do?

The problem with phoenix fire is it isn't really an attack, it just spews out periodically, but I think I may make some items that do that.

Even if this can't be worked out (that would be a shame but) I am still interested in pointers on what funky base spells there are out there that affect attacks, like ones that enable/disable attack 1 or 2, or that change the attack type (seige, piercing...). So if you have any solid info on abilities that could be usefull in crafting items and other abilities that modify attacks please share! Thanks.
02-08-2006, 08:58 AM#13
Whitehorn
Quote:
Originally Posted by qwertyui
Yes, but the imortant bit is - does attack animation start before the unit is attacked trigger fires off, or after it.
If before, i'm afraid it won't work.
No way to know it other than testing it out though.

Catch event, check if unit needs to switch, [assign target to variable, pause attacking unit, switch unit ir required, unpause, reassign target and order].
02-08-2006, 10:54 AM#14
Anitarf
Yeah, that sounds like the simplest solution to automate it. Make two versions of the unit, one for melee and the other for ranged attacks, but give both the same range, so both can attack targets both far and close. Then, on "a unit is attacked" event, if the melee version of the unit is trying to attack a target that's too far, or the ranged version is trying to attack a target that's too close, switch them (best way to do that is with a chaos ability, like used in the RoC orc campaign to switch orcs to fel orcs) and reorder the unit to attack the same target. It's a very simple trigger.

And you couldn't do this without triggers anyway, you would need them if you wanted to make items that give an attack bonus when carried by one type of hero, but not when carried by another.
02-08-2006, 08:50 PM#15
Moss
Alright. Seems a little crazy to me but i may try it. Would the hero still have all the same abilities, items, etc. when they are "Chaosed"?

And here is a different idea. How about if all heroes had a ranged attack and a melee attack, but they were enabled or disabled based on what item (bow/sword/etc) they possessed? Would that need scripting?