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

attack unit

Status
Not open for further replies.
Level 28
Joined
Jan 26, 2007
Messages
4,789
  • Unit - Order (Unit) to Attack-Move To (Point)
For a single unit

  • Unit Group - Order (UnitGroup) to Attack-Move To (Point)
For group of units
I'm sorry for correcting you, but I believe this would be a better option:

Spawn Trigger: (I also show this because I am irritated by how many people make them inefficient).

  • Spawn
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Integer = (Integer + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer mod 10) Equal to 0
        • Then - Actions
          • Set loc[1] = (Center of (Playable map area))
          • Unit - Create 1 Footman for Player 1 (Red) at loc[1] facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_loc[1])
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer mod 25) Equal to 0
        • Then - Actions
          • Set loc[1] = (Center of (Playable map area))
          • Unit - Create 1 Knight for Player 1 (Red) at loc[1] facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_loc[1])
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer mod 50) Equal to 0
        • Then - Actions
          • Set loc[1] = (Center of (Playable map area))
          • Unit - Create 1 Rifleman for Player 1 (Red) at loc[1] facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_loc[1])
        • Else - Actions
This creates:
- 1 footman every 10 seconds
- 1 Knight every 25 seconds
- 1 Rifleman every 50 seconds

As you can see, all of your time-based events can go inside this trigger, it's very easy to add/change/remove anything.

Attack-move (in warcraft, this is done by clicking "attack" and then a location, if you didn't know yet).


  • AttackMove
    • Events
      • Unit - A unit enters (Current camera bounds)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
        • Then - Actions
          • Set loc[1] = (Center of Footy <gen>)
          • Unit - Order (Triggering unit) to Attack-Move To loc[1]
          • Custom script: call RemoveLocation(udg_loc[1])
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Knight
            • Then - Actions
              • Set loc[1] = (Center of Knights <gen>)
              • Unit - Order (Triggering unit) to Attack-Move To loc[1]
              • Custom script: call RemoveLocation(udg_loc[1])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Triggering unit)) Equal to Rifleman
                • Then - Actions
                  • Set loc[1] = (Center of Rifles <gen>)
                  • Unit - Order (Triggering unit) to Attack-Move To loc[1]
                  • Custom script: call RemoveLocation(udg_loc[1])
                • Else - Actions
This should work perfectly fine ^^
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
I'm sorry for correcting you, but I believe this would be a better option:

Spawn Trigger: (I also show this because I am irritated by how many people make them inefficient).

  • Spawn
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Integer = (Integer + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer mod 10) Equal to 0
        • Then - Actions
          • Set loc[1] = (Center of (Playable map area))
          • Unit - Create 1 Footman for Player 1 (Red) at loc[1] facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_loc[1])
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer mod 25) Equal to 0
        • Then - Actions
          • Set loc[1] = (Center of (Playable map area))
          • Unit - Create 1 Knight for Player 1 (Red) at loc[1] facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_loc[1])
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Integer mod 50) Equal to 0
        • Then - Actions
          • Set loc[1] = (Center of (Playable map area))
          • Unit - Create 1 Rifleman for Player 1 (Red) at loc[1] facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_loc[1])
        • Else - Actions
This creates:
- 1 footman every 10 seconds
- 1 Knight every 25 seconds
- 1 Rifleman every 50 seconds

As you can see, all of your time-based events can go inside this trigger, it's very easy to add/change/remove anything.

Attack-move (in warcraft, this is done by clicking "attack" and then a location, if you didn't know yet).


  • AttackMove
    • Events
      • Unit - A unit enters (Current camera bounds)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Footman
        • Then - Actions
          • Set loc[1] = (Center of Footy <gen>)
          • Unit - Order (Triggering unit) to Attack-Move To loc[1]
          • Custom script: call RemoveLocation(udg_loc[1])
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Knight
            • Then - Actions
              • Set loc[1] = (Center of Knights <gen>)
              • Unit - Order (Triggering unit) to Attack-Move To loc[1]
              • Custom script: call RemoveLocation(udg_loc[1])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Triggering unit)) Equal to Rifleman
                • Then - Actions
                  • Set loc[1] = (Center of Rifles <gen>)
                  • Unit - Order (Triggering unit) to Attack-Move To loc[1]
                  • Custom script: call RemoveLocation(udg_loc[1])
                • Else - Actions
This should work perfectly fine ^^

He asked how to make the creeps move & attack :wink:
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
wouldn't it be more efficient to make the periodic event every 5 seconds and use mod 2, 5 and 10 for the unit creation? ;)
In my case: yes (I already knew someone was going to make this witty comment).
But seeing he doesn't know how to make a correct attack-move-trigger, I did it like this because his spawn rates will be different and he might just copy the event.

He asked how to make the creeps move & attack
That's why it's called "Attack-move", smarty :wink:
Units will move to a location and attack everyone they encounter, thus it's exactly what he asked.
 
Level 8
Joined
Aug 21, 2009
Messages
333
In my case: yes (I already knew someone was going to make this witty comment).
But seeing he doesn't know how to make a correct attack-move-trigger, I did it like this because his spawn rates will be different and he might just copy the event.
lol ;)

That's why it's called "Attack-move", smarty :wink:
Units will move to a location and attack everyone they encounter, thus it's exactly what he asked.
He is aware that this is exactly what was asked. He is saying that he had answered the guy's question already.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
He is aware that this is exactly what was asked. He is saying that he had answered the guy's question already.
Ahh, like that... you could interpret his comment in (at least) 2 ways, I thought he ment something like "He wanted the units to move AND attack".
Well, let's just stop posting here and see what operation thinks ^^
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
sry but your trigger dont work
when i train a builder, it turn to player 11 (im player1)
but unit created by a trigger( warrior ) dont turn to player 11

In that case, you're doing it wrong
It works perfectly fine for me, I've tested it and I can prove this with a video if you really want.

On the other hand, I don't get your problem... try to speak more... English.
 
Status
Not open for further replies.
Top