Trying to make something a bit to complicated... menu

User Tag List

Results 1 to 5 of 5
  1. #1
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trying to make something a bit to complicated...

    Hey,

    I'm attempting to create an event that works like this:

    NPC 1 says "blah"
    NPC 2 says "blah" a few seconds after NPC 1 speaks.
    NPC 3 says "blah" a few seconds after NPC 2 speaks.
    etc...

    I know that I'll probably be using Lua RegisterEvent - ArcEmu-Wiki and I think I know how to use it.
    My problem comes with the way we set up the NPCs, there are 3 different spawns (90000-2) and each holds 4 different NPCs (90002 holds 2). I want to get the script to be able to get 1 NPC with a entryid of (for example) 90000 to say "blah" then get another NPC with the same entryid to say something different.

    This is a little hard for me to explain... but basically I want to find out how to set a specific spawn of an NPC to be able to say "blah" and another spawn of that same NPC to say "blah2" without having all NPCs with the entry 90000 say "blah" then "blah2".

    Edit: I was thinking and came up with this, would it be possible to set NPC 1 to a GUID <---(I thin kthats the ID for the specific spawn of a creature in the game world)


    Also how would I set the script to re-run itself 30 min after it finishes.
    Last edited by tyeeeee1; 11-19-2011 at 03:57 PM.

    Trying to make something a bit to complicated...
  2. #2
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Well, assuming your creatures will not change, you can do this:

    Code:
    local HandleNPCID = 0 -- the npcid of the creature who handles the event
    
    local Ulda = {}
    
    local i = 0
    
    function HandlerSpawns_SpawnEvent(pUnit)
    	Ulda.captain = pUnit:GetUnitBySqlId(9271259) -- each of those ID's is the GUID of the creature we want to use
    	Ulda.dwarfa = pUnit:GetUnitBySqlId(9271263)
    	Ulda.dwarfb = pUnit:GetUnitBySqlId(9271261)
    	Ulda.dwarfc = pUnit:GetUnitBySqlId(9271260)
    	Ulda.ballista = pUnit:GetUnitBySqlId(9271324)
    	Ulda.main = pUnit:GetUnitBySqlId(9271616) -- each of these ID's is the GUID of the creature we want to use
    	i = 0 -- reset our variable
    	pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 5000, 1)
    end
    
    function SayAMessageAndRepeat_OneTwo(pUnit)
    	i = i + 1 -- always add to i each time this function is called
    	if i == 1 then -- first time
    		Ulda.captain:SendChatMessage(12,0,"Hi!") -- Get our guy and send a message
    		Ulda.captain:SendChatMessage(1,4000) -- say emote
    		pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 5000, 1) -- send next message in 5 seconds
    	elseif i == 2 then
    		Ulda.dwarfa:SendChatMessage(12,0,"Hello.") -- different creature
    		Ulda.dwarfa:Emote(1, 4000) -- say emote
    		pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 1000, 1) -- do next part in a second
    	elseif i == 3 then
    		i = 0 -- reset our event to repeat
    		pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 60000*30, 1) -- 60 seconds * 30 = 30 minutes
    	end
    end
    
    RegisterUnitEvent(HandleNPCID, 18, "HandlerSpawns_SpawnEvent")

  3. #3
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From what I know, wont the script only work for 1 unit with "RegisterUnitEvent(HandleNPCID, 18, "HandlerSpawns_SpawnEvent")" I think the HandleNPCID is supposed to be set to the EntryID of the unit which means all of the NPCs that the script can work for need to be of the same EntryID.

    (If the above if correct continue...)

    There are three different EntryIDs for the 10 Councilor NPCs and then there is the Emperor NPC and a few others if I choose to use them. As far as I can assume (based on a little bit of Lua knowledge) I would need say 4 different scripts to handle 4 different NPCs with 4 different EntryIDs and then I would need to just work out the timing of the 4 scripts until they all flow together perfectly.
    (There are 3 EntryIDs for the Councilor NPCs, each Councilor NPC has 2-4 different DisplayIDs as to cut down on the amount of EntryIDs used.)

    I've modified the script a little bit to test it out on my server, heres what I have so-far.

    local HandleNPCID = 0 -- the npcid of the creature who handles the event

    local Lord = {}

    local i = 0

    function HandlerSpawns_SpawnEvent(pUnit)
    Lord.Emperor = pUnit:GetUnitBySqlId(-1828716470) -- each of those ID's is the GUID of the creature we want to use
    Lord.Counciler1 = pUnit:GetUnitBySqlId(-187904813 -- Smily face is actually "8 )" but without a space in-between
    Ulda.dwarfb = pUnit:GetUnitBySqlId(9271261)
    Ulda.dwarfc = pUnit:GetUnitBySqlId(9271260)
    Ulda.ballista = pUnit:GetUnitBySqlId(9271324)
    Ulda.main = pUnit:GetUnitBySqlId(9271616) -- each of these ID's is the GUID of the creature we want to use
    i = 0 -- reset our variable
    pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 5000, 1)
    end

    function SayAMessageAndRepeat_OneTwo(pUnit)
    i = i + 1 -- always add to i each time this function is called
    if i == 1 then -- first time
    Lord.Emperor:SendChatMessage(12,0,"Hi!") -- Get our guy and send a message
    Lord.Emperor:SendChatMessage(1,4000) -- say emote
    pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 5000, 1) -- send next message in 5 seconds
    elseif i == 2 then
    Lord.Counciler1:SendChatMessage(12,0,"Hello.") -- different creature
    Lord.Counciler1:Emote(1, 4000) -- say emote
    pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 1000, 1) -- do next part in a second
    elseif i == 3 then
    i = 0 -- reset our event to repeat
    pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 60000*30, 1) -- 60 seconds * 30 = 30 minutes
    end
    end

    RegisterUnitEvent(HandleNPCID, 18, "HandlerSpawns_SpawnEvent")
    Last edited by tyeeeee1; 11-20-2011 at 10:49 AM.

  4. #4
    tyeeeee1's Avatar Member
    Reputation
    6
    Join Date
    Feb 2008
    Posts
    95
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    BBuummpp..

  5. #5
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Well, no. Not at all. You didn't understand the script.


    Each NPC spawned has a GUID and an entry. The entry is the creature you spawn - .npc spawn entryid. The GUID is what makes the creature unique, each time a creature is spawned, it has a different GUID. Do .npc info on the creature to see the GUID.

    With this script, you could have a creature (invisible trigger normally) who gets all the GUID's of the units you want to control, then lets you use those GUID's as variables to handle them from the invisible trigger.

    This removes the whole concept of requiring a new event for each creature, as you can control each creature from a single handler.

Similar Threads

  1. A few scripts to make maintenance a bit easier
    By idgarad in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 07-13-2008, 10:24 AM
  2. [Help] Trying to make a chain quest
    By Sabens in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 07-09-2008, 12:39 AM
  3. I really need to try and make a steady $20 (£10) a month to pay for WoW
    By '''Wooaaahhh in forum World of Warcraft General
    Replies: 5
    Last Post: 06-25-2008, 08:37 AM
All times are GMT -5. The time now is 08:22 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search