• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] How to move 1 random unit instead of all? Please help.

Status
Not open for further replies.
Level 2
Joined
Dec 23, 2008
Messages
4
Hi everybody,

I have had a problem for weeks and I have had no success in solving it. I posted a thread in TH.net and still no success.

What I'm trying to do

I have been trying to create a PvP event (trigger below). My map has two teams consisting of 5 players on each team. (can be 4v4, 3v3, 2v2, or 1v1). I want the trigger to move 1 random unit (Hero) from each team into the PvP arena, so that it is a 1v1 battle event.

The problem

I was told to add a "UnitCreated" variable into the trigger, now to begin with I don't have a clue what this is or does but it almost worked. About 3 or 4 out of 10 times my hero teleported to the PvP arena (in "test map" mode). When I go onto Battle Net and test it there 5v5, no Units (Heroes) are moved to the PvP arena at all.

The Trigger

  • PVP Event 1
    • Events
      • Time - Elapsed game time is 320.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
              • Unit - Move (Random unit from (Units in Players East <gen> owned by (Random player from PlayerGroup3))) instantly to (Center of East 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
      • 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 would greatly appreciate any help from you. If you require any more information I would be happy to tell you.
Respect,

(*$malli$*)
 
Level 13
Joined
Sep 29, 2008
Messages
672
you should create a unit group variable

your unit group pick are just the same with "Units in entire map"

try:

  • Set UnitGroup[1] = (Units in (Players West <gen>) owned by (Random player from PlayerGroup2))
  • Set UnitGroup[2] = (Units in (Players East <gen>) owned by (Random player from PlayerGroup3))
This groups is arrayed 1

then

  • Unit Group - Pick every unit in (UnitGroup[1])) and do (Actions)
    • Loop - Actions
      • Unit - Move (Picked unit) 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)
  • Unit Group - Pick every unit in (UnitGroup[2])) and do (Actions)
    • Loop - Actions
      • Unit - Move (Picked unit) instantly to (Center of East 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)
  • Custom script: call DestroyGroup(udg_UnitGroup[1])
  • Custom script: call DestroyGroup(udg_UnitGroup[2])
I think you should change your player groups to arrayed one too.
just a thought.
 
Last edited:
Status
Not open for further replies.
Top