• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

A ranged and a melee atk.

Status
Not open for further replies.
Level 2
Joined
Aug 2, 2006
Messages
19
How do u make a unit normally use a ranged attack and if the enemy is within say like 50 range, it do melee attack instead? Btw plz refer me to sumwhere else if this question had been answered some where ele.
 
Level 11
Joined
Aug 15, 2004
Messages
710
you can use the 2 attacks option and simply give the ranged attack a min range of say 75ish doing this with say a melee model with added effects to the ranged attack should give you the desired effects

You cant do it that way, minimum attack range applies for both attacks. You'd have to trigger a system that uses orbs with 2 attacks (one ranged, one melee) and then removes or adds the orbs based on wether the unit is in range or not. But this pretty annoying, and not something you can really show without making the entire system.
 
Level 4
Joined
Jul 30, 2007
Messages
79
what is it EXACTLY you are trying to do here

this is more complicated than it sounds as units will always use their primary attack if it is viable even if say a secondary attack that can only be used in melee would do more damage

what is the point of what you are trying to do and what exact goals are you trying to achieve
that would make it easier to help you
 
Level 1
Joined
Aug 12, 2007
Messages
6
There is a simpler way, but it's trublesome to play it (needs a good micro).
Druid morph skill, one unit with ranged attacks one with not.

And, if you are too lazy for download extra icons, the nightelves have the bows range upgrade one.
;)
 
Level 2
Joined
Aug 2, 2006
Messages
19
I wanted to make that the range atk is what the unit would normally do, and if the unit is too close to the enemy, then it cannot use its range atk and instead do a melee atk that is chaos dmg and more powerful.
 
Level 6
Joined
May 3, 2006
Messages
81
what u could do is like say its a rifleman shooting you could make a trigger that does: A unit is attacked -- Attacking unit equal to rifleman - Distance between position of attacked unit and attacking unit equal to or less than 100 -- *Then you could make it do more dmg cuz of the range* (Order Attacking unit to damage attacked unit dealing 15 dmg of type pierce) or pause the rifleman and play an animation like stand 3 where he pulls his gun up and reset his animation so it looks like he jabs the enemy with the end of his gun... thats what i did for a melee animation for a gun game im making!
 
Level 22
Joined
Jun 23, 2007
Messages
3,242
well this is wut im doin for my marines and stuff its basically the morph ability but for the melee attack make the atk animation be "spell" thisll make the marine when morphed into melee mode do an upward cut with a boynet(or another weapon) and itll look cool i guess... but it does require some micro and some peple might not bother with it unless melee is way better than ranged like better dmge or something. well thats all i can help :)
 
Level 6
Joined
May 3, 2006
Messages
81
Morph is a useless spell for this, all you need is a trigger to detect range and pick all units infront of the unit and damage them and even knock them back or stun. If you do it with morph your guy will just gain close range attack then he'll have to cast morph back to ranged form.

If you want I could send a quick demo map showing you how it works.
 
Level 12
Joined
Jul 2, 2004
Messages
471
You can create it someway like this:

Event:
Unit is attacked

Condition:
If PositionOfUnit(AttackingUnit) not grather than PositionOfUnit(AttackedUnit)+100

Action:
UnitAddAbility("Chaos")

I dont have WE open right now. But I hope you understand my idea.
"Chaos" is an ability that morph the unit into another unit.
 
Ok, I was trying make a simple trigger, which then did not result as a simple, I have quite much problem with it. First of all, ignore that player group action, I just did not manage to get it work, so I went the complicated way, the for loop. If somebody could tell me the reason, I will appreciate it.

The prerequisites are two units, the ranged and the melee one, and two abilities based on chaos. First it has new unit type 'rifleman(melee)' and the second 'rifleman(ranged)'.

I think that there could be some memory leaks as the game lagged a little, but this could be possible also because having a lot of programs opened.

  • Melee
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacked unit)) Equal to Rifleman Elite (ranged)
      • (Distance between (Position of (Attacking unit)) and (Position of (Attacked unit))) Less than or equal to 250.00
    • Actions
      • Custom script: local integer udg_count=1
      • Unit - Add Chaos (Rifleman Melee) to (Attacked unit)
      • Custom script: loop
      • Custom script: exitwhen udg_count==0
      • Set count = 0
      • Player Group - Pick every player in (All enemies of (Owner of (Attacked unit))) and do (Set count = (Number of units in (Units in (Region centered at (Position of (Attacked unit)) with size (400.00, 400.00)) owned by (Picked player))))
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) is an enemy of (Owner of (Attacked unit))) Equal to True
            • Then - Actions
              • Set count = (count + (Number of units in (Units in (Region centered at (Position of (Attacked unit)) with size (400.00, 400.00)) owned by (Player((Integer A))))))
            • Else - Actions
      • Wait 1.00 seconds
      • Custom script: endloop
      • Unit - Add Chaos (Rifleman Ranged) to (Attacked unit)
 
Level 6
Joined
May 3, 2006
Messages
81
No it works fine (I tweaked my trigger a bit to make it work), I've created a map already with it working, after meleeing you can move away or your guy will keep meleeing, it knocksback the enemies and does good damage and slows their movement and attack for a short duration (just an added effect I like so you could run up to ranged units and give em a good bashin and run by)
 
Level 2
Joined
Aug 2, 2006
Messages
19
For Mecheon triggers, what does 'chaos' actually meant to do? Is it the same chaos in -=Emergenzy=-'s idea? or is it based upon the chaos in W3?
 
Status
Not open for further replies.
Top