Replaced worker mine gold from rally point

sunshinex3

You can change this now in User CP.
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?
 

sunshinex3

You can change this now in User CP.
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
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.
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
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.
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
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.
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
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.
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
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.
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 The Helper:
    it is all percolating man
  • The Helper The Helper:
    TheHelper.net #1!
  • Wizard Wizard:
    #1
  • The Helper The Helper:
    LOL I love this place
  • Wizard Wizard:
    ;D
  • Wizard Wizard:
    We all do.
  • O Old Mountain Shadow:
    So what is next for thehelper.net? Is there a new set goals yet?
  • The Helper The Helper:
    yes we are going to be expanding
    +1
  • The Helper The Helper:
    help more people
  • The Helper The Helper:
    thank you for asking Old Mountain Shadow hell ya@
  • The Helper The Helper:
    Look at Mountain Shadow in the chat!
  • The Helper The Helper:
    welcome to thehelper.net
  • O Old Mountain Shadow:
    thanks although I'm really kind of regretting this name lol ... is there a way to change it out or will I need to make a new account?
    +1
  • Wizard Wizard:
    One of us can change it for you, I believe. Just send me a PM on what you want.
  • Ghan Ghan:
    Some day we should get the feature where you can change your own name.
  • Wizard Wizard:
    Soon!
  • The Helper The Helper:
    did the mountain shadow get his name changed? personally I think Old Mountain Shadow is a kickass name
  • The Helper The Helper:
    but what do i know lol
  • Wizard Wizard:
    No they haven't had their name changed, it is badass xD
    +1
  • O Old Mountain Shadow:
    Thanks, lol! I haven't quite come up with a good new one yet. I was gonna default to one of my older usernames: Cha Zui = tea drunk in Chinese but then decided it too didn't quite fit right. I'm not asian lol... But I am tall, and old spirited which is sort of where the Old Mountain Shadow came about.
  • O Old Mountain Shadow:
    Either way I appreciate the willingness to help me change it! Should I discover something better I'll swap it, but for now ill stay with what I got.
  • The Helper The Helper:
    If you want a change like they said earlier just let us know
    +1
  • Ghan Ghan:
    Patched and rebooted the server this morning.
  • Ghan Ghan:
  • The Helper The Helper:
    dam pwnkit what a name probably perfectly describes it

    Staff online

    • Ghan
      Administrator - Servers are fun

    Members online

    Affiliates

    Hive Workshop NUON Dome
    Top