PDA

View Full Version : Mutiple Npc(s) Announcer(s)!



QQrofl
13-01-09, 02:11 PM
Hey guys! Well, I'm going to release something cool today! It's going to be a mutiple announcer npc's. Why Npc(s)? Well it's a huge script which you can put alot of npc's to announce at least 4-5 npc's. I will show you how to edit it: NOTE: THE THINGS IN RED YOU NEED TO CHANGE


--[[

-- ]]

--NPCNAMEHERE
RegisterUnitEvent(Npc Spawn ID, 18, "NPCNAMEHERE")
RegisterUnitEvent(Npc Spawn ID, 4, "NPCNAMEHERE_Died")

function NPCNAMEHERE_Died(Unit, event, player)
Unit:RemoveEvents()
end

function NPCNAMEHERE(Unit, event, player)
Unit:RegisterEvent("NPCNAMEHERE_Say",45000, 0)
end

function NPCNAMEHERE_Say(Unit, event, player)
local chance = math.random(1,3)
if(chance == 1) then
Unit:SendChatMessage(14, 0, "Text Here(What you want him to say)")
end
if(chance == 2) then
Unit:SendChatMessage(14, 0, "Text Here (What you want him to say)")
end
if(chance == 3) then
Unit:SendChatMessage(14, 0, "Text Here (What you want him to say)")
end
end

--NPCNAMEHERE
RegisterUnitEvent(Npc spawn Id, 18, "NPCNAMEHERE")
RegisterUnitEvent(Npc Spawn ID, 4, "NPCNAMEHERE_Died")

function NPCNAMEHERE_Died(Unit, event, player)
Unit:RemoveEvents()
end

function NPCNAMEHERE(Unit, event, player)
Unit:RegisterEvent("NPCNAMEHERE_Say",65000, 0)
end

function NPCNAMEHERE_Say(Unit, event, player)
local chance = math.random(1,3)
if(chance == 1) then
Unit:SendChatMessage(14, 0, "Text here" )
end
if(chance == 2) then
Unit:SendChatMessage(12, 0, "Text Here")
end
if(chance == 3) then
Unit:SendChatMessage(12, 0, "Text Here")
end
end

--NPCNAMEHERE
RegisterUnitEvent(NPC Spawn ID, 18, "NPCNAMEHERE")
RegisterUnitEvent(Npc Spawn ID, 4, "NPCNAMEHERE_Died")

function NPCNAMEHERE_Died(Unit, event, player)
Unit:RemoveEvents()
end

function NPCNAMEHERE(Unit, event, player)
Unit:RegisterEvent("NPCNAMEHERE_Say",49000, 0)
end

function NPCNAMEHERE_Say(Unit, event, player)
local chance = math.random(1,3)
if(chance == 1) then
Unit:SendChatMessage(12, 0, "Text HERE")
end
if(chance == 2) then
Unit:SendChatMessage(12, 0, "TEXT HERE")
end
if(chance == 3) then
Unit:SendChatMessage(12, 0, "TEXT HERE")
end
end

--NPCNAMEHERE
function NPCNAMEHERE_Died(Unit, event, player)
Unit:RemoveEvents()
end

function NPCNAMEHERE(Unit, event, player)
Unit:RegisterEvent("NPCNAMEHERE_Say",28000, 0)
end

function NPCNAMEHERE_Say(Unit, event, player)
local chance = math.random(1,3)
if(chance == 1) then
Unit:SendChatMessage(12, 0, "NPC TEXT HERE")
end
if(chance == 2) then
Unit:SendChatMessage(12, 0, "NPC TEXT HERE")
end
if(chance == 3) then
Unit:SendChatMessage(12, 0, "NPC TEXT HERE")
end
end

RegisterUnitEvent(NPC SPAWN ID, 18, "NPCNAMEHERE")
RegisterUnitEvent(NPC SPAWN ID, 4, "NPCNAMEHERE_Died")

--NPCNAMEHERE
RegisterUnitEvent(Npc Spawn ID, 18, "NPCNAMEHERE")
RegisterUnitEvent(Npc SPAWN ID, 4, "NPCNAMEHERE_Died")

function NPCNAMEHERE_Died(Unit, event, player)
Unit:RemoveEvents()
end

function NPCNAMEHERE(Unit, event, player)
Unit:RegisterEvent("NPCNAMEHERE_Say",68000, 0)
end

function NPCNAMEHERE_Say(Unit, event, player)
local chance = math.random(1,4)
if(chance == 1) then
Unit:SendChatMessage(12, 0, "Text here" )
end
if(chance == 2) then
Unit:SendChatMessage(12, 0, "TEXT HERE")
end
if(chance == 3) then
Unit:SendChatMessage(12, 0, "TEXT HERE")
end
if(chance == 4) then
Unit:SendChatMessage(12, 0, "TEXT HERE")
end
end


--NPCNAMEHERE
RegisterUnitEvent(Npc Spawn ID, 18, "NPCNAMEHERE")
RegisterUnitEvent(Npc SPAWN ID, 4, "NPCNAMEHERE_Died")

function NPCNAMEHERE_Died(Unit, event, player)
Unit:RemoveEvents()
end

function NPCNAMEHERE(Unit, event, player)
Unit:RegisterEvent("NPCNAMEHERE_Say",69000, 0)
end

function NPCNAMEHERE_Say(Unit, event, player)
Unit:SendChatMessage(12, 0, "TEXT HERE")
end




Now lets say you want to put more text on the npc.
How? Good question, but i will show you! Please read carefully.

Lets say you already have some text like this:

function NPCNAMEHERE_Say(Unit, event, player)
local chance = math.random(1,4)
if(chance == 1) then
Unit:SendChatMessage(12, 0, "Text here" )
end
if(chance == 2) then
Unit:SendChatMessage(12, 0, "TEXT HERE")
end
if(chance == 3) then
Unit:SendChatMessage(12, 0, "TEXT HERE")
end
if(chance == 4) then
Unit:SendChatMessage(12, 0, "TEXT HERE")
end
end

Now do you see this function:

local chance = math.random(1,4)

Now do you see the (1,4)?
See there is 4 lines of chance == 4 Add another line.

if(chance == 5) then
Unit:SendChatMessage(12, 0, "TEXT HERE")
end

Change it to chance ==5 and the math.random should now look like:

local chance = math.random(1,5)

See where i changed the (1,4) into a (1,5)
Congrats! You have another line of text that the npc will say!


DOWNLOAD LINK:

Filebeam:
http://filebeam.com/98c13526e40a53985570e2f877208f5e

Filefront:
http://files.filefront.com/UNIT+Chat+announcerslua/;12963194;/fileinfo.html

havalina
10-02-09, 01:04 AM
Thx using this now!!