Printing when a player has died in raid chat.
So in my race addon its important to know when someone dies and have that announced to raid chat by the raid leader and i think im going about this all wrong.
In the OnPlayerDead function: It checks if a race is in progress (GnomeRunner.raceInProgress). If a race is in progress, it announces the player's death using GnomeRunner.AnnouncePlayerDeath(playerName) in the raid chat. It also sends an addon message (PLAYER_DEAD: playerName) to the raid leader using C_ChatInfo.SendAddonMessage. This way, when a player dies, the addon both announces it in the raid chat and sends an addon message to the raid leader. The raid leader's addon can then listen for these messages and handle them accordingly. Code:
-- New function to announce player deaths in raid chat Code:
-- Modify the existing OnPlayerDead function |
You can use PLAYER_DEAD when the user has died. For raid/party members, I'd rather track their health by UNIT_HEALTH to detect if/when they die than rely on addon messages. It's hardly secure by any means. Any knowledgeable user can block them or send fake messages. If you insist on using addon chat messages, at least check using the sender name from CHAT_MSG_ADDON instead of including it in the message. At the very least, it'll provide a barrier from one person sending a message that a competitor has died.
I speak from experience of having made an addon message sniffer tool specifically to monitor messages going in and out of the local machine as part of a development toolkit. |
i still don't think im doing this right. Please forgive me this is my first time coding in Lua. Now the player see's the Debug message in that they died but its just got getting back to the raid leader so they can tell the raid someone died while updating how many people have died so far if you'd like to review the entire code https://github.com/kajuvra/GnomeRunner/
Code:
C_ChatInfo.RegisterAddonMessagePrefix(GnomeRunner.addonPrefix) Code:
function GnomeRunner.OnUnitHealth(unit) Code:
-- Part of the code to receive the message and play the sound |
I don't see anything standing out at the moment. I'd suggest making sure you have error alerts turned on, I think they're off by default.
The command is /console scriptErrors 1 PS: Quote:
|
You could also see if Bugsack and Buggrabber find anything.
|
Have you tested that part with it whispering *player* to see if it whispers back to you ( assuming you are testing it ). If that appears to work in place of the GnomeRunner.raidLeader value. Have you double checked that that value equates to a valid value for the command ?
|
All times are GMT -6. The time now is 12:20 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI