Replaced worker mine gold from rally point

sunshinex3

You can change this now in User CP.
Reaction score
7
i can get a replaced unit to "move" to original units rally point
Trigger:
  • PEON
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Fel Peon (FelOrc)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in (Units in (Playable map area)).) Equal to True
        • Then - Actions
          • Set VariableSet TempPoint = (Rally-Point of (Triggering unit) as a point)
          • Unit - Replace (Trained unit) with a Fel Peon (FelOrc0.0) using The old unit's relative life and mana
          • Unit - Order (Last replaced unit) to Move To (Rally-Point of (Triggering unit) as a point)
          • Custom script: call RemoveLocation (udg_TempPoint)
        • Else - Actions


but its a worker unit and if the player wants it to mine gold or collect wood... well it wont because it was just issued the order to "move" to point... so what am i missing how do I get a replaced worker to harvest wood or mine gold from a rally point?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Try issuing a right-click command instead of a move command.
 

sunshinex3

You can change this now in User CP.
Reaction score
7
ok but it still saves point as a point, is their a way around that?

EDIT:
I tried it any way the unit stands next to the gold mine or tree its still counted as a "move to" order
Trigger:
  • PEON Copy
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Fel Peon (FelOrc)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in (Units in (Playable map area)).) Equal to True
        • Then - Actions
          • Set VariableSet TempPoint = (Rally-Point of (Triggering unit) as a point)
          • Unit - Replace (Trained unit) with a Fel Peon (FelOrc0.0) using The old unit's relative life and mana
          • Unit - Order (Last replaced unit) to Right-Click (Rally-Point of (Triggering unit) as a point)
          • Custom script: call RemoveLocation (udg_TempPoint)
        • Else - Actions
 
Last edited:

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
The trouble is that you don't know what the thing is where the rally point is set. Not going to be easy, then.

You could get clever and do something like "pick every unit in (units within 1 of rally point)" and see if you get anything returned.
In the case of a tree, you'd want to look for destructibles - there's a similar action something like "pick every destructible in circle and do actions" that might work.

Then, depending on whether you find anything in the groups returned from those pick functions, you can write some logic to figure out what to do with the unit.
 

sunshinex3

You can change this now in User CP.
Reaction score
7
damn so close.... the first part work whether it be to right click the destructible or right click gold mine or move to point.... but it never goes past the first and I don't know why...

Trigger:
  • PEON Copy
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Fel Peon (FelOrc)
    • Actions
      • Set VariableSet TempPoint = (Rally-Point of (Triggering unit) as a point)
      • Unit - Replace (Trained unit) with a Fel Peon (FelOrc0.0) using The old unit's relative life and mana
      • Unit Group - Pick every unit in (Units within 50.00 of TempPoint.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Gold Mine
            • Then - Actions
              • Unit - Order (Last replaced unit) to Right-Click (Picked unit)
            • Else - Actions
              • Destructible - Pick every destructible within 50.00 of TempPoint and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked destructible) Equal to (Rally-Point of (Triggering unit) as a destructible)
                    • Then - Actions
                      • Unit - Order (Last replaced unit) to Right-Click (Picked destructible)
                    • Else - Actions
                      • Unit - Order (Last replaced unit) to Move To TempPoint
      • Custom script: call RemoveLocation (udg_TempPoint)
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
If the "Pick every unit" part doesn't find any units, then it won't execute any of the actions underneath it, meaning it will never hit the "Else" part of the If statement. You'll need to pull the destructible section out to the same level as the unit section.
You could just create a quick boolean flag and toggle it in the unit section. If it has been toggled, then skip the destructible section.
 

sunshinex3

You can change this now in User CP.
Reaction score
7
do you mean give the peon(unit) an ability that can be toggled on and off and this will be a condition?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
No, I mean something like this:


Trigger:
  • PEON Copy
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Fel Peon (FelOrc)
    • Actions
      • Set VariableSet TempPoint = (Rally-Point of (Triggering unit) as a point)
      • Set VariableSet Flag = False
      • Unit - Replace (Trained unit) with a Fel Peon (FelOrc0.0) using The old unit's relative life and mana
      • Unit Group - Pick every unit in (Units within 50.00 of TempPoint.) and do (Actions)
        • Loop - Actions
          • Set VariableSet Flag = True
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Gold Mine
            • Then - Actions
              • Unit - Order (Last replaced unit) to Right-Click (Picked unit)
            • Else - Actions
      • If (All Conditions are True then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Flag Equal to False
        • Then - Actions
          • Destructible - Pick every destructible within 50.00 of TempPoint and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked destructible) Equal to (Rally-Point of (Triggering unit) as a destructible)
                • Then - Actions
                  • Unit - Order (Last replaced unit) to Right-Click (Picked destructible)
                • Else - Actions
                  • Unit - Order (Last replaced unit) to Move To TempPoint
        • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
 

sunshinex3

You can change this now in User CP.
Reaction score
7
never seen a flag before let me check that out, i tried this kinda thing with a integer system that didn't pan out.
Even Closer Now!!!!
your trigger gets gold and wood but if I'm telling the peon to "move to" location it stands there.
Trigger:
  • PEON Original Copy Copy
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Fel Peon (FelOrc)
    • Actions
      • Set VariableSet TempPoint = (Rally-Point of (Triggering unit) as a point)
      • Set VariableSet TempBool = False
      • Unit - Replace (Trained unit) with a Fel Peon (FelOrc0.0) using The old unit's relative life and mana
      • Unit Group - Pick every unit in (Units within 50.00 of TempPoint.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Gold Mine
            • Then - Actions
              • Set VariableSet TempBool = True
              • Unit - Order (Last replaced unit) to Right-Click (Picked unit)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempBool Equal to False
        • Then - Actions
          • Destructible - Pick every destructible within 50.00 of TempPoint and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked destructible) Equal to (Rally-Point of (Triggering unit) as a destructible)
                • Then - Actions
                  • Unit - Order (Last replaced unit) to Right-Click (Picked destructible)
                • Else - Actions
                  • Unit - Order (Last replaced unit) to Move To TempPoint
        • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
 
Last edited:

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Again, if there are no units or destructibles near the point (when the rally point is just out on the map somewhere), then it won't do anything in the Loop - Actions portion.
Try adding the flag toggle to the destructible section as well, then create another similar If/then/else block where you check if the flag is false again, and if it is, do the move to point command.
 

sunshinex3

You can change this now in User CP.
Reaction score
7
figured it!!! all you man this works i don't if its what your talking about but i bet its close
you did it!!! now that i have this figured out i can finally get the zerg dones to work tooo!!!! thank you so much!!!

Trigger:
  • PEON Original GoldWood Copy
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Fel Peon (FelOrc)
    • Actions
      • Set VariableSet TempPoint = (Rally-Point of (Triggering unit) as a point)
      • Set VariableSet TempBool = False
      • Set VariableSet TempBool2 = False
      • Unit - Replace (Trained unit) with a Fel Peon (FelOrc0.0) using The old unit's relative life and mana
      • Unit Group - Pick every unit in (Units within 50.00 of TempPoint.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Gold Mine
            • Then - Actions
              • Set VariableSet TempBool = True
              • Set VariableSet TempBool2 = True
              • Unit - Order (Last replaced unit) to Right-Click (Picked unit)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempBool Equal to False
        • Then - Actions
          • Destructible - Pick every destructible within 50.00 of TempPoint and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked destructible) Equal to (Rally-Point of (Triggering unit) as a destructible)
                • Then - Actions
                  • Set VariableSet TempBool2 = True
                  • Unit - Order (Last replaced unit) to Right-Click (Picked destructible)
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempBool2 Equal to False
        • Then - Actions
          • Unit - Order (Last replaced unit) to Move To TempPoint
        • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)

I'm not a programmer, are their any leaks in this?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
I'm not a programmer, are their any leaks in this?

Yeah, unit groups will leak. (Assuming none of that has been fixed in Reforged... I haven't done any research on that)
You should create a unit group variable, set it, do the Pick every unit actions, then remove it to clean up the data similar to what you've done with the point.

I don't actually recall if destructible groups leak. Probably search the forums here to find answers on that one.
 

sunshinex3

You can change this now in User CP.
Reaction score
7
Complete Trigger Allowing Replaced Unit to Use Training or Summoning Units Rally Point.
Trigger:
  • PEON Original GoldWood Copy
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Fel Peon (FelOrc)
    • Actions
      • Set VariableSet TempPoint = (Rally-Point of (Triggering unit) as a point)
      • Set VariableSet TempBool = False
      • Set VariableSet TempBool2 = False
      • Set VariableSet TempUnitGroup = (Units within 50.00 of TempPoint.)
      • Unit - Replace (Trained unit) with a Fel Peon (FelOrc0.0) using The old unit's relative life and mana
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Gold Mine
            • Then - Actions
              • Set VariableSet TempBool = True
              • Set VariableSet TempBool2 = True
              • Unit - Order (Last replaced unit) to Right-Click (Picked unit)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempBool Equal to False
        • Then - Actions
          • Destructible - Pick every destructible within 50.00 of TempPoint and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked destructible) Equal to (Rally-Point of (Triggering unit) as a destructible)
                • Then - Actions
                  • Set VariableSet TempBool2 = True
                  • Unit - Order (Last replaced unit) to Right-Click (Picked destructible)
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempBool2 Equal to False
        • Then - Actions
          • Unit - Order (Last replaced unit) to Move To TempPoint
        • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call DestroyGroup(udg_TempUnitGroup)

Thax a lot Ghan!!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top