• 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.

Melee/ranged unit

Status
Not open for further replies.
I am also working on this problem. Currently I found three variants:

1. Two types of units. Create a unit that in nearly the same, except the attack. Set an event that detect melee attack*. Then order attacked unit to transform into a melee variant via triggers. After some time order it to transform back in ranged.

Cons: If unit is given a command via triggers it will forget it current order, so if you use attack-move, melee unit will stand still while other will go forward.


2. Drunken Haze. Make your unit two attacks, first ranged, second melee. Create a dummy unit with cast animation** set to 0 with drunken haze ability. Check in data - attacks prevented 'Ranged' flag, area effect less than or equal to 100, missile speed to 0 and nullify other negative effects (in data). Set that event* and order dummy unit to cast drunken haze on attacked unit.
Variant: you can add ability drunken haze with nullified effect (except ranged thingy) to ALL melee unitS, but do not think this is a good idea.

Cons: Drunken haze is a spell, thus CAN be dispelled. However it is better than its Silence variant as the AI (computer controlled and autocast spells) will not acquire it. But if you plan to make a map like napoleonic warfare when no magic is used it is fine.

3. War Club. This is the only ability that set enables and disables attacks directly. However the requirement to target and destroy a tree makes it useless here.

* - Actions:
Generic Unit Event - Unit is (attacked)

- Conditions:
(Attacking Unit) type equal to (your unit)

- Actions:
....

** Animation - Cast backswing/...


Hope it helps!
 
Also i had an idea: Change two of the unit 'types' [undead, living, ancient, tauren, giant, etc] so one reads melee and the other reads ranged and all ranged units have the ranged type and all melee have the melee type then give him 2 attacks, one to target each OR give him ability like bear form and have him be manually changed from melee to ranged.
 
Level 16
Joined
Oct 30, 2004
Messages
1,277
One choise could also be that you set the unit as ranged and give it minimum attack range, like 300 for example. And give the unit phoenix fire ability with range 300.

Cons: When the attacker gets inside the minimum range the unit will try to move in range to attack.
 
Deep Sea Kraken: You were not very clear, but I presume you think to add classification to units regarding their range. Which means that melee units can be attacked by ranged only with melee attack. About bear form, I already stated it in my first version.

Do you want switching to melee automatically or manually?


Mini_Me: There are some other cons. As melee you usually want normal type attack, this is spells and cannot hit magic immune. Other thing, it will not show animation (ex. bayonet attack).
 
Also wouldnt the phoenix fire hurt ALL units nearby?? With the unit types it would only be used for the ranged/melee units. And for the automatically/manual that would be for i guess what ever the user wants. And I think for the phoenix fire you could fix him running away by changing it so that he cant run or something like that
 
Level 9
Joined
Oct 2, 2005
Messages
385
me and my friend messed with this a bit there no simple stats adjusting for this. for example we tried adjusting the range so the min was 100 and the max was 300 then we had the 2nd a melee with the melee min range being 1 and the max being 99. well the unit will alwase use his range attack unless the attacks have diffren't classifications such as air vs ground and ground vs ground kinda deals.
 
Level 27
Joined
Sep 24, 2006
Messages
4,981
I have seen this in Fieldview orpg,you should ask that guy how he did it because a bowguy when u equiped a bow he attacks from long range in a distance ( so he shoots arrows ) but when that skeleton approached him to attack ( the skellie was melee ) the guy with the bow suddenly smashed him dead with its bow .. realy cool ;)
 
Status
Not open for further replies.
Top