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

How to make units travel in diff. directions

Status
Not open for further replies.
Level 45
Joined
Feb 27, 2007
Messages
5,578
Make a dummy unit in the OE with the right model for the arrow. Give it the ability 'locust', which makes it untargetable and unselectable. When you want to make an arrow, create one of the dummy units for the right player facing the right direction. To move it (periodically in some sort of loop probably) use:
  • Set Temp_Point = <some point, however you get it>
  • Unit - Move <arrow unit> to Temp_Point
  • Custom script: call RemoveLocation(udg_Temp_Point) //write udg_ plus your variable name, capitalization matters, use _ for spaces
The above clears the point leak that would naturally occur if you did something like "Center of (Playable map area)". For damaging you will have to use the "cause unit to damage unit" function on groups, and clearing their leaks is similar. We use DamagedGroup to keep track of which units have already taken damage from the spell and don't pick them again.
  • -------- When the spell is first cast --------
  • Unit Group - Clear DamagedGroup
  • -------- In the periodic move trigger --------
  • Set TempGroup = Units within R of TempPoint matching (Matching unit is not in group TempGroup) equal to true AND (matching unit is an enemy blah blah...)
  • Unit Group - Pick every unit in TempGroup and do (actions)
    • Loop - Actions
      • Unit - Cause <arrow unit> to damage (picked unit) for D damage of attack type Spells and damage type Normal
      • Unit - Add (picked unit) to DamagedGroup
  • Custom script: call DestroyGroup(udg_TempGroup)
If you are not going to be saving the group to use later you can instead do:
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick all units within R of TempPoint matching (Matching unit is not in group TempGroup) equal to true AND (matching unit is an enemy blah blah...) and do Actions
    • Loop - Actions
  • -------- Nothing else to do, it cleans itself up automatically --------
 
Status
Not open for further replies.
Top