• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

{How to remove a hero from a leaver?}

Status
Not open for further replies.
Level 8
Joined
Aug 1, 2008
Messages
420
^^ Title. :xxd:
Ive seen it before, but i cant find it now lol.
edit: sigh, nvm. Found it...
Oh: another question. If someone leaves, how would i remove their hero from the game? I was thinking put their hero in a variable when they choose it, then if a player leaves the game, remove the unit(variable). But then i would have to make 8 seperate triggers because theres 8 players in the game. How else could you do it?
 
Last edited:
Level 13
Joined
Mar 23, 2008
Messages
1,214
I guess you could make it with the if then/else trigger.
You make all heroes a variable yes.

  • Melee Initialization
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If ((Player 1 (Red) slot status) Equal to Has left the game) then do (Unit - Remove Red_Hero from the game) else do (Do nothing)
      • If ((Player 2 (Blue) slot status) Equal to Has left the game) then do (Unit - Remove Blue_Hero from the game) else do (Do nothing)

This is first time i wrap trigger tags on hive, hope it works :p

EDIT: It does :D You can just add more of those, if theres more players in the game :D
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
I hope this helps

  • RemoveLeaver
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • and so on...
    • Conditions
    • Actions
      • -------- If you want to remove all players units use functions below --------
      • -------- For this you will need a global group variable TempGroup --------
      • Set TempGroup = (Units owned by (Triggering player))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Custom script: call DestroyGroup(udg_TempGroup)
      • -------- If you want to remove just player's hero use following functions --------
      • -------- Make an unit array --------
      • -------- Store your heroes in that array with index matching to their owner's player number --------
      • -------- Like This --------
      • Set Hero[1] = <Player_1_Hero>
      • Set Hero[2] = <Player_2_Hero>
      • -------- Now to the removal --------
      • -------- For the index I am using function Player - Player Number --------
      • Unit - Remove Hero[(Player number of (Triggering player))] from the game
 
Level 8
Joined
Aug 1, 2008
Messages
420
Thx, ill see if it works when i have a tester :/
+rep
(cant give rep, says i need to spread some around >.<)
 
Status
Not open for further replies.
Top