How to move 1 random unit instead of all?

Malli

New Member
Reaction score
5
Hello everyone,

I previously had a problem with my PvP Event trigger, now I have got it to work but it teleports every Hero from each team instead of 1 Hero from each team, any ideas of how I can do this please?

Here is my trigger:

Code:
PVP Event 1
    Events
        Time - Elapsed game time is 20.00 seconds
    Conditions
    Actions
        Unit - Pause all units
        For each (Integer A) from 1 to (Number of players), do (Actions)
            Loop - Actions
                Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across PVP Visibility <gen>
        For each (Integer A) from 1 to (Number of players), do (Actions)
            Loop - Actions
                Camera - Pan camera for (Player((Integer A))) to (Center of PVP Visibility <gen>) over 0.00 seconds
        Game - Display to (All players) the text: In 60 Seconds an it...
        Wait 1.50 game-time seconds
        Game - Display to (All players) the text: The winner of this ...
        Wait 1.00 game-time seconds
       [COLOR="Red"] Set PlayerGroup2 = (All allies of Player 11 (Dark Green))
        Set PlayerGroup3 = (All allies of Player 12 (Brown))[/COLOR]
        Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A Hero) Equal to True
                        ((Picked unit) is A structure) Not equal to True
                        ((Picked unit) is Summoned) Not equal to True
                    Then - Actions
                        [COLOR="Red"]Unit - Move (Random unit from (Units in Players West <gen> owned by (Random player from PlayerGroup2))) instantly to (Center of West PVP player <gen>)[/COLOR]
                        Unit - Set life of (Picked unit) to 100.00%
                        Unit - Set mana of (Picked unit) to 100.00%
                        Unit - Unpause (Picked unit)
                    Else - Actions
        Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A Hero) Equal to True
                        ((Picked unit) is A structure) Not equal to True
                        ((Picked unit) is Summoned) Not equal to True
                    Then - Actions
                        [COLOR="Red"]Unit - Move (Random unit from (Units in Players East <gen> owned by (Random player from PlayerGroup3))) instantly to (Center of East PVP player <gen>)[/COLOR]
                        Unit - Set life of (Picked unit) to 100.00%
                        Unit - Set mana of (Picked unit) to 100.00%
                        Unit - Unpause (Picked unit)
                    Else - Actions
        Custom script:   call DestroyForce(udg_PlayerGroup2)
        Custom script:   call DestroyForce(udg_PlayerGroup3)
        Wait 60.00 game-time seconds
        Unit - Unpause all units
        Item - Create Circlet of Nobility at (Center of Item Spawn <gen>)

I think the red bits are the problem, i just cant think of how to get around this.
Thank you and Respect,

(*$malli$*)
 

Malli

New Member
Reaction score
5
I can only see an option to pic every unit.... I will show a picture.

*EDIT* Can a mod merge my two posts with the attachment please?
Respect,

(*$malli$*)
 

Malli

New Member
Reaction score
5
I couldn't attach the image when I pressed "edit". (Probably because I did the initial post in "quick reply"). Anyway here it is.
Respect,

(*$malli$*)
 

Attachments

  • SelfHelp1.JPG
    SelfHelp1.JPG
    149.9 KB · Views: 109

Ryuu

I am back with Chocolate (:
Reaction score
64
All the random units are moving because you made the Unit Group action.

Optimized it for you (I missed out on the leaks, you could remove them yourself):

Code:
PVP Event 1
    Events
        Time - Elapsed game time is 20.00 seconds
    Conditions
    Actions
        Unit - Pause all units
        For each (Integer A) from 1 to (Number of players), do (Actions)
            Loop - Actions
                Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across PVP Visibility <gen>
        For each (Integer A) from 1 to (Number of players), do (Actions)
            Loop - Actions
                Camera - Pan camera for (Player((Integer A))) to (Center of PVP Visibility <gen>) over 0.00 seconds
        Game - Display to (All players) the text: In 60 Seconds an it...
        Wait 1.50 game-time seconds
        Game - Display to (All players) the text: The winner of this ...
        Wait 1.00 game-time seconds
        Set PlayerGroup2 = (All allies of Player 11 (Dark Green))
        Set PlayerGroup3 = (All allies of Player 12 (Brown))
        Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A Hero) Equal to True
                        ((Picked unit) is A structure) Not equal to True
                        ((Picked unit) is Summoned) Not equal to True
                    Then - Actions
                        Unit - Move (Random unit from (Units in Players West <gen> owned by (Random player from PlayerGroup2))) instantly to (Center of West PVP player <gen>)
                        Unit - Set life of (Picked unit) to 100.00%
                        Unit - Set mana of (Picked unit) to 100.00%
                        Unit - Unpause (Picked unit)
                    Else - Actions
        Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A Hero) Equal to True
                        ((Picked unit) is A structure) Not equal to True
                        ((Picked unit) is Summoned) Not equal to True
                    Then - Actions
                        [COLOR="Red"]If (All Conditions are True) then (Then Actions) else (Else Actions)
                            If - Conditions
                                UnitCreated Not Equal to True
                            Then - Actions
                                Unit - Move (Random unit from (Units in Players East <gen> owned by (Random player from PlayerGroup3))) instantly to (Center of East PVP player <gen>)
                                Set UnitCreated = True
                            Else - Actions[/COLOR]
                        Unit - Set life of (Picked unit) to 100.00%
                        Unit - Set mana of (Picked unit) to 100.00%
                        Unit - Unpause (Picked unit)
                    Else - Actions
        Custom script:   call DestroyForce(udg_PlayerGroup2)
        Custom script:   call DestroyForce(udg_PlayerGroup3)
        Wait 60.00 game-time seconds
        Unit - Unpause all units
        Item - Create Circlet of Nobility at (Center of Item Spawn <gen>)
 

Malli

New Member
Reaction score
5
Thanks for reply :).

Is the UnitCreated a variable? if so is it an integer or a unit variable please?
Thank you and Respect,

(*$malli$*)
 

Ryuu

I am back with Chocolate (:
Reaction score
64
It is a boolean variable.

> I couldn't attach the image when I pressed "edit". (Probably because I did the initial post in "quick reply").

Click on 'Edit', then click on 'Go Advanced'.​
 

Malli

New Member
Reaction score
5
It WORKS!! +repp
Thanks very much Ryuu ;)

*Going to test if it works on BN*
*EDIT* One thing though is that no units pause, ill try and find my way around that. (Hopefully it wont take weeks)
Respect,

(*$malli$*)
 

Malli

New Member
Reaction score
5
Ok, I have noticed now that it rarely works, sometimes it might move 1 hero to the PvP arena but most of the time non at all, when I hosted the map on BN (the game is 5 players per team), the trigger didn't choose any heroes at all again. I want it so it chooses 1 hero from the West team and 1 hero from the East team.... Here is my trigger again:

Trigger:
  • PVP Event 1
    • Events
      • Time - Elapsed game time is 20.00 seconds
    • Conditions
    • Actions
      • Unit - Pause all units
      • For each (Integer A) from 1 to (Number of players), do (Actions)
        • Loop - Actions
          • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across PVP Visibility &lt;gen&gt;
      • For each (Integer A) from 1 to (Number of players), do (Actions)
        • Loop - Actions
          • Camera - Pan camera for (Player((Integer A))) to (Center of PVP Visibility &lt;gen&gt;) over 0.00 seconds
      • Game - Display to (All players) the text: In 60 Seconds an it...
      • Wait 1.50 game-time seconds
      • Game - Display to (All players) the text: The winner of this ...
      • Wait 1.00 game-time seconds
      • Set PlayerGroup2 = (All allies of Player 11 (Dark Green))
      • Set PlayerGroup3 = (All allies of Player 12 (Brown))
      • Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
              • ((Picked unit) is A structure) Not equal to True
              • ((Picked unit) is Summoned) Not equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • UnitCreated Not equal to True
                • Then - Actions
                  • Unit - Move (Random unit from (Units in Players West &lt;gen&gt; owned by (Random player from PlayerGroup2))) instantly to (Center of West PVP player &lt;gen&gt;)
                  • Set UnitCreated = True
                • Else - Actions
              • Unit - Set life of (Picked unit) to 100.00%
              • Unit - Set mana of (Picked unit) to 100.00%
              • Unit - Unpause (Picked unit)
            • Else - Actions
      • Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
              • ((Picked unit) is A structure) Not equal to True
              • ((Picked unit) is Summoned) Not equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • UnitCreated Not equal to True
                • Then - Actions
                  • Unit - Move (Random unit from (Units in Players East &lt;gen&gt; owned by (Random player from PlayerGroup3))) instantly to (Center of East PVP player &lt;gen&gt;)
                  • Set UnitCreated = True
                • Else - Actions
              • Unit - Set life of (Picked unit) to 100.00%
              • Unit - Set mana of (Picked unit) to 100.00%
              • Unit - Unpause (Picked unit)
            • Else - Actions
      • Custom script: call DestroyForce(udg_PlayerGroup2)
      • Custom script: call DestroyForce(udg_PlayerGroup3)
      • Wait 60.00 game-time seconds
      • Unit - Unpause all units
      • Item - Create Circlet of Nobility at (Center of Item Spawn &lt;gen&gt;)


P.S I dont even know what the UnitCreated variable means or does so I cant figure this one out on my own. Please help :confused:.
Respect,

(*$malli$*)
 

Malli

New Member
Reaction score
5
If anyone has any ideas that would be great, (this is the final hurdle before I can host my map).
Respect,

(*$malli$*)
 

wraithseeker

Tired.
Reaction score
122
Don't triple post read the rules.

I'll browsed through your code and saw this
Code:
Wait 1.00 game-time seconds

Wait real time? what if someone paused the game?
 

Malli

New Member
Reaction score
5
Sorry for the multpile posts :s (my thread was moving into the 2nd page).
So if I remove that 1 second do you think it will work? because I have tried so many different things, I hope it is.

P.S. Sorry again for tripple posting, I will edit this post with results. Also thanks for the reply.

*EDIT* Same still, it works 3/10 times. I thought a PvP trigger wouldn't be as complicated as this. Also I got told to do that UnitCreated Condition and I don't understand it, so I cannot edit that by myself unless I knew what it does. (I bet im starting to be annoying).
Respect,

(*$malli$*)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Set UnitGroup = Units in (Playable map) matching ((((Matching unit) is a Hero) equal to true) and (((Matching unit) belongs to an ally of Player 11) equal to true))
Set SingleUnitToMove = Random unit from UnitGroup

Do whatever you need with that unit, and repeat the entire thing for the other team.
 

Malli

New Member
Reaction score
5
Thanks very much AceHart, see how simple you make it look. It works perfect now!
True Respect,

(*$malli$*)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top