• 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.

Help with moving empty players

Level 3
Joined
Apr 29, 2024
Messages
30
Hi I want to move empty players or "left" players to the new region ive made "gg_rct_Region_089". When a lot of empty players or left players die they can form a circle, and people could get stuck. So I want to move the empty players to the corner which is the new location ive made. But I dont know how to do it. I dont want to teleport them, just have them move physically to the new region.

JASS:
function Trig_Good_Unit_dies_Actions takes nothing returns nothing
local location loc = GetRectCenter(gg_rct_Region_089)
if(udg_OnlyOneMode==false)then
call TriggerSleepAction(5)

if((UnitHasItemOfTypeBJ(GetDyingUnit(),'I02K')==false))then
call ReviveHeroLoc(GetDyingUnit(),GetRectCenter(udg_rect89),false)
call SetUnitState(GetDyingUnit(),UNIT_STATE_MANA,(GetUnitState(GetDyingUnit(),UNIT_STATE_MAX_MANA)/ 5)+1000)
set udg_unit18=GetDyingUnit()
call TriggerExecute(udg_trigger612)
call UnitAddItemByIdSwapped('I02K',GetDyingUnit())
call DisplayTimedTextToForce(GetForceOfPlayer(GetOwningPlayer(GetDyingUnit())),10.00,"|cffffcc00King Yama:|r Welcome to the other world. Since you have done good deeds in your life, I will allow you to return to Earth... that is, if I still have some tickets left. If not, then I guess you'll have to remain here until I do. Behind me is Snake Way. If you reach the end of it, you can be trained by King Kai.")

else
call DisplayTimedTextToForce(GetForceOfPlayer(GetOwningPlayer(GetDyingUnit())),10.00,"|cffffcc00King Yama:|r Oh dear. You just died, when you were already dead! It's going to take me some time to return you to this dimension...")
call TriggerSleepAction(20.00)
call ReviveHeroLoc(GetDyingUnit(),GetRectCenter(udg_rect89),false)
call SetUnitState(GetDyingUnit(),UNIT_STATE_MANA,(GetUnitState(GetDyingUnit(),UNIT_STATE_MAX_MANA)/ 5)+1000)
call DisplayTimedTextToForce(GetForceOfPlayer(GetOwningPlayer(GetDyingUnit())),10.00,"|cffffcc00King Yama:|r Welcome back to the other world. Try not to die again this time!")
endif
endif
endfunction
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I dont want to teleport them, just have them move physically to the new region.
So you want them to issue a Move order to the new region after they revive?

Your Players should be stored inside Player Groups at the start of the game. These Player Groups tell you whether they're actively playing the game or not:
  • Player Setup
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to User
            • Then - Actions
              • -------- Track our Users regardless of their status: --------
              • Player Group - Add (Picked player) to All_Users
              • -------- --------
              • -------- Track Users who are playing the game in one group and Users who were never playing the game or left in another group: --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked player) slot status) Equal to Is playing
                • Then - Actions
                  • -------- This User is playing the game: --------
                  • Player Group - Add (Picked player) to Active_Users
                  • Trigger - Add to Player Leaves Game <gen> the event (Player - (Picked player) leaves the game)
                • Else - Actions
                  • -------- This User either left the game or was never playing to begin with: --------
                  • Player Group - Add (Picked player) to Inactive_Users
            • Else - Actions
When a Player leaves the game you need to manage the Player Groups to ensure that they're now "inactive" instead of "active":
  • Player Leaves Game
    • Events
    • Conditions
    • Actions
      • -------- Events are added to this trigger in Player Setup --------
      • Player Group - Remove (Triggering player) from Active_Users.
      • Player Group - Add (Triggering player) to Inactive_Users
      • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Triggering player)) + has |cffff0000left|r the game.)
Now whenever a Hero revives we can check to see if they're "inactive" and issue them an Order to move out of the way:
  • Player Revives
    • Events
      • Unit - A unit enters ReviveHere <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Owner of (Triggering unit)) is in Inactive_Users.) Equal to True
    • Actions
      • -------- The Hero's owner has left the game -> Order them to move out of the way so they don't block our active Users --------
      • Unit - Order (Triggering unit) to Move To (Center of LeaversGoHere <gen>)

So these Player Groups give you dynamic control of who you interact with in ALL of your other triggers:

1) Interact with all users who are currently playing the game:
  • Player Group - Pick every player in Active_Users and do (Actions)
    • Loop - Actions
2) Interact with all inactive users, this means leavers and those who were never playing (unused):
  • Player Group - Pick every player in Inactive_Users and do (Actions)
    • Loop - Actions
3) Interact with all users, regardless of whether they're playing, left, or unused:
  • Player Group - Pick every player in All_Users and do (Actions)
    • Loop - Actions
If you have CPU/Neutral players that are meant to use these systems then you'll want to account for them as well.
 

Attachments

  • Player Groups and Leavers.w3m
    20.2 KB · Views: 5
Last edited:
Top