Yet another non-working script menu

User Tag List

Results 1 to 7 of 7
  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)

    Yet another non-working script

    Hey,

    I have another non-working script, the errors I make are probably obvious to some but I don't see them atm. I learn with every correction so the help is welcomed!

    (The error is with the script labeled as "Script 2", it doesn't run at all. Something I must note because it is very important is that this entire script needs to be able to run in multiple instances at the same time.)

    Code:
    --People who have helped: Rochet2 of *****, 
    
    --------------------------------------------------------------------------------------------------------------------------------
    -------Script 1-----------------------------------------------------------------------------------------------------------------
    local Running_Whitemane01 = false --Is the script running? "false" means nope.
    
    Whitemane_Say_Table01 = {}
    Whitemane_Say_Table01[1] ="Follow me. *Note to player: Don't talk to her or accept the quest until she stops.*"
    Whitemane_Say_Table01[2] ="Here we are, speak with me to begin your next test."
    
    function OnQuestComplete_Whitemane90001(event, pPlayer, QuestId, pQuestGiver)
    	if(QuestId == 90001 and not Running) then --If the quest completed has the ID 90001 and the script isn't running then continue running the script.
    		local Whitemane = pPlayer:GetCreatureNearestCoords(199.408005, 121.653, 134.910004, 90010)
    		if(Whitemane) then --If the selected npc is Whitemane the script continues.
    			Running = true --Because the Whitemane was the NPC selected this is set to "true to say that the script is running.
    			Whitemane:SendChatMessage(12, 7, Whitemane_Say_Table01[1])
    			Whitemane:RegisterEvent("Move01_Whitemane", 1000, 1) --In 1 second "1000ms" the function "Move01_Whitemane" will run.
    		end
    	end
    end
    
    function Move01_Whitemane(Whitemane, event)
    	Whitemane:MoveTo(199.556656, 108.91169, 128.522507, 4.753242)
    	Whitemane:RegisterEvent("Move02_Whitemane", 4000, 1)
    end
    
    function Move02_Whitemane(Whitemane, event)
    	Whitemane:MoveTo(201.447388, 52.051525, 128.766281, 4.742254)
    	Whitemane:RegisterEvent("Move03_Whitemane", 24000, 1)
    end
    
    function Move03_Whitemane(Whitemane, event)
    	Whitemane:MoveTo(209.785873, 51.152771, 128.840088, 6.267476)
    	Whitemane:RegisterEvent("Move04_Whitemane", 4000, 1)
    end
    
    function Move04_Whitemane(Whitemane, event)
    	Whitemane:MoveTo(236.614975, 51.835903, 115.707848, 0.027489)
    	Whitemane:RegisterEvent("Move05_Whitemane", 13000, 1)
    end
    
    function Move05_Whitemane(Whitemane, event)
    	Whitemane:MoveTo(233.375031, 41.485565, 115.707848, 4.374668)
    	Whitemane:RegisterEvent("Move06_Whitemane", 6000, 1)
    end
    
    function Move06_Whitemane(Whitemane, event)
    	Whitemane:MoveTo(201.992569, 12.324375, 115.707878, 1.586526)
    	Whitemane:RegisterEvent("Talk01_Whitemane", 20000, 1)
    end
    
    function Talk01_Whitemane(Whitemane, event)
    	Whitemane:SendChatMessage(12, 7, Whitemane_Say_Table01[2])
    end
    --------------------------------------------------------------------------------------------------------------------------------
    --------Script 2----------------------------------------------------------------------------------------------------------------
    local T = {} --Creates a new table. The weird brackets {} tell the script to create a new table.
    
    function OnQuestAccept_Whitemane90002(event, pPlayer, QuestId, pQuestGiver)
    	local ID = pUnit:GetInstanceID() --Gets the specific ID of the instance Whitemane is in. The ID of the instance is then used for the table.
    	if(QuestId == 90002 and not T[ID]) then -- If the quest completed has the ID 90002 and the script isn't running in the current instance then continue running the script.
    		T[ID] = 0 --ID is the ID of the specific instance that the script is running in.
    		pQuestGiver:RegisterEvent("Quest01_Whitemane90002", 10000, 1) -- We use the questgiver to register events since we need him later
    	end
    end
    
    function Quest01_Whitemane90002(pUnit, event)
    	pUnit:SpawnCreature(37227, 200.697739, 59.384331, 115.708244, 1.576423, 694, 120000, 0, 0, 0, 1, 0) --Spawns the portal
    	pUnit:SendChatMessage(42, 0, "The undead are comming, prepare yourself!") -- Questgiver says
    	pUnit:RegisterEvent("Spawn_Timer_Whitemane", 4000, 1) -- Spawns an NPC after 4 seconds
    end
    
    function Spawn_Timer_Whitemane(pUnit, event)
    	pUnit:RegisterEvent("Spawn01_Whitemane90002", 40000, 4) -- Spawn an NPC after 40 seconds 4 times.
    end
    
    function Spawn01_Whitemane90002(pUnit, event) -- The function that spawns the NPCs
    	local MindlessGhoul = pUnit:SpawnCreature(90012, 200.697739, 59.384331, 115.708244, 4.644086, 14, 120000, 0, 0, 0, 1, 0) --Sets the last spawned creature to the MindlessGhoul variable.
    	MindlessGhoul:MoveTo(201.975159, 21.787292, 114.983719, 4.718697) --Tells the mindless ghoul to move to the point
    end
    
    function Spawn_On_Death(pUnit, event, pPlayer)
    	local ID = pUnit:GetInstanceID()
    	T[ID] = T[ID]+1
    	if(T[ID] >= 5) then
    		-- complete quest etc
    		table.remove(T, ID) -- Quest can now be re-triggered
    	end
    end
    --------------------------------------------------------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------------
    function END_Whitemane90001(Whitemane, event) --DO NOT RUN THIS UNTIL THE PLAYER HAS FINISHED THE ENTIRE QUEST CHAIN AND LEFT THE INSTNACE
    	Whitemane:Despawn(0, 0)
    	Running = false
    end
    
    RegisterServerHook(22, "OnQuestAccept_Whitemane90002")
    RegisterServerHook(22, "OnQuestComplete_Whitemane90001")
    RegisterUnitEvent(90012, 4, "Spawn_On_Death")
    RegisterUnitEvent(90010, 18, function() return; end) -- This allows the use of :RegisterEvent() for Whitemane
    Last edited by stoneharry; 03-11-2012 at 05:43 PM.

    Yet another non-working script
  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)
    Eeerrrrrrrrrrrrrrrrrrrrrrrrrr, that script is quite a mess. 0_o

    All you need to do is create a meta table where the instance id handles which subtable to use.

  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)
    Originally Posted by stoneharry View Post
    Eeerrrrrrrrrrrrrrrrrrrrrrrrrr, that script is quite a mess. 0_o

    All you need to do is create a meta table where the instance id handles which subtable to use.
    I just CnP'd 2 of my scripts together so I could easily edit both of them at the same time, it is messy...

    I just learned how to do basic tables today so I'm not exactly sure what you're saying about the tables =/



    Another helpful person fixed up the 2nd script for me. But his version of the script doesen't work at all no matter what I do to it. Here is what he gave me to use without any of my edits:
    Code:
    local T = {}
    
    function OnQuestAccept_Whitemane90002(event, pPlayer, QuestId, pUnit)
    	local ID = pUnit:GetInstanceID()
    	if(QuestId == 90002 and not T[ID]) then -- If the quest completed has the ID 90002 and the script isn't running in the current instance then continue running the script.
    		T[ID] = 0
    		pUnit:RegisterEvent("Quest01_Whitemane90002", 10000, 1) -- We use the questgiver to register events since we need him later
    	end
    end
    
    function Quest01_Whitemane90002(pUnit, event)
    	pUnit:SpawnCreature(37227, 200.697739, 59.384331, 115.708244, 1.576423, 694, 120000, 0, 0, 0, 1, 0) --S pawns the portal
    	pUnit:SendChatMessage(42, 0, "The undead are comming, prepare yourself!") -- Questgiver says
    	pUnit:RegisterEvent("Spawn_Timer_Whitemane", 4000, 1) -- Spawn an NPC after 4 seconds
    end
    
    function Spawn_Timer_Whitemane(pUnit, event)
    	Spawn01_Whitemane90002(pUnit, event)
    	pUnit:RegisterEvent("Spawn01_Whitemane90002", 40000, 4) -- Spawn an NPC after 40 seconds 4 times.
    end
    
    function Spawn01_Whitemane90002(pUnit, event) -- The function that spawns the NPCs
    	local MindlessGhoul = pUnit:SpawnCreature(90012, 200.697739, 59.384331, 115.708244, 4.644086, 14, 120000, 0, 0, 0, 1, 0)
    	MindlessGhoul:MoveTo(201.975159, 21.787292, 114.983719, 4.718697) --Tells the first mindless ghoul to move to the point
    end
    
    function Spawn_On_Death(pUnit, event, pPlayer)
    	local ID = pUnit:GetInstanceID()
    	T[ID] = T[ID]+1
    	if(T[ID] >= 5) then
    		-- complete quest etc
    		table.remove(T, ID) -- Quest can now be re-triggered
    	end
    end
    It is supposed to work like this:

    -Player accepts quest
    -A warning pops up telling the player that the undead are comming, the portal is spawned
    -The first ghoul spawns and walks towards the quest giver/player
    -The player kills the first ghoul
    -40 second timer runs out
    -Second ghoul spawns
    -The player kills the second ghoul
    -40 second timer runs out
    -Third ghoul spawns
    -The player kills the third ghoul
    -40 second timer runs out
    -The fourth ghoul spawns
    -The player kills the fourth ghoul
    -40 second timer runs out
    -The player kills the fifth ghoul
    -All 5 ghouls have been killed so the quest is complete
    -Quest line continues
    Last edited by tyeeeee1; 03-11-2012 at 05:23 PM.

  4. #4
    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)
    I don't know if your expecting me to write it for you, because I'm not going to (I have better things to do, to be honest).

    Here is a tutorial I quickly threw together, explaining how to make collision proof scripts:

    [Lua] ZG = {} ZG.VAR = {} -- In this part of the script, I want to store some cr - Pastebin.com

  5. #5
    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)
    In this section:

    Code:
            ZG[id].VAR.leader = pUnit:SpawnCreature(36544, -11062, -2306, 145.9, 1.290404, 35, 0, 50429) -- Leader
            ZG[id].VAR.addA = pUnit:SpawnCreature(4052, -11075, -2307, 145, 1.058709, 35, 0, 45212)
            ZG[id].VAR.addB = pUnit:SpawnCreature(4052, -11066, -2311, 145.9, 1.184373, 35, 0, 45212)
            ZG[id].VAR.addC = pUnit:SpawnCreature(4052, -11057, -2314, 147.3, 1.549583, 35, 0, 45212)
            ZG[id].VAR.addD = pUnit:SpawnCreature(4052, -11049, -2311, 146.3, 2, 35, 0, 45212)
    Is it spawning the creatures and at the same time assigning them a position in the table?

    also
    what does this line
    Code:
     ZG[id] = ZG[id] or {VAR={}}
    mean?

  6. #6
    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)
    Yes @ the spawning creatures. You are saying, this variable = this creature I'm spawning. Bear in mind, you should wait at least a second before trying to use that creature, since they are not pushed to the world straight away.

    So you can't do:

    leader = pUnit: SpawnCreature
    leader:CastSpell

    You have to wait a second then cast the spell (varies depending on server load/players nearby).

    ZG[id]

    ZG is a table, ID = a number. Similar to a array:

    ZG[1] = X
    ZG[2] = Y

    etc, it's just giving a position a value. In this case, the instance ID is the place where it is stored.

    ZG[id] = ZG[id] <-- If it already exists, that is fine.

    or {VAR={}}

    If it isn't defined, it is a table within a table within a table (inception). A difficult concept to grasp, but one often used in the form of arrays (think three dimensional arrays).

    ZG {
    ---- ID {
    -------- VAR {
    ------------ Variables will go here

    That is the structure of how it is saved.

    So for example:

    ZG {
    ---- ID = 1
    -------- VAR {
    ----------- leader = GUID 1500 -- leader is the ID 1500 in instance ID 1
    ---- ID = 2
    -------- VAR {
    ----------- leader = GUID 1501 -- Leader is the ID 1501 in instance ID 2
    ----------- ready = false -- In instance ID 2, the variable ready = false

    Maybe this explains it a bit further.

  7. #7
    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)
    It makes a lot more sense now, the tableception is a bit confusing as it should be. This will help with a lot of the scripts I hope to make involving a lot of NPCS.

Similar Threads

  1. Yet another non AFK method
    By Pampa Noh in forum World of Warcraft Exploits
    Replies: 2
    Last Post: 11-16-2014, 01:09 AM
  2. Yet another lua dont work (teleporter)
    By Tikki100 in forum WoW EMU Questions & Requests
    Replies: 11
    Last Post: 06-30-2009, 05:10 PM
  3. [RELEASE] Yet another Lua script
    By Zaeran in forum WoW EMU General Releases
    Replies: 8
    Last Post: 12-06-2008, 09:12 PM
  4. Yet another hearthstone trick
    By lvlrbojang1es in forum World of Warcraft Exploits
    Replies: 4
    Last Post: 06-19-2006, 02:48 PM
  5. Yet Another Ony Guide
    By Amedis in forum World of Warcraft Guides
    Replies: 0
    Last Post: 06-04-2006, 10:14 AM
All times are GMT -5. The time now is 09:57 PM. 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