HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Player Leaves Game Events

07-17-2006, 05:41 AM#1
StRoNgFoE_2000
I'm simply trying to make a trigger for when a player leaves the game it of course, fires the trigger. For the longest time I've been using periodic events of every 1 second, and I'm trying to eliminate using them. Six triggers are being fired every second which isn't necessary. I tried using the following events but when a player leaves, the trigger doesn't execute.

Trigger:
Player - Player 1 (Red) Leaves
Player - Player 1 (Red) leaves the game

Is there something I'm doing wrong? Below is the trigger I tried to make this work with. I tried using both events at the same time, and I tried using them one at a time and it just doesn't work.

Trigger:
Player 1
Collapse Events
Player - Player 1 (Red) Leaves
Player - Player 1 (Red) leaves the game
Conditions
Collapse Actions
Game - Display to (All players) for 15.00 seconds the text: ((|c00ff0000 + ((Name of Player 1 (Red)) + |r)) + has left the game.)
Game - Display to Force1 for 15.00 seconds the text: |c003399ffIncome ha...
Player Group - Remove Player 1 (Red) from Force1
Set TempGroup = (Units in (Playable map area) owned by Player 1 (Red))
Unit Group - Pick every unit in TempGroup and do (Unit - Change ownership of (Picked unit) to (Random player from Force1) and Change color)
Custom script: call DestroyGroup (udg_TempGroup)
Multiboard - Set the text for (Last created multiboard) item in column 1, row 2 to (|c00ff0000 + *Left Game*)
-------- DIVIDE THE INCOME --------
Custom script: if (GetPlayerSlotState(Player(1))==PLAYER_SLOT_STATE_PLAYING) and (GetPlayerSlotState(Player(2))==PLAYER_SLOT_STATE_PLAYING) then
Set Income[2] = (Income[2] + (Income[1] / 2))
Set Income[3] = (Income[3] + (Income[1] / 2))
Custom script: elseif (GetPlayerSlotState(Player(1))==PLAYER_SLOT_STATE_PLAYING) and (GetPlayerSlotState(Player(2))==PLAYER_SLOT_STATE_EMPTY) or (GetPlayerSlotState(Player(2))==PLAYER_SLOT_STATE_LEFT) then
Set Income[2] = (Income[2] + Income[1])
Custom script: elseif (GetPlayerSlotState(Player(2))==PLAYER_SLOT_STATE_PLAYING) and (GetPlayerSlotState(Player(1))==PLAYER_SLOT_STATE_EMPTY) or (GetPlayerSlotState(Player(1))==PLAYER_SLOT_STATE_LEFT) then
Set Income[3] = (Income[3] + Income[1])
Custom script: endif
Set Income[1] = 0
Multiboard - Set the text for (Last created multiboard) item in column 2, row 2 to (String(Income[1]))
Multiboard - Set the text for (Last created multiboard) item in column 2, row 3 to (String(Income[2]))
Multiboard - Set the text for (Last created multiboard) item in column 2, row 4 to (String(Income[3]))
Multiboard - Set the text for (Last created multiboard) item in column 3, row 2 to 0
Multiboard - Set the text for (Last created multiboard) item in column 4, row 2 to 0
Trigger - Run Check All <gen> (ignoring conditions)
Trigger - Turn off (This trigger)

I've never tested without using Vex's optimizer so maybe it messes up the event somehow.
07-17-2006, 08:53 AM#2
flyingsnow
Which player did you played?
If you play the role of player1, nothing will happen when you leave of course.
07-17-2006, 05:00 PM#3
The)TideHunter(
Quote:
Originally Posted by flyingsnow
Which player did you played?
If you play the role of player1, nothing will happen when you leave of course.

Good point, the only way to test is Multiplayer.
Also, put the event:
Trigger:
Events
Player - Player 1 (Red) leaves the game with a defeat
07-17-2006, 08:07 PM#4
StRoNgFoE_2000
Quote:
Originally Posted by flyingsnow
Which player did you played?
If you play the role of player1, nothing will happen when you leave of course.

Well yes, I have a trigger for each player, so I run a lil online test, and ask someone to leave before it is over. I never tested without vex's optimizer because I don't want people to open it up. I guess I was looking for a quick answer but I can run a few more online tests with some people I can trust that won't spread it unprotected.
07-17-2006, 10:41 PM#5
SentryIII
Trigger:
Player - Player 1 (Red) leaves the game

This event definitely works since I use it in all my maps.

Aside from the other things that everyone else has mentioned, your trigger might be turned off.
07-18-2006, 01:36 AM#6
StRoNgFoE_2000
I'm not that noob to not know whether a trigger is on or off. I figured it out after all.. when using vex's optimizer the trigger doesn't fire, without it does fire. I have almost all options checked and haven't felt like going through and finding out which one is doing it... so, I'm not sure.
01-21-2007, 03:06 AM#7
Kalvorod
I was having that exact problem, and I also use Vex's optimizer. I'll check for a more recent version, otherwise I'll have to find the option that causes it.
01-21-2007, 10:43 AM#8
The)TideHunter(
This thread is over 4 months old...
01-21-2007, 10:50 AM#9
Captain Griffen
- It isn't Vex's optimiser.
- Player(1) returns GUI's player 2.
- Player X leaves the game works.
01-21-2007, 12:10 PM#10
blu_da_noob
We here at WC3C do not partake in the vile act of thread necromancy. Let the dead rest in peace.