• 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] Detect a leaving Player?

Status
Not open for further replies.
Level 3
Joined
Dec 18, 2004
Messages
30
I need a basic script to tell when a player leaves.

I have a trigger already, but it doesn't work.

Left And Destroy
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 4, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
Race[(Integer A)] Not equal to -1
Or - Any (Conditions) are true
Conditions
((Player((Integer A))) controller) Not equal to User
((Player((Integer A))) slot status) Not equal to Is playing
((Player((Integer A))) slot status) Equal to Has left the game
((Player((Integer A))) slot status) Equal to Is unused
Then - Actions
Race[(Integer A)]=-1
 
Level 2
Joined
Jan 20, 2007
Messages
18
u dont need to make it that complicated its quite easy

Events
Time - Every 2.00 seconds of game time

Conditons
NONE

Actions
if (All Conditons are True) then do (then Actions) else do (else actions)
If - Conditions
(Player 1 (Red) slot status) Equal to Is playing
Then - Actions
Set Players[1] = True
Else - Actions
Set Players[1] = True


to lazy to make it more complicated :grin:
 
Level 3
Joined
Dec 18, 2004
Messages
30
For the first thing you are setting Players[1] = true whether or not red is playing, which is a big error.

For the second thing, that doesn't seem to work, because I have that in my code, but it never detects them leave.
 
Level 9
Joined
Feb 3, 2006
Messages
326
Well, triggering this is simple and easy ill show you

TRIGGERS ONLY NOT JASS!!

Events
- Player leaves the Game
Conditions
- Leaving Player equal to (Player)
Actions
- Game Display text to all players (Player has left game)
- Set (Variable (this is the variable for player in Leaderboard)) To Left the game!!


You can do that for all of the players.

hope it helps :)
 
Level 2
Joined
Jan 20, 2007
Messages
18
Event

Time - Every 2.00 seconds of game

Conditon

Action
For each (Integer A) from 1 to 4, do (actions)
Loop - Actions
if (All Conditions is true) then do (Then Actions) else do (Else Actions)
If Condtions
((Player((interger A))) slot status) Equal to IS playing

Then - Actions
Set Players[(Interger A)] = True

Else Actions
Set Player[(Interger A)] = Flase

dont say this dont work coz i tried it out xD
 
Level 3
Joined
Dec 18, 2004
Messages
30
Uh

Ok there is a problem. I tried this and it didn't work. I'll show you the code:

Left And Destroy
Events
Player - Player 1 (Red) leaves the game
Player - Player 2 (Blue) leaves the game
Player - Player 3 (Teal) leaves the game
Player - Player 4 (Purple) leaves the game
Conditions
Actions
Player - Set name of (Triggering player) to (|cff666666 + ((Name of (Triggering player)) + |r))
Game - Display to (All players) the text: ((Name of (Triggering player)) + has left the game.)
 
Level 9
Joined
Feb 3, 2006
Messages
326
if u remove the changing player name it will work., but try a seperate trigger for each player, or make a load of if, then, else's one after the other like this:

Events -
Player 1 Leaves the game
Player 2 Leaves the game
Player 3 Leaves the game
Player 4 Leaves the game
Player 5 Leaves the game
Conditions -
Actions -
(If then else actions)
Conditions-
Leaving player equal to (Player 1)
Actions -
Game - Display to (All players) the text: ((Name of (Player 1 (Red))) + has left the game.)
Else Actions -
If,then,else actions (etc, etc)

you just do the same running off each one, then for the last one instead of going ifthenelse for Player 5, you put

Else Actions-
Do Nothing.
 
Last edited:
Level 11
Joined
Jul 12, 2005
Messages
764
You don't have include an other if-then-else check for this. The problem might be that you change a leaving player's name, and maybe cannot be changed. Try it this way:

Game - Display to (All players) the text: (|cff666666 + ((Name of (Triggering player)) + |r) + has left the game.)

And btw, the Do Nothing action is just a waste of space, it does not affect the trigger, it's like it isn't even there. So forget it...
 
Level 3
Joined
Dec 18, 2004
Messages
30
Hmm

Thanks for the help you guys, but changing the name of the player isn't the problem. it's the fact that the event never triggers. Changing the names to make them colored works fine, and I use that in other scripts.

I saw a post earlier that said that Vexorian's optimizer will mess up this trigger, and it will work unoptimized. I'm going to see if I can find a newer version of the optimizer, or turn off the option that corrupts the trigger from occuring. I'll post back when I find the solution.
 
Level 3
Joined
Dec 18, 2004
Messages
30
Don't worry

I figured it out, it was the optimizer. I was using v 2.3, but their already up to version 4.0

Using the new optimizer, it worked fine, though the color name change didn't, Looks like you were right about that haha.

Thanks for your help guys.
 
Status
Not open for further replies.
Top