| 07-01-2003, 04:19 PM | #1 |
I'm looking to put a message out to other players in the game when a player leaves, and maybe give control of that unit to his teammates. I know this is possible, but i can't figure it out. Game - Defeat works when a player is defeated (and I think disconnected), but didn't seem to react when a player simply left. The best idea I've received was to put a timer in with a conditional checking to see what players were still in the game... but that seems pretty inefficient to me. Is there a better way? Any help would be appreciated. |
| 07-01-2003, 07:45 PM | #2 |
Unlike some say, there is a fully working "player leaves event". I am unsure its available in GUI triggers. This said i am sure it is available in Jass as i actually use it ^^ You can look in common.j to check what this event looks like. Regards |
| 07-01-2003, 08:04 PM | #3 |
I'm not sure what it was... there's 2 types. Use a periodic event for it, it's listed under actions. Something like this: If Player Status (player 1 red) equal to (has left the game) equal to true then.... and there's also one: If Player slot status (player 1 red) equal to (is playing) equal to false then.... I kinda lost it though, but it's something like that ://// |
| 07-13-2003, 04:33 AM | #4 |
use umswe... it has exactly that. Altho if u have patch 1.10 or ft ull hafta wait till they get it working |
| 07-13-2003, 03:04 PM | #5 |
Actually, I did what download said, because I'm not ready to invest the time it'd take to start learning JASS. I have a timer that fires every five seconds and checks to see who all is in the game... and I keep an array stating who's left and who's still there as well, just so it doesn't keep repeating who has left every five seconds. I think it was too much work for such a simple task... would've been a lot easier if blizzard would just put the PlayerLeaves event in the GUI. :ggani: |
| 07-13-2003, 03:28 PM | #6 |
Guest | Hmm im not sure what your problem is: PlayerQuit Events Player - Player 1 (Red) leaves the game with a defeat Player - Player 2 (Blue) leaves the game with a defeat Player - Player 3 (Teal) leaves the game with a defeat Player - Player 4 (Purple) leaves the game with a defeat Player - Player 5 (Yellow) leaves the game with a defeat Player - Player 6 (Orange) leaves the game with a defeat Player - Player 7 (Green) leaves the game with a defeat Player - Player 8 (Pink) leaves the game with a defeat Conditions Actions Game - Display to (All players) for 30.00 seconds the text: ((Name of (Triggering player)) + |c00ff8000left the game like a little whiny girl.|r) This works fine for me. And I am sure you can put the Actions of sharing stuff also there. |
| 08-02-2003, 06:59 AM | #7 |
I don't think "leaving with a defeat" counts when a person disconnects or quits. ChrydGod, could you enlighten us with how a person could use the Jass "player leaves" event? Perhaps as a line of custom code? |
| 08-02-2003, 07:45 AM | #8 |
the "defeat" event will fire when a player leaves only if its in a melee map. the event you ar looking for is EVENT_PLAYER_LEAVES, and it goes something like this: call RegisterPlayerEvent(trigger name, player, EVENT_PLAYER_LEAVES) to find the acual text (i wont have war3 infront of me for 2 more weeks), get blizzard.j and common.j from your war3.mpq then search for the text "EVENT_PLAYER_LEAVES" then copy that line into your map initialization (via action - custom script) except change the name of the rtrigger to whatever your player-leaves trigger is (i.e. trig_Player_Leaves for a trigger entitled Player Leaves). then change the name of the player from index_player to whatever player you want to set the event for (i.e. player(1) would be player 1 (RED)) use for loops if you know how. |
| 08-02-2003, 08:07 AM | #9 |
I found EVENT_PLAYER_LEAVE (no "s") in the Scripts\Blizzard.j from war3x.mpq Still sorting out how to use it, but I thought I'd clear up exactly where it was first. EDIT: This is what I've got. Pardon my ignorance, but how do I use it? // Set a trigger to fire whenever this player leaves set trig = CreateTrigger() call TriggerRegisterPlayerEvent(trig, indexPlayer, EVENT_PLAYER_LEAVE) call TriggerAddAction(trig, function MeleeTriggerActionPlayerLeft) |
| 08-02-2003, 09:45 AM | #10 |
Please disregard my last post, i was high. call TriggerRegisterPlayerEvent(trig, indexPlayer, EVENT_PLAYER_LEAVE) this is exactly what you need. To use this simply make a "Player Leaves JASS" Trigger that all it does is "action - run Trigger Player Leaves checking conditions" then convert it to custom text and above where it sais the "TriggerAddAction(blah blah)" insert "call TriggerRegisterPlayerEvent(trig_Player_Leaves, [whatever player you want i.e. Player(1)], EVENT_PLAYER_LEAVE)" (you can do this multiple times for all players). Now you can just edit the Player Leaves Trigger just like you usually do. For people who know at least a little JASS: use call TriggerRegisterPlayerEvent([Trigger Name], [Player], EVENT_PLAYER_LEAVE) heres a function for those who know how to use it (no editor infront of me for two weeks... some formalities might be a bit off): Code:
function AnyPlayerLeaves takes trigger targetTrig returns nothing
local integerA = 1
loop
call TriggerRegisterPlayerEvent(targetTrig, ConvertPlayerIndextoPlayer(integerA), EVENT_PLAYER_LEAVE)
set integerA = integerA + 1
exitwhen integerA = 12
endloop
endfunctionif someone could fix this up that'd be great. |
