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

Faster moving units than GUI?

Status
Not open for further replies.
Level 4
Joined
Mar 5, 2006
Messages
46
I heard moving units through GUI is slow.

Can anyone convert this for me:

Periodic Event: Every 0.03 seconds

Action:
TempPoint = position of picked unit
TempPoint2 = TempPoint with 10 offset towards Facing of Picked unit degrees
Move picked unit to TempPoint2
*Removes TempPoint leaks*

I want to use the set unit X Jass function but i dont know how. Is it really faster?
 
Level 10
Joined
Jun 6, 2007
Messages
392
It can be done in gui:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
  • Spell1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • Set TempPoint = (Position of (Triggering Unit))
      • Set TempReal = 0.00
      • Hashtable - Save Handle OfTempPoint as 0 of (Key (Triggering Unit)) in Hash
      • Hashtable - Save TempReal as 1 of (Key (Triggering Unit)) in Hash
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Unit Group - Add (Triggering Unit) to Group
      • Trigger - Turn on Spell2 <gen>
  • Spell2
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • Set TempPoint = (Load 0 of (Key (Picked unit)) in Hash)
          • Set TempReal = (Load 1 of (Key (Picked unit)) from Hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempReal Less than 50
            • Then - Actions
              • Set TempPoint2 = (TempPoint offset by 10 towards Facing of Picked Unit)
              • Unit - Move Picked Unit instantly to TempPoint2
              • Hashtable - Save Handle OfTempPoint2 as 0 of (Key (Picked unit)) in Hash
              • Custom script: call RemoveLocation(udg_TempPoint)
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hash
              • Set TempReal = (TempReal + 1.00)
              • Hashtable - Save TempReal as 1 of (Key (Picked unit)) in Hash
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Unit Group - Remove (Picked unit) from Group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
Spell2 isn't initially on. Group is a unit group variable and Hash is a hashtable variable (obviously). If you make more abilities using hashtables, you must have different variables for each of them. TempPoint, TempPoint2 and TempReal variables are temporary, so they can be used with other spells too. Hope this made any sence :).
 
Level 10
Joined
Jul 12, 2009
Messages
321
I want to use the set unit X Jass function but i dont know how. Is it really faster?
It really is faster, because it ignores collision.

The commands can be used in GUI via custom script:
  • Custom script: call SetUnitX(whichUnit, Xcoordinate)
  • Custom script: call SetUnitY(whichUnit, Ycoordinate)
The code you'd use for those values depends on what you're doing in your trigger. For example, (Picked unit) is GetEnumUnit() in JASS. For your trigger, it would be:
  • Custom script: call SetUnitX(GetEnumUnit(), GetLocationX(udg_TempPoint2))
  • Custom script: call SetUnitY(GetEnumUnit(), GetLocationY(udg_TempPoint2))
 
Status
Not open for further replies.
Top