You will need to add some things at the end of your .lua so the script knows which npc you're talking about, this will teach you some basics, with a cheesy example, and how to remove events on bosses (so the players are not in combat once the creature is dead).
You can name the .lua file whatever you want, as long as the things inside are correct, I'm very tired, so some of these may be mistakes, correct me if i'm wrong, please!
Feel free to change the messages.
PM me if you need some more help, I'm a noob to scripting, but I think I've got the basics down.
For gossip NPCs add:
Code:
RegisterUnitGossipEvent(NPC ID GOES HERE, 1, "On_Gossip")
RegisterUnitGossipEvent(NPC ID GOES HERE, 2, "Gossip_Submenus")
end
For bosses:
Code:
function CreatureNameGoesHereWithCaps_OnCombat(pUnit, Event)
local RandomTalk=math.random(1, 3);
if RandomTalk == 1 then
pUnit:SendChatMessage(14, 0, "rarr you pulled me")
elseif RandomTalk == 2 then
pUnit:SendChatMessage(14, 0, "im cummin to getch ye")
elseif RandomTalk == 3 then
pUnit:SendChatMessage(14, 0, "it's a one in three chance to see this message, personally, i think this one is the best, arn't you lucky")
end
end
function CreatureNameGoesHereWithCaps_OnDied(pUnit, Event)
pUnit:SendChatMessage(14, 0, "oh noes im deads")
pUnit:RemoveEvents()
end
function CreatureNameGoesHereWithCaps_OnLeaveCombat(pUnit, Event)
pUnit:SendChatMessage(14, 0, "this is what i yell when i leave combat, like when players wipe or run away!")
pUnit:RemoveEvents()
end
function CreatureNameGoesHereWithCaps_OnKilledTarget(pUnit, Event)
local RandomText=math.random(1, 3)
if RandomText == 1 then
pUnit:SendChatMessage(14, 0, "pwned")
elseif RandomText == 2 then
pUnit:SendChatMessage(14, 0, "this is what i yell when i kill somthing")
elseif RandomText == 3 then
pUnit:SendChatMessage(14, 0, "l2p")
end
end
RegisterUnitEvent(NPC ID GOES HERE, 1, "CreatureNameGoesHereWithCaps_OnCombat")
RegisterUnitEvent(NPC ID GOES HERE, 2, "CreatureNameGoesHereWithCaps_OnLeaveCombat")
RegisterUnitEvent(NPC ID GOES HERE, 3, "CreatureNameGoesHereWithCaps_OnKilledTarget")
RegisterUnitEvent(NPC ID GOES HERE, 4, "CreatureNameGoesHereWithCaps_OnDied")
end
Good Luck!