• 🏆 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!

[Trigger] Movement Trigger

Status
Not open for further replies.
Level 17
Joined
Jun 17, 2010
Messages
2,275
  • Movment Trigger
    • Events
      • Unit - A unit enters Spawn Point <gen>
      • Unit - A unit enters Movement Point 1 <gen>
      • Unit - A unit enters Movement Point 2 <gen>
      • Unit - A unit enters Movement Point 3 <gen>
      • Unit - A unit enters Movement Point 4 <gen>
      • Unit - A unit enters Movement Point 5 <gen>
      • Unit - A unit enters Movement Point 6 <gen>
      • Unit - A unit enters Movement Point 7 <gen>
      • Unit - A unit enters Movement Point 8 <gen>
      • Unit - A unit enters Movement Point 9 <gen>
      • Unit - A unit enters Movement Point 10 <gen>
      • Unit - A unit enters Movement Point 11 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Spawn Point <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To MovementPoint[1]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Movement Point 1 <gen> contains (Triggering unit)) Equal to True
            • Then - Actions
              • Unit - Order (Triggering unit) to Move To MovementPoint[2]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Movement Point 2 <gen> contains (Triggering unit)) Equal to True
                • Then - Actions
                  • Unit - Order (Triggering unit) to Move To MovementPoint[2]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Movement Point 3 <gen> contains (Triggering unit)) Equal to True
                    • Then - Actions
                      • Unit - Order (Triggering unit) to Move To MovementPoint[3]
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Movement Point 4 <gen> contains (Triggering unit)) Equal to True
                        • Then - Actions
                          • Unit - Order (Triggering unit) to Move To MovementPoint[4]
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Movement Point 5 <gen> contains (Triggering unit)) Equal to True
                            • Then - Actions
                              • Unit - Order (Triggering unit) to Move To MovementPoint[5]
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Movement Point 6 <gen> contains (Triggering unit)) Equal to True
                                • Then - Actions
                                  • Unit - Order (Triggering unit) to Move To MovementPoint[6]
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Movement Point 7 <gen> contains (Triggering unit)) Equal to True
                                    • Then - Actions
                                      • Unit - Order (Triggering unit) to Move To MovementPoint[7]
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Movement Point 8 <gen> contains (Triggering unit)) Equal to True
                                        • Then - Actions
                                          • Unit - Order (Triggering unit) to Move To MovementPoint[8]
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Movement Point 9 <gen> contains (Triggering unit)) Equal to True
                                            • Then - Actions
                                              • Unit - Order (Triggering unit) to Move To MovementPoint[9]
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Movement Point 10 <gen> contains (Triggering unit)) Equal to True
                                                • Then - Actions
                                                  • Unit - Order (Triggering unit) to Move To MovementPoint[10]
                                                • Else - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Movement Point 11 <gen> contains (Triggering unit)) Equal to True
                                                    • Then - Actions
                                                      • Unit - Order (Triggering unit) to Move To MovementPoint[11]
                                                    • Else - Actions
Well when they spawn, they move to point 1, then stop.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set UnitType = Chicken
      • Set SpawnDelay = ((Default movement speed of SpawnedUnit) x 0.01)
      • Set MovementPoint[1] = (Center of Movement Point 1 <gen>)
      • Set MovementPoint[2] = (Center of Movement Point 2 <gen>)
      • Set MovementPoint[3] = (Center of Movement Point 3 <gen>)
      • Set MovementPoint[4] = (Center of Movement Point 4 <gen>)
      • Set MovementPoint[5] = (Center of Movement Point 5 <gen>)
      • Set MovementPoint[6] = (Center of Movement Point 6 <gen>)
      • Set MovementPoint[7] = (Center of Movement Point 7 <gen>)
      • Set MovementPoint[8] = (Center of Movement Point 8 <gen>)
      • Set MovementPoint[9] = (Center of Movement Point 9 <gen>)
      • Set MovementPoint[10] = (Center of Movement Point 10 <gen>)
      • Set MovementPoint[11] = (Center of Movement Point 11 <gen>)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Set (Picked player) Current gold to 10000
          • Player - Set (Picked player) Current lumber to 1
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility from (Position of Basic Builder 0004 <gen>) to a radius of 4000.00
Well i did as u see. How would i fix the starting before entering
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Ther enter region event may fire before the unit is actually inside the region. This would be the logical reason for the above to fail.

This is true.

You can fix it by creating overlapping regions. A smaller that triggers "unit enters region" and larger that is used to check "is unit in region". System 1 in attached map.

Or save regions into an array (which you have done) then update an integer of the array index of regions to move to. System 3 in attached map.

  • Untitled Trigger 002
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Custom script: call SaveInteger( udg_RectHash , GetHandleId(GetTriggerUnit()) , StringHash("moveTo") , 0 )
      • Set p1 = (Center of Region_Array_Enter[0])
      • Unit - Order (Triggering unit) to Move To p1
      • Custom script: call RemoveLocation(udg_p1)
  • Init 2
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Region_Array_Enter[0] = Region 003 <gen>
      • Set Region_Array_Enter[1] = Region 003 Copy <gen>
      • Set Region_Array_Enter[2] = Region 003 Copy 2 <gen>
      • For each (Integer loopA) from 0 to 2, do (Actions)
        • Loop - Actions
          • Trigger - Add to Enter 2 <gen> the event (Unit - A unit enters Region_Array_Enter[loopA])
  • Enter 2
    • Events
    • Conditions
    • Actions
      • Set u1 = (Triggering unit)
      • Custom script: set udg_i1 = LoadInteger( udg_RectHash , GetHandleId(udg_u1) , StringHash("moveTo") ) + 1
      • Custom script: call IssuePointOrder( udg_u1 , "attack" , GetRectCenterX(udg_Region_Array_Enter[udg_i1]) , GetRectCenterY(udg_Region_Array_Enter[udg_i1]) )
      • Custom script: call SaveInteger( udg_RectHash , GetHandleId(udg_u1) , StringHash("moveTo") , udg_i1 )


When you use an index that is not initialized, the unit goes to center of the map since the rect returns null. Press ESC to spawn a unit.

http://www.hiveworkshop.com/forums/pastebin.php?id=0yp7ks
 
Status
Not open for further replies.
Top