• 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] Teleport Players Hero Back

Status
Not open for further replies.
Level 5
Joined
Jan 5, 2019
Messages
108
Can someone help me make a Trigger when ever player 12 units dies in a region, Player 1,2,3,4,5,6 get instant teleported back to another region ?
 
Level 5
Joined
Mar 5, 2015
Messages
135
That sounds like a pretty easy fix ;) Is it just one unit for the other players, or all units?
 
Level 5
Joined
Mar 5, 2015
Messages
135
First you need to create all the variables. So I've create 4 variables here:
  • hero: unit variable
  • fightRegion: a region variable for the region in which you want to check all units are dead
  • baseRegion: a region variable for your base
  • tempGroup: unit group variableto handle group leaks
  • tempPoint: a point variable to handle point leaks
You can switch out any of the variables if you have already declared what you need.
Alright so first setup the variables:

  • SettingUpVariables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set baseRegion = Region 002 <gen>
      • Set fightRegion = Region 001 <gen>
      • Set hero = Footman 0011 <gen>
Here you can chance the hero or the regions which are used.

Then the trigger which detects if all units are dead:

  • AllUnitsAreDead
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set tempGroup = (Units in fightRegion matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Equal to 0
        • Then - Actions
          • Set tempPoint = (Center of baseRegion)
          • Unit - Move hero instantly to (Center of baseRegion)
          • Custom script: call RemoveLocation(udg_tempPoint)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)
That should do the trick ;) Feel free to ask if you need some explanation for some of the stuff.
 

Attachments

  • unitsInRegionAreDead.w3x
    18.9 KB · Views: 32
Level 5
Joined
Jan 5, 2019
Messages
108
First you need to create all the variables. So I've create 4 variables here:
  • hero: unit variable
  • fightRegion: a region variable for the region in which you want to check all units are dead
  • baseRegion: a region variable for your base
  • tempGroup: unit group variableto handle group leaks
  • tempPoint: a point variable to handle point leaks
You can switch out any of the variables if you have already declared what you need.
Alright so first setup the variables:

  • SettingUpVariables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set baseRegion = Region 002 <gen>
      • Set fightRegion = Region 001 <gen>
      • Set hero = Footman 0011 <gen>
Here you can chance the hero or the regions which are used.

Then the trigger which detects if all units are dead:

  • AllUnitsAreDead
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set tempGroup = (Units in fightRegion matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Equal to 0
        • Then - Actions
          • Set tempPoint = (Center of baseRegion)
          • Unit - Move hero instantly to (Center of baseRegion)
          • Custom script: call RemoveLocation(udg_tempPoint)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)
That should do the trick ;) Feel free to ask if you need some explanation for some of the stuff.

Thanks alot it worked flawless! :) But is there away to Set hero Variable to be player 1 2 3 4 5 6 and also do so no matter what hero they have picked it would effect them ?
 
Level 5
Joined
Mar 5, 2015
Messages
135
Yeah, there definitely is! I have 2 suggestions here (I prefer the latter option personally, but believe the first option is what you're asking for):

Option 1
This removes the "hero" variable entirely, and instead looks at all the units in the map, and moves them to the 'baseRegion' if it's a Hero and if it's owner by either of the players you suggested.

Init trigger
  • SettingUpVariables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set baseRegion = Region 002 <gen>
      • Set fightRegion = Region 001 <gen>
Move trigger
  • AllUnitsAreDead
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set tempGroup = (Units in fightRegion matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Equal to 0
        • Then - Actions
          • Set tempGroup = (Units in fightRegion matching (((Matching unit) is A Hero) Equal to True))
          • Set tempPoint = (Center of baseRegion)
          • Unit Group - Pick every unit in tempGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Owner of (Picked unit)) Equal to Player 1 (Red)
                      • (Owner of (Picked unit)) Equal to Player 2 (Blue)
                      • (Owner of (Picked unit)) Equal to Player 3 (Teal)
                      • (Owner of (Picked unit)) Equal to Player 4 (Purple)
                      • (Owner of (Picked unit)) Equal to Player 5 (Yellow)
                      • (Owner of (Picked unit)) Equal to Player 6 (Orange)
                • Then - Actions
                  • Unit - Move (Picked unit) instantly to tempPoint
                  • Custom script: call RemoveLocation(udg_tempPoint)
                • Else - Actions
        • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)



Option 2
The second option is the one I prefer because it still keeps to moving a specific set of unit variables. If you create a larger map you would doubtless need to have a variable to keep track of each of the Player Heroes anyway, where this option would fit within such a system. It's more precise, if you will.

Init trigger:

  • SettingUpVariables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set baseRegion = Region 002 <gen>
      • Set fightRegion = Region 001 <gen>
      • Set hero[0] = Blademaster 0011 <gen>
      • Set hero[1] = Far Seer 0016 <gen>
      • Set hero[2] = Shadow Hunter 0014 <gen>
      • Set hero[3] = Shadow Hunter 0015 <gen>
      • Set hero[4] = Tauren Chieftain 0017 <gen>
      • Set hero[5] = Far Seer 0013 <gen>

Moving trigger
  • AllUnitsAreDead
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set tempGroup = (Units in fightRegion matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Equal to 0
        • Then - Actions
          • Set tempPoint = (Center of baseRegion)
          • For each (Integer A) from 0 to 5, do (Actions)
            • Loop - Actions
              • Unit - Move hero[(Integer A)] instantly to tempPoint
          • Custom script: call RemoveLocation(udg_tempPoint)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)
 

Attachments

  • moveAllHeroes_Option_2.w3x
    21 KB · Views: 27
  • moveAllHeroes_Option_1.w3x
    21.3 KB · Views: 37
Level 5
Joined
Jan 5, 2019
Messages
108
Yeah, there definitely is! I have 2 suggestions here (I prefer the latter option personally, but believe the first option is what you're asking for):

Option 1
This removes the "hero" variable entirely, and instead looks at all the units in the map, and moves them to the 'baseRegion' if it's a Hero and if it's owner by either of the players you suggested.

Init trigger
  • SettingUpVariables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set baseRegion = Region 002 <gen>
      • Set fightRegion = Region 001 <gen>
Move trigger
  • AllUnitsAreDead
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set tempGroup = (Units in fightRegion matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Equal to 0
        • Then - Actions
          • Set tempGroup = (Units in fightRegion matching (((Matching unit) is A Hero) Equal to True))
          • Set tempPoint = (Center of baseRegion)
          • Unit Group - Pick every unit in tempGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Owner of (Picked unit)) Equal to Player 1 (Red)
                      • (Owner of (Picked unit)) Equal to Player 2 (Blue)
                      • (Owner of (Picked unit)) Equal to Player 3 (Teal)
                      • (Owner of (Picked unit)) Equal to Player 4 (Purple)
                      • (Owner of (Picked unit)) Equal to Player 5 (Yellow)
                      • (Owner of (Picked unit)) Equal to Player 6 (Orange)
                • Then - Actions
                  • Unit - Move (Picked unit) instantly to tempPoint
                  • Custom script: call RemoveLocation(udg_tempPoint)
                • Else - Actions
        • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)



Option 2
The second option is the one I prefer because it still keeps to moving a specific set of unit variables. If you create a larger map you would doubtless need to have a variable to keep track of each of the Player Heroes anyway, where this option would fit within such a system. It's more precise, if you will.

Init trigger:

  • SettingUpVariables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set baseRegion = Region 002 <gen>
      • Set fightRegion = Region 001 <gen>
      • Set hero[0] = Blademaster 0011 <gen>
      • Set hero[1] = Far Seer 0016 <gen>
      • Set hero[2] = Shadow Hunter 0014 <gen>
      • Set hero[3] = Shadow Hunter 0015 <gen>
      • Set hero[4] = Tauren Chieftain 0017 <gen>
      • Set hero[5] = Far Seer 0013 <gen>

Moving trigger
  • AllUnitsAreDead
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • Set tempGroup = (Units in fightRegion matching ((((Matching unit) is alive) Equal to True) and ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempGroup) Equal to 0
        • Then - Actions
          • Set tempPoint = (Center of baseRegion)
          • For each (Integer A) from 0 to 5, do (Actions)
            • Loop - Actions
              • Unit - Move hero[(Integer A)] instantly to tempPoint
          • Custom script: call RemoveLocation(udg_tempPoint)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_tempGroup)


I think i will make my map so people can double click on the hero they wanna play and then Option 2 seems really good. Thanks a lot its a really big help :)
 
Level 5
Joined
Mar 5, 2015
Messages
135
I think i will make my map so people can double click on the hero they wanna play and then Option 2 seems really good. Thanks a lot its a really big help :)

Just so! :D Glad to be of help! Good luck with your project
 
Level 5
Joined
Jan 5, 2019
Messages
108
Just so! :D Glad to be of help! Good luck with your project

^^ i made my new setup but then i encountered a new problem i'm not sure how to fix. because now every time all units dies in the arena region. all the heroes that did not get picked also gets teleported to the base : / they are set to be Neutral passive race, you can also see my map if you want, the trigger folder is named ( TP Back to base event )
 

Attachments

  • Neptix Map.w3x
    332.9 KB · Views: 31
Last edited:
Status
Not open for further replies.
Top