Question about LUA quest menu

User Tag List

Results 1 to 10 of 10
  1. #1
    Laenoar's Avatar Corporal
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question about LUA quest

    Hey guys, I'm fairly new to LUA and all that I've learned is how to create a escort
    quest, scripting a NPC, making a custom flight/mount path and things like that. Now I have stumbled accros a problem. I am making a custom blizzlike server, wich is why I started learning LUA scripting, and I'm trying to create a quest such as this:


    Would you believe that in my darkest hour, at the apex of my being, I failed.
    As I fled from the wanton destruction of the forces that overwhelmed us, the only sounds I could hear were the screams of my soldiers and the rapid beat of my own heart.
    A short while later, I returned to Nagrand in hopes of rescuing my men and restoring my honor. Instead I was captured and beaten until dead.
    What I found out during my inquisition and subsequent torture was horrifying.

    Please continue, hero...

    My captors were cruel beyond measure, <name>. They would alternate between Deputy Rainer and I, torturing one while the other watched. During a lull in the activity of an especially cruel day, Rainer told me what had happened to my men and a plan he had been formulating to free them from their masters.
    They suffered a fate far worse than death, or even the pain Rainer and I endured.

    What could be worse than death?


    And so on, now I'm really wondering how I can make people accept a quest, then a NPC will say this all in a log (when right-clicking him), and players must go all the way to the end in order to complete the quest. Any tips? I can use hooks if that's any help :P

    Thanks already.

    PS. I use ArcEMU

    Question about LUA quest
  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Saying it out loud or in a gossip menu?

  3. #3
    Laenoar's Avatar Corporal
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Saying it out loud or in a gossip menu?
    Gossip menu.

  4. #4
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Laenoar View Post
    Gossip menu.
    When you create the gossip menu, the text ID links to the npc_text table in the world database.

    See my example below:

    Code:
    function Proffesion_ONClick(pUnit, event, player)
    	proffesionmenu(pUnit, player)
    end
    
    function proffesionmenu(pUnit, player)
    	pUnit:GossipCreateMenu(3802, player, 0) -- 3802 here links to the entry ID 3802 in npc_text
    	
    	if player:HasQuest(1) then -- if the player has the quest
    		pUnit:GossipMenuAddItem(7, "What's the difference between a miner and a lumberjack?", 5, 0)
    	end
    
    	pUnit:GossipMenuAddItem(0, "Nevermind.", 1, 0)
    	pUnit:GossipSendMenu(player)
    end
    
    function ProffesionOnGossip(pUnit, event, player, id, intid, code)
    	if (intid == 1) then
    		player:GossipComplete()
    	elseif intid == 2 then
    		proffesionmenu(pUnit, player)
    	elseif intid == 5 then
    		pUnit:GossipCreateMenu(7363, player, 0) -- again, 7363 links to npc_text
    		pUnit:GossipMenuAddItem(0, "Tell  me more.", 6, 0)
    		pUnit:GossipMenuAddItem(0, "Wait, what did you say first?", 2, 0)
    		pUnit:GossipMenuAddItem(0, "Nevermind.", 1, 0)
    		pUnit:GossipSendMenu(player)
    	elseif intid == 6 then
    		pUnit:GossipCreateMenu(2222, player, 0) -- again, 2222 links to npc_text
    		pUnit:GossipMenuAddItem(0, "Ok, thanks.", 2, 0)
    		pUnit:GossipMenuAddItem(0, "Nevermind.", 1, 0)
    		pUnit:GossipSendMenu(player)
    		-- And now since we got to this part of the gossip, we can mark quest complete:
    		if player:HasQuest(1) then -- if the player has quest ID 1
    			player:MarkQuestObjectiveAsComplete(3030, 0) -- mark quest ID 3030 objective 0 as complete
    		end
    	end
    end
    
    RegisterUnitGossipEvent(npcid, 1, "Proffesion_ONClick")
    RegisterUnitGossipEvent(npcid, 2, "ProffesionOnGossip")

  5. #5
    Laenoar's Avatar Corporal
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    When you create the gossip menu, the text ID links to the npc_text table in the world database.

    See my example below:

    Code:
    function Proffesion_ONClick(pUnit, event, player)
    	proffesionmenu(pUnit, player)
    end
    
    function proffesionmenu(pUnit, player)
    	pUnit:GossipCreateMenu(3802, player, 0) -- 3802 here links to the entry ID 3802 in npc_text
    	
    	if player:HasQuest(1) then -- if the player has the quest
    		pUnit:GossipMenuAddItem(7, "What's the difference between a miner and a lumberjack?", 5, 0)
    	end
    
    	pUnit:GossipMenuAddItem(0, "Nevermind.", 1, 0)
    	pUnit:GossipSendMenu(player)
    end
    
    function ProffesionOnGossip(pUnit, event, player, id, intid, code)
    	if (intid == 1) then
    		player:GossipComplete()
    	elseif intid == 2 then
    		proffesionmenu(pUnit, player)
    	elseif intid == 5 then
    		pUnit:GossipCreateMenu(7363, player, 0) -- again, 7363 links to npc_text
    		pUnit:GossipMenuAddItem(0, "Tell  me more.", 6, 0)
    		pUnit:GossipMenuAddItem(0, "Wait, what did you say first?", 2, 0)
    		pUnit:GossipMenuAddItem(0, "Nevermind.", 1, 0)
    		pUnit:GossipSendMenu(player)
    	elseif intid == 6 then
    		pUnit:GossipCreateMenu(2222, player, 0) -- again, 2222 links to npc_text
    		pUnit:GossipMenuAddItem(0, "Ok, thanks.", 2, 0)
    		pUnit:GossipMenuAddItem(0, "Nevermind.", 1, 0)
    		pUnit:GossipSendMenu(player)
    		-- And now since we got to this part of the gossip, we can mark quest complete:
    		if player:HasQuest(1) then -- if the player has quest ID 1
    			player:MarkQuestObjectiveAsComplete(3030, 0) -- mark quest ID 3030 objective 0 as complete
    		end
    	end
    end
    
    RegisterUnitGossipEvent(npcid, 1, "Proffesion_ONClick")
    RegisterUnitGossipEvent(npcid, 2, "ProffesionOnGossip")
    Thanks alot, I'll test it after I finished my ice cream :P

  6. #6
    Laenoar's Avatar Corporal
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is probably an extremely derpy question, but where do I enter the NPC entry ID :/?

    EDIT: Herpy derp, nevermind >.<
    Last edited by Laenoar; 07-21-2012 at 09:12 AM. Reason: Epic fail

  7. #7
    Laenoar's Avatar Corporal
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It worked, +rep for you

  8. #8
    Laenoar's Avatar Corporal
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I stumbled across a problem, when I accept the quest, I am immediately able to complete the quest, and still when I listen to his story it will say 'Objective Complete', but it already is complete the second I accept the quest, any idea how to fix this?

  9. #9
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Set the only objective to kill a creature (creature ID 1). This will then make the quest say:

    Waypoint killed 0/1

    Since waypoint should be creature ID 1. Next go to the ObjectiveText columns. These overwrite the quest objective text.

    So change it to: "Old Man Talked To"

    Then in game it will show:

    Old Man Talked To 0/1

    When mark quest is called on that objective, it will change to 1/1 (complete).

    You may need to clear your cache to see changes.

  10. #10
    Laenoar's Avatar Corporal
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Set the only objective to kill a creature (creature ID 1). This will then make the quest say:

    Waypoint killed 0/1

    Since waypoint should be creature ID 1. Next go to the ObjectiveText columns. These overwrite the quest objective text.

    So change it to: "Old Man Talked To"

    Then in game it will show:

    Old Man Talked To 0/1

    When mark quest is called on that objective, it will change to 1/1 (complete).

    You may need to clear your cache to see changes.
    Wow man, you're so awesome xD, I'm gonna have to rep you again (asap)

Similar Threads

  1. A question about Lua
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 07-10-2008, 12:02 AM
  2. [Question] About Lua
    By Nilrac in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 06-21-2008, 07:27 PM
  3. Question about Lua scripting
    By bill45 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 05-13-2008, 02:49 AM
  4. [Question] About lua files...
    By Ellenor in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 02-15-2008, 06:26 PM
  5. A simple question about Lua Scripts
    By Arugos in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 12-28-2007, 01:57 AM
All times are GMT -5. The time now is 02:24 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search