Forum > Serverside Modding

[QUESTION] New gossip UI

(1/2) > >>

osler:
Hello!
I was wondering how to make a different gossip UI for a specific creature.
I have tried a hack in GossipFrame.lua, but it didn´t work:

--- Code: ---elseif ( event == "GOSSIP_SHOW" and GetUnitName(self.unit) == "UNIT NAME") then
--- End code ---

Now I´m thinking about doing it mostly server-side:
Server sends something to clients, which is interpreted in GossipFrame.lua and displays the modified gossip frame, but I have no idea how to do it.
Can anybody give me some advice?

stoneharry:
You could have the npc have a server side on click event (gossip start), then send them a invisible message (or better, an addon message).

When the client receives this message it opens the relevant frame.

osler:
Thanks, I wil try that metohd :D

osler:
I´ve managed to make the npc whisp a message (actually is a visible message) but I think that my Lua code is wrong...
Also I have tried PLAYER_PLEVEL_UP event, and doesn´t work.


--- Code: ---    local f = CreateFrame('frame')
    f:RegisterEvent('PLAYER_LEVEL_UP')
    f:RegisterEvent('CHAT_MSG_SYSTEM')
     
    f:SetScript('OnEvent', function(self, event, ...)
        if event == 'PLAYER_LEVEL_UP' then
            SendChatMessage("I've leveled up!")
        else
            local message = ...
            if message:find('Welcome...") then
                SendChatMessage('Somebody has whispered me!')
            end
        end
    end)

--- End code ---

--EDIT--
I´ve updated my code, and now the level up event works correctly, but whisper doesn´t.

--EDIT #2--
Now it works ONLY when a player whispers. Is there any othe event which fires when a creature whispers?

osler:
I´m still modifying my code, but I doesn´t work. I think that it´s becaouse the event:

--- Code: ---    local f = CreateFrame('frame')
    f:RegisterEvent('PLAYER_LEVEL_UP')
    f:RegisterEvent('CHAT_MSG_WHISPER')
    f:RegisterEvent("PLAYER_TARGET_CHANGED");
     
    f:SetScript('OnEvent', function(self, event, ...)
        if event == 'PLAYER_LEVEL_UP' then
            SendChatMessage("I've leveled up!")
        elseif event == 'CHAT_MSG_WHISPER' then
            local message = ...
            if message:find('This is a test') then
                SendChatMessage('Somebody has whispered me!')
            end
        end
    end)

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version