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

[Spell] Archer Better Attacks

Status
Not open for further replies.
Level 6
Joined
May 26, 2012
Messages
177
Hello,
I am making a castle defense map but I want it to be special.Well I want the archers not to shoot units but ground,as like raise their bows and shoot in the air to a specific ground circle(target area,ground circled while making an ability like Blizzard ability).It lands in a random point not the center and if a unit is in that point he takes damage.+Rep and credits for helpers!
 
Level 2
Joined
Mar 25, 2013
Messages
32
Hello,
I am making a castle defense map but I want it to be special.Well I want the archers not to shoot units but ground,as like raise their bows and shoot in the air to a specific ground circle(target area,ground circled while making an ability like Blizzard ability).It lands in a random point not the center and if a unit is in that point he takes damage.+Rep and credits for helpers!

Why do you need an ability for this? Just take a Catapult and reskin it as an archer.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
So if I understand it correctly, then:
- each archer has a circle he shoots at
- he shoots at random point in that circle
- the arrow deals damage in reasonably small AoE

Does the circle move? Do more archers aim at one same circle or does each have their own unique circle?
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
I re-read the thread and decided to not make the ground circle move with unit (as if following it) since it wouldn't show the area where arrow falls. So for each attack there will be circle on ground.
This is a bit of roundabout way of doing it, but it may be worth it.

For the ability do the following

- create a spell based off "AOE Damage upon death (Big Mine)"
- change that ability's Data - Full Damage Amount to the amount of damage you want those arrows to do
- change Data - Full Damage Radius to small number - like 25-40 (so most likely only 1 unit gets hit by it, unless there are 2 units nearly one in another)
- set Data - Partial Damage Amount and Radius to 0

- create a dummy unit (locust ability, no shadow, movement type fly, etc.)
- add the spell you just made to the dummy unit you just created

- Now create a spell based off "Pocket Factory". I'll call that ability Artillery
- Make it a non-hero ability, set its cooldown to 0 and mana cost to 0, make it 1 level only, change its Missile Art to arrow or whatever your archer shoots, set Missile Arc and Missile Speed to values you want
- Set Cast Range to the range you want it to be usable at and add +200 to that range
- set both Duration - Hero and Duration - Normal to 0,01.
- Change "Data - Factory Unit ID" to the dummy unit you created a while ago.
- If you want the Archer to have some time between attacks, set Artillery's cast time to the amount of time you want the archer to wait between "attacks".

Add the Artillery ability to your Archer.

What this ability basically does is it will shoot a projectile and when that projectile lands, it spawns your dummy unit, which dies after 0,01 second. This dummy unit causes explosion in small radius upon death, damaging enemies.


For the actual attack I would do it like this:
First you will need 3 triggers - One I named "Archer Aggro" and for now it is just an empty trigger. The other 2 triggers are in hidden tags.

This trigger fires at map initialization
  • Archer setup ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Archer)) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Archer Aggro <gen> the event (Unit - (Picked unit) Acquires a target)
This trigger fires when new archer has been trained and joined the game
  • New archer set up
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Archer
    • Actions
      • Trigger - Add to Archer Aggro <gen> the event (Unit - (Triggering Unit) Acquires a target)
Now in object editor create a new dummy units and change its model to the model of your targeting circle. Set its model size so it is big enough to cover the whole area where an arrow might fall. I will call this dummy unit "TargetCircle"

Now you will fill in the "Archer Aggro" trigger that was so far empty.

You don't need event for the trigger, because we add that event by those 2 triggers above
  • Archer Aggro
    • Events
    • Conditions
    • Actions
      • Set Temp_Point[1] = (Position of (Triggering unit))
      • Set Temp_Point[3] = (Position of (Targeted unit))
      • Set Temp_Real[1] = ((Distance between Temp_Point[1] and Temp_Point[3]) / 1000.00)
      • Unit - Create 1 TargetCircle for (Owner of (Triggering unit)) at Temp_Point[3] facing Default building facing degrees
      • Unit - Add a (0.25 + Temp_Real[1]) second Generic expiration timer to (Last created unit)
      • Set Temp_Real[1] = (Real((20 x (Random integer number between 0 and 10))))
      • Set Temp_Real[2] = (Real((20 x (Random integer number between 1 and 18))))
      • Set Temp_Point[2] = (Temp_Point[1] offset by Temp_Real[1] towards Temp_Real[2] degrees)
      • Unit - Order (Triggering unit) to Neutral Tinker - Pocket Factory Temp_Point[2]
      • Custom script: call RemoveLocation(udg_Temp_Point[1])
      • Custom script: call RemoveLocation(udg_Temp_Point[2])
      • Custom script: call RemoveLocation(udg_Temp_Point[3])
      • Custom script: set udg_Temp_Point[1] = null
      • Custom script: set udg_Temp_Point[2] = null
      • Custom script: set udg_Temp_Point[3] = null
Things to note:
  • Set Temp_Real[1] = (Real((20 x (Random integer number between 0 and 10))))
is the range around the target. It may vary from 0 range (right at the the position of target) to 200. I multiply random 0-10 number by 20, so you can see by eye there are different ranges (else the trigger may pick up range 1 the first time and range 2 second time... in case of reals, it may pick range 0,01 and 0,98, which makes no difference at all)

  • Set Temp_Real[2] = (Real((20 x (Random integer number between 1 and 18))))
This is the angle and it follows the same logic as range. To make the variation higher, I chose number 1-18 and multiply it by 20.

The value 1000 in
  • Set Temp_Real[1] = ((Distance between Temp_Point[1] and Temp_Point[3]) / 1000.00)
is the missile speed of Artillery. If you have different Missile Speed, change the value here as well.


And last trigger will fire every time an Archer finished using Artillery. It picks up the closest enemy.
  • New Aggro
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Artillery
    • Actions
      • Set Temp_Point[1] = (Position of (Triggering unit))
      • Set Temp_Real[1] = 10000.00
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 1500.00 of Temp_Point[1]) and do (Actions)
        • Loop - Actions
          • Set Temp_Point[2] = (Position of (Picked unit))
          • Set Temp_Real[2] = (Distance between Temp_Point[1] and Temp_Point[2])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Real[2] Less than Temp_Real[1]
            • Then - Actions
              • Set Temp_Units[1] = (Picked unit)
              • Set Temp_Real[1] = Temp_Real[2]
            • Else - Actions
          • Custom script: call RemoveLocation(udg_Temp_Point[2])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Units[1] Equal to No unit
        • Then - Actions
          • Custom script: call RemoveLocation(udg_Temp_Point[1])
          • Custom script: set udg_Temp_Point[1] = null
          • Skip remaining actions
        • Else - Actions
      • Set Temp_Point[3] = (Position of (Targeted unit))
      • Set Temp_Real[1] = ((Distance between Temp_Point[1] and Temp_Point[3]) / 1000.00)
      • Unit - Create 1 Guardsman for (Owner of (Triggering unit)) at Temp_Point[3] facing Default building facing degrees
      • Unit - Add a (0.25 + Temp_Real[1]) second Generic expiration timer to (Last created unit)
      • Set Temp_Real[1] = (Real((20 x (Random integer number between 0 and 10))))
      • Set Temp_Real[2] = (Real((20 x (Random integer number between 1 and 18))))
      • Set Temp_Point[2] = (Temp_Point[1] offset by Temp_Real[1] towards Temp_Real[2] degrees)
      • Unit - Order (Triggering unit) to Neutral Tinker - Pocket Factory Temp_Point[2]
      • Set Temp_Units[1] = No unit
      • Custom script: call RemoveLocation(udg_Temp_Point[1])
      • Custom script: call RemoveLocation(udg_Temp_Point[2])
      • Custom script: call RemoveLocation(udg_Temp_Point[3])
      • Custom script: set udg_Temp_Point[1] = null
      • Custom script: set udg_Temp_Point[2] = null
      • Custom script: set udg_Temp_Point[3] = null
  • Unit Group - Pick every unit in (Units within 1500.00 of Temp_Point[1]) and do (Actions)
    • Loop - Actions
The 1500 here is just a random number. You should set it to [range_of_Artillery - 200]
I also did not add any condition to the unit group, because I don't know what they should be attacking. You should add them yourself (like the (Matching Unit) is alive = true; etc.)

In theory, what this should do is that when Archer acquires a target, he will create under that target TargetCircle and randomly selected a point in 200 range around the target and shoot his arrow (= Artillery) there. Once he finishes casting, he will pick up a new closest unit and do the same once again. If he picks no unit, he will stop.


That should be all. Hope I didn't forget anything.
 
Status
Not open for further replies.
Top