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: 106

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.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top