hey all im trying to get an NPC to talk by using LUA but i dont know how to Script it
if you could post the Script i Will +Rep. Please and thanks!
hey all im trying to get an NPC to talk by using LUA but i dont know how to Script it
if you could post the Script i Will +Rep. Please and thanks!
Try this guide, it might help you:
http://www.mmowned.com/forums/ascent...lua-101-a.html
Like how script it? Say something without entering combat or saying something when he enters combat yadadada.
think its something like this ur searching:
-Credits to Maven @ arcEmu
but if it wasnt a announcer, then u can do so he talk on combat, dead etc,--Written by Maven. Enjoy!
local timebetweenannounce = 45000 --Time between messeges the NPC sends
local restarttime = 120000 --How long you want until it restarts all over again.
local npcid = 99999 --The NPC's ID
--Change the folowing text to whatever you want
local message1 = "Hello! Welcome to our server!"
local message2 = "Please don't PvP Here!"
local message3 = "Have fun! Don't Forget to vote for us!"
local message4 = "Visit our site at [Site URL]"
local message5 = "This was made by Maven for ArcEmu!"
function Announcer_Yell(pUnit, Event)
pUnit:SendChatMessage(12, 0, message1)
pUnit:RemoveEvents();
pUnit:RegisterEvent("Announcer2_Yell", timebetweenannounce, 0)
end
function Announcer2_Yell(pUnit, Event)
pUnit:SendChatMessage(12 ,0, message2)
pUnit:RemoveEvents();
pUnit:RegisterEvent("Announcer3_Yell", timebetweenannounce, 0)
end
function Announcer3_Yell(pUnit, Event)
pUnit:SendChatMessage(12, 0, message3)
pUnit:RemoveEvents();
pUnit:RegisterEvent("Announcer4_Yell", timebetweenannounce, 0)
end
function Announcer4_Yell(pUnit, Event)
pUnit:SendChatMessage(12, 0, message4)
pUnit:RemoveEvents();
pUnit:RegisterEvent("Announcer5_Yell", timebetweenannounce, 0)
end
function Announcer5_Yell(pUnit, Event)
pUnit:SendChatMessage(12, 0, message5)
pUnit:RemoveEvents();
pUnit:RegisterEvent("Announcer2_Yell", restarttime, 0)
end
function Announcer_Start(pUnit, Event)
pUnit:RegisterEvent("Announcer_Yell", 1000, 0)
end
RegisterUnitEvent(npcid, 6, "Announcer_Start")
And there is the last option to do when you right click them / speak to them, then you just cn add this SQLfunction MOB_Combat(Unit, Event)
Num1 = 0
Unit:SendChatMessage(14, 0, "TXTXTXT?")
Unit:RegisterEvent("MOB_Phase1", 13000, 0)
end
RegisterUnitEvent(NPC ID, 1, "MOB_Combat")
DELETE FROM `npc_text` WHERE (`entry` = 'X');
INSERT INTO `npc_text` VALUES ('X', '1', 'Should Kil\'Jaeden rise up through the Sunwell our world will be thrown into a war the likes of which has not been seen for 10,000 years!', 'Should Kil\'Jaeden rise up through the Sunwell our world will be thrown into a war the likes of which has not been seen for 10,000 years!', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
DELETE FROM `npc_gossip_textid` WHERE (`creatureid` = 'X');
INSERT INTO `npc_gossip_textid` VALUES ('X', 'XX');
Last edited by Exacute; 07-26-2008 at 07:07 PM.
Thanks Exacute That helped alot i needed an anouncer +Rep!!