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

Looping ship transport

Status
Not open for further replies.
Level 8
Joined
Dec 12, 2010
Messages
280
Here this might work. You'll have to set the Point variables > pos of unit > shipyard.

  • Untitled Trigger 001
    • Events
      • Unit - A unit comes within 256.00 of <select shipyard here>
    • Conditions
      • ((Triggering unit) is Mechanical) Equal to True
    • Actions
      • Set Temp_Point = (Position of <Your shipyard>)
      • Set Ship_unit = (Triggering unit)
      • Unit - Order Ship_unit to Unload All At Temp_Point
      • Wait 60.00 game-time seconds
      • Set Temp_Point = (Position of <Go to Shipyard here>)
      • Unit - Order (Ship_unit) to Move To Temp_Point
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Set Ship_unit = No unit
It would probably be better to use a seperate trigger with a one shot timer that expires in 60 seconds instead of the wait. If you do that just remove the actions Wait and below and put on your timer trigger. Then add the action > run trigger <Your Timer Trigger> to this one.

Would be good if there was a condition to check amount of units in a transport but I don't think there is.
 
Last edited:
Level 10
Joined
Apr 22, 2010
Messages
421
@ironman7: If there is only that one type of transport ship, then you should not use "((Triggering unit) is Mechanical) Equal to True" but instead "Unit type of (Trrigering Unit) Equal to (Transport Ship) Equal to true".
The reason is that if it is a orpg and he has a unit with a mechanical classification, this could cause unnecessary memory usage.
 
Level 13
Joined
Sep 13, 2010
Messages
550
It's just for 2 shipyards but works
  • Ship Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Points --------
      • Set Pois[1] = Region 000 <gen>
      • Set Pois[2] = Region 001 <gen>
      • Set Pois[3] = Region 002 <gen>
      • Set Pois[4] = Region 003 <gen>
      • Set Pois[5] = Region 004 <gen>
      • Set Pois[6] = Region 005 <gen>
      • Set Pois[7] = Region 006 <gen>
      • Set Pois[8] = Region 007 <gen>
      • -------- Enter --------
      • Set Pois[1000] = Region 009 <gen>
      • Set Pois[1001] = Region 008 <gen>
      • -------- Leave --------
      • Set Pois[1002] = Region 011 <gen>
      • Set Pois[1003] = Region 010 <gen>
      • -------- Ship --------
      • Set Ship = Human Transport Ship 0000 <gen>
      • -------- Amount of points --------
      • Set Ship_Int[1] = 8
      • -------- Other setup --------
      • Set Ship_Int[2] = -1
      • Set Ship_Int[3] = 1
      • -------- Other funcs --------
      • For each (Integer A) from 1 to Ship_Int[1], do (Actions)
        • Loop - Actions
          • Trigger - Add to Ship loop <gen> the event (Unit - A unit enters Pois[(Integer A)])
      • Set Temp_Loc = (Center of Pois[1])
      • Unit - Move Ship instantly to Temp_Loc
      • Custom script: call RemoveLocation( udg_Temp_Loc )
      • Trigger - Add to Ship enter <gen> the event (Unit - A unit enters Pois[1000])
      • Trigger - Add to Ship enter <gen> the event (Unit - A unit enters Pois[1001])
  • Ship loop
    • Events
    • Conditions
      • (Entering unit) Equal to Ship
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • Ship_Int[3] Equal to 1
              • Ship_Int[3] Equal to Ship_Int[1]
        • Then - Actions
          • Unit Group - Pick every unit in UnitsInShip and do (Actions)
            • Loop - Actions
              • Unit - Unhide (Picked unit)
              • Unit - Unpause (Picked unit)
          • Unit Group - Remove all units from UnitsInShip
          • Wait 60.00 seconds
          • Custom script: set udg_Ship_Int[2] = -udg_Ship_Int[2]
        • Else - Actions
      • Set Ship_Int[3] = (Ship_Int[3] + Ship_Int[2])
      • Set Temp_Loc = (Center of Pois[Ship_Int[3]])
      • Unit - Order Ship to Move To Temp_Loc
      • Custom script: call RemoveLocation( udg_Temp_Loc )
  • Ship enter
    • Events
    • Conditions
    • Actions
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Pois[1000] contains (Entering unit)) Equal to True
                  • Ship_Int[3] Equal to 1
              • And - All (Conditions) are true
                • Conditions
                  • (Pois[1001] contains (Entering unit)) Equal to True
                  • Ship_Int[3] Equal to Ship_Int[1]
        • Then - Actions
          • Unit Group - Add (Entering unit) to UnitsInShip
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Pois[1000] contains (Entering unit)) Equal to True
            • Then - Actions
              • Set Temp_Loc = (Center of Pois[1002])
              • Unit - Move (Entering unit) instantly to Temp_Loc
              • Custom script: call RemoveLocation( udg_Temp_Loc )
            • Else - Actions
              • Set Temp_Loc = (Center of Pois[1003])
              • Unit - Move (Entering unit) instantly to Temp_Loc
              • Custom script: call RemoveLocation( udg_Temp_Loc )
          • Unit - Pause (Entering unit)
          • Unit - Hide (Entering unit)
        • Else - Actions
 

Attachments

  • Ship.w3x
    26.6 KB · Views: 62
Status
Not open for further replies.
Top