• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

unit spawn after construction

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
Hello :)

Has somebody an idea on how to make a trigger, which makes that after a building is constructed some units spawn and patrol around its location.
I don't mean "automatic unit construction", I want the units to spawn around the building. The issue is, since there is no condition like "after a building has finished constructing" I don't know what condition to use to initiate the following "spawn" action.

Thanks!
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
nope. this event is exactly for buildings. try it. the way to match the unit to it (besides triggering unit - don't remember if that targets the building or builder) is constructed structure.

Edit: yeah, triggering unit is also the building.

Edit: here you go:

  • spawn patrol
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Farm
    • Actions
      • Set VariableSet BuildingLoc = (Position of (Triggering unit))
      • Set VariableSet Angle = 0.00
      • Set VariableSet PatrolRoute[0] = (BuildingLoc offset by 500.00 towards Angle degrees.)
      • Set VariableSet PatrolRoute[1] = (BuildingLoc offset by 500.00 towards (Angle + 120.00) degrees.)
      • Set VariableSet PatrolRoute[2] = (BuildingLoc offset by 500.00 towards (Angle + 240.00) degrees.)
      • Unit - Create 1 Archer for Player 1 (Red) at PatrolRoute[0] facing Default building facing degrees
      • Unit - Order (Last created unit) to Patrol To PatrolRoute[1]
      • Unit - Create 1 Archer for Player 1 (Red) at PatrolRoute[1] facing Default building facing degrees
      • Unit - Order (Last created unit) to Patrol To PatrolRoute[2]
      • Unit - Create 1 Archer for Player 1 (Red) at PatrolRoute[2] facing Default building facing degrees
      • Unit - Order (Last created unit) to Patrol To PatrolRoute[0]
check out the attached map
 

Attachments

  • spawn and patrol.w3m
    17.8 KB · Views: 16
Last edited:
Level 7
Joined
May 30, 2018
Messages
290
nope. this event is exactly for buildings. try it. the way to match the unit to it (besides triggering unit - don't remember if that targets the building or builder) is constructed structure.

Edit: yeah, triggering unit is also the building.

Edit: here you go:

  • spawn patrol
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Farm
    • Actions
      • Set VariableSet BuildingLoc = (Position of (Triggering unit))
      • Set VariableSet Angle = 0.00
      • Set VariableSet PatrolRoute[0] = (BuildingLoc offset by 500.00 towards Angle degrees.)
      • Set VariableSet PatrolRoute[1] = (BuildingLoc offset by 500.00 towards (Angle + 120.00) degrees.)
      • Set VariableSet PatrolRoute[2] = (BuildingLoc offset by 500.00 towards (Angle + 240.00) degrees.)
      • Unit - Create 1 Archer for Player 1 (Red) at PatrolRoute[0] facing Default building facing degrees
      • Unit - Order (Last created unit) to Patrol To PatrolRoute[1]
      • Unit - Create 1 Archer for Player 1 (Red) at PatrolRoute[1] facing Default building facing degrees
      • Unit - Order (Last created unit) to Patrol To PatrolRoute[2]
      • Unit - Create 1 Archer for Player 1 (Red) at PatrolRoute[2] facing Default building facing degrees
      • Unit - Order (Last created unit) to Patrol To PatrolRoute[0]
check out the attached map
Awesome, thanks I'll try it ! Seems like I was wrong there, sorry mate :)
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
I don't know if it was really necessary. this way you can customize it easily (by just altering that variable you can move all the points if you want to). Also the main reason I did it is bc the angles in wc3 confuse me. I think it doesn't have a full 360 degrees but rather 180 degrees plus 180 negative degrees or something like that. so by doing it this way I hoped that it would internally transform it into the right amount of degrees. Again, maybe not necessary at all.

[the reason I think it works like this - once I tested it with a trigger where I print out the angle between two units, and even though I walked all around the other unit - I think the output was always a positive value under 180]
 
Status
Not open for further replies.
Top