Gossip Lua + Gossip Text menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    cello1993's Avatar Member
    Reputation
    4
    Join Date
    Sep 2006
    Posts
    121
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Gossip Lua + Gossip Text

    Hello everyone,

    I'm with this problem: I want to, hum... how can I say it ... kind of mix a gossip text (the one you edit in the database in npc_gossip_textid table) and a GossipMenu from lua.

    Example, a NPC who tells an history, like in the place where usually NPCs say "Hello, how can I help you etc..." he says something, then the player clicks on a buttom in the same winodw (just like a lua. gossip menu) and then the text in the window ("Hello, how can I help you etc...") changes and a new buttom appear, you know? Like a talk between the player and the NPC

    is it possible to do that :confused: I know how to edit the first gossip text from database, and how to make gossip menus in lua., but I couldn't find a way to do like "after player click buttom, change the gossip text"

    Anyone could help me with that? Thanks very much, I really need this xD

    :wave:

    Gossip Lua + Gossip Text
  2. #2
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright first you just have to make a gossip text entry.

    Now, take a look at the code to make a gossip menu

    Code:
    pUnit:GossipCreateMenu(100, player, 0)
    All you have to do is change the 100 (in orange) to the ID of your gossip ID.

    So if you wanted to make an NPC that told a history it would be something like this:

    Code:
    function npc_on_talk(pUnit, event, player)
    pUnit:GossipCreateMenu(FIRST_STORY_TEXT_ID, player, 0)
    pUnit:GossipMenuAddItem(0, "Continue Reading...", 1, 0)
    pUnit:GossipSendMenu(player)
    end
    
    function npc_submenus(pUnit, event, player, id, intid, code)
    if (intid==1) then
    pUnit:GossipCreateMenu(SECOND_STORY_TEXT_ID, player, 0)
    pUnit:GossipMenuAddItem(0, "Continue Reading...", 2, 0)
    pUnit:GossipSendMenu(player)
    end
    
    if (intid==2) then
    pUnit:GossipCreateMenu(THIRD_STORY_TEXT_ID, player, 0)
    pUnit:GossipSendMenu(player)
    end
    
    end
    When you talk to the npc, it would send the first text and a little button that says "continue reading"
    when you click continue reading, it shows the second text and adds the same button

    If your story was separated into 3 separate gossip texts, that would work for you. Just edit it to work for yours.

  3. #3
    cello1993's Avatar Member
    Reputation
    4
    Join Date
    Sep 2006
    Posts
    121
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wow! Thanks a lot Jotox1! Haha you rlly helped me xD +Rep!

    Worked perfectly =] loved the idea to make an interaction chat with the NPC =D
    Last edited by cello1993; 05-09-2009 at 10:04 PM.

  4. #4
    cello1993's Avatar Member
    Reputation
    4
    Join Date
    Sep 2006
    Posts
    121
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, one more issue I got: how can I make thta after an event, like NPC1 dies, the gossip menu from NPC2 changes?

    I couldn't find a way to link NPC1 death, with disable NPC2 old gossip and enables a new one.

  5. #5
    Dynashock's Avatar Contributor

    Reputation
    176
    Join Date
    Nov 2007
    Posts
    203
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it can be done with a IsAlive() check. You'll have to define the first npc though so it can be checked in the script of the second npc. So you'll end up with something like this.

    Code:
    RegisterUnitEvent(ID, 18, "NPC1_onLoad")
    
    local NPC1
    
    function NPC1_onLoad(pUnit, Event)
    NPC1 = pUnit
    end
    
    function npc_on_talk(pUnit, event, player)
    if (NPC1:IsAlive() == true) then
    	pUnit:GossipCreateMenu(TEXT_ID, player, 0)
    	pUnit:GossipMenuAddItem(0, "Continue Reading...", 1, 0)
    	pUnit:GossipSendMenu(player)
    	else 
    	pUnit:GossipCreateMenu(TEXT_ID2, player, 0)
    	pUnit:GossipMenuAddItem(0, "Text 2...", 2, 0)
    	pUnit:GossipSendMenu(player)
    end
    end

  6. #6
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mm I'm not completely sure that's safe / would work after the NPC had despawned...

    Try this:

    Code:
    NPC_ALIVE = true;
    
    function NPC1_onLoad(pUnit, Event)
    NPC_ALIVE = true;
    end
    
    function NPC1_onDeath(pUnit, Event)
    NPC_ALIVE = false;
    end
    
    RegisterUnitEvent(ID, 18, "NPC1_onLoad")
    RegisterUnitEvent(ID, 4, "NPC1_onDeath")
    
    function npc_on_talk(pUnit, event, player)
    if (NPC_ALIVE == true) then
    	pUnit:GossipCreateMenu(TEXT_ID, player, 0)
    	pUnit:GossipMenuAddItem(0, "Continue Reading...", 1, 0)
    	pUnit:GossipSendMenu(player)
    	else 
    	pUnit:GossipCreateMenu(TEXT_ID2, player, 0)
    	pUnit:GossipMenuAddItem(0, "Text 2...", 2, 0)
    	pUnit:GossipSendMenu(player)
    end
    end

  7. #7
    cello1993's Avatar Member
    Reputation
    4
    Join Date
    Sep 2006
    Posts
    121
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hum ... I got this

    Code:
    NPC_ALIVE = true;
    function NPC1_onLoad(pUnit, Event)
    NPC_ALIVE = true;
    end
    function NPC1_onDeath(pUnit, Event)
    NPC_ALIVE = false;
    end
    RegisterUnitEvent(99002, 18, "NPC1_onLoad")
    RegisterUnitEvent(99002, 4, "NPC1_onDeath")
    function Icharyus_On_Gossip(pUnit, event, player)
    if (NPC_ALIVE == true) then
    pUnit:GossipCreateMenu(12000, player, 0)
    pUnit:GossipMenuAddItem(0, "TEXT.", 1, 0)
    pUnit:GossipSendMenu(player)
    end
     
    function Icharyus_Submenus(pUnit, event, player, id, intid, code)
    if (intid==1) then
    pUnit:GossipCreateMenu(12001, player, 0)
    pUnit:GossipMenuAddItem(0, "TEXT.", 2, 0)
    pUnit:GossipSendMenu(player)
    end
    and

    Code:
    function Icharyus_On_Gossip2(pUnit, event, player)
    if (NPC_ALIVE == false) then
    pUnit:GossipCreateMenu(12009, player, 0)
    pUnit:GossipMenuAddItem(0, "TEXT.", 1, 0)
    pUnit:GossipSendMenu(player)
    end
    end
     
    function Icharyus_Submenus2(pUnit, event, player, id, intid, code)
    if(intid == 1) then
    player:Teleport(1, 5494.641113, -2620.294922, 1480.592651)
    pUnit:GossipComplete(player)
    end
    end
    RegisterUnitGossipEvent(98017, 1, "Icharyus_On_Gossip")
    RegisterUnitGossipEvent(98017, 1, "Icharyus_Submenus")
    RegisterUnitGossipEvent(98017, 1, "Icharyus_On_Gossip2")
    RegisterUnitGossipEvent(98017, 1, "Icharyus_Submenus2")
    but simply nothing happens >.< now neither the 1st gossip appears when I click the NPC ... =/

  8. #8
    cello1993's Avatar Member
    Reputation
    4
    Join Date
    Sep 2006
    Posts
    121
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    also I didn't understand, what does the '18' means in
    Code:
    RegisterUnitEvent(99002, 18, "NPC1_onLoad")
    ????


    EDIT: I got this:
    Code:
    function Icharyus_On_Gossip(pUnit, event, player)
    if(VermithraxAlive == 1) then
    pUnit:GossipCreateMenu(12000, player, 0)
    pUnit:GossipMenuAddItem(0, "TEXT.", 1, 0)
    pUnit:GossipSendMenu(player)
    else
    return
    end
    end
     
    function Icharyus_On_Gossip2(pUnit, event, player)
    if(VermithraxAlive == 0) then
    pUnit:GossipCreateMenu(12009, player, 0)
    pUnit:GossipMenuAddItem(0, "TEXT2.", 1, 0)
    pUnit:GossipSendMenu(player)
    else
    return
    end
    end
     
    function Vermithrax_OnDeath(pUnit, Event)
    VermithraxAlive = 0
    if(VermithraxAlive == 0) then
    pUnit:Despawn(1,0)
    end
    end
    function Vermithrax_OnAggro(pUnit, Event)
    VermithraxAlive = 1
    if(VermithraxAlive == 1) then
    pUnit:SendChatMessage (14, 0, "You will die!")
    end
    end
     
    RegisterUnitEvent(99002, 1, "Vermithrax_OnAggro")
    RegisterUnitEvent(99002, 4, "Vermithrax_OnDeath")
    RegisterUnitGossipEvent(98017, 1, "Icharyus_On_Gossip")
    RegisterUnitGossipEvent(98017, 1, "Icharyus_Submenus")
    RegisterUnitGossipEvent(98017, 1, "Icharyus_On_Gossip2")
    RegisterUnitGossipEvent(98017, 1, "Icharyus_Submenus2")
    That sounds fine, no errors when loading, no errors after when the script is supposed to happen ¬¬ ... resuming looks fine in arcemu-world.exe

    Buuuuut...... IN GAME NOTHING HAPPENS ¬¬.
    I mean, with Icharyus. Vermithrax does the "Despawn" function, and the "You will die" yell too (actually, I just put those to test if these parts were working well),

    but the damn Icharyus is "gossip clickable" but the window doesn't shows up!

    >.<
    Last edited by cello1993; 05-10-2009 at 08:09 PM.

  9. #9
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm pretty sure you can't register two functions for the same event.

    try this instead:
    Code:
    VermithraxAlive = 1;
    
    function Icharyus_On_Gossip(pUnit, event, player)
    	if(VermithraxAlive == 1) then
    		pUnit:GossipCreateMenu(12000, player, 0)
    		pUnit:GossipMenuAddItem(0, "TEXT.", 1, 0)
    		pUnit:GossipSendMenu(player)
    	else
    		pUnit:GossipCreateMenu(12009, player, 0)
    		pUnit:GossipMenuAddItem(0, "TEXT2.", 1, 0)
    		pUnit:GossipSendMenu(player)
    	end
    end
    
    function Icharyus_Submenus(pUnit, event, player, id, intid, code)
    	if( VermithraxAlive == 1 ) then
    		Icharyus_Submenus_ALIVE(pUnit, event, player, id, intid, code)
    	else
    		Icharyus_Submenus_DEAD(pUnit, event, player, id, intid, code)
    	end
    end
    
    function Icharyus_Submenus_ALIVE(pUnit, event, player, id, intid, code)
    	if (intid==1) then
    		pUnit:GossipCreateMenu(12001, player, 0)
    		pUnit:GossipMenuAddItem(0, "TEXT.", 2, 0)
    		pUnit:GossipSendMenu(player)
    	end
    end
    
    function Icharyus_Submenus_DEAD(pUnit, event, player, id, intid, code)
    	if( intid==1) then
    		player:Teleport(1, 5494.641113, -2620.294922, 1480.592651)
    		pUnit:GossipComplete(player)
    	end
    end
    
     
    function Vermithrax_OnDeath(pUnit, Event)
    	VermithraxAlive = 0;
    	pUnit:Despawn(1,0);
    end
    
    function Vermithrax_OnLoad(pUnit, Event)
    	VermithraxAlive = 1;
    end
    
    function Vermithrax_OnAggro(pUnit, Event)
    	VermithraxAlive = 1
    	pUnit:SendChatMessage (14, 0, "You will die!")
    end
     
    RegisterUnitEvent(99002, 1, "Vermithrax_OnAggro")
    RegisterUnitEvent(99002, 4, "Vermithrax_OnDeath")
    RegisterUnitEvent(99002, 18, "Vermithrax_OnLoad")
    RegisterUnitGossipEvent(98017, 1, "Icharyus_On_Gossip")
    RegisterUnitGossipEvent(98017, 2, "Icharyus_Submenus")
    Last edited by Jotox; 05-12-2009 at 05:44 PM.

  10. #10
    AngelSandy's Avatar Member
    Reputation
    19
    Join Date
    Jan 2009
    Posts
    330
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by cello1993 View Post
    also I didn't understand, what does the '18' means in
    Code:
    RegisterUnitEvent(99002, 18, "NPC1_onLoad")
    ????

    18 is what event the event is registered on.
    18 means "On Spawn", register this event.
    1 means "On Combat" etc

  11. #11
    cello1993's Avatar Member
    Reputation
    4
    Join Date
    Sep 2006
    Posts
    121
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nope =( didn't work, still nothing happens in game >.<

    I'm afraid we are running out of ideas xP

    please, add me on msn, guess it would be easier to resolve this! [email protected]

    thanks for the help!!!

  12. #12
    cello1993's Avatar Member
    Reputation
    4
    Join Date
    Sep 2006
    Posts
    121
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    also I wouldn't complain if you prefer to post it here ¬¬.

  13. #13
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are there any errors on the console?

    and what exactly happens when you talk to the npc

  14. #14
    cello1993's Avatar Member
    Reputation
    4
    Join Date
    Sep 2006
    Posts
    121
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope, no errors ... simply when I mouse-over him, the little chat bubble appears, right, but when I click, nothing happens as I said. He doesn't makes any different movement, only my char does like "/talk" movement, but no windows show up, as if I hadn't clicked him. But there isn't any error, nor in game neither in arcemu.world =/

  15. #15
    AngelSandy's Avatar Member
    Reputation
    19
    Join Date
    Jan 2009
    Posts
    330
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sometimes standing closer to him helps.

    Check in your tables if his flag is not what is supposed to be and if it is as supposed to be, then go ingame and dog .npc info so you can double-check the flag settings.

Page 1 of 2 12 LastLast

Similar Threads

  1. Gossip Text help
    By distructobob in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 08-23-2009, 09:30 PM
  2. LUA: Understanding Gossip Menus
    By SectorSeven in forum WoW EMU Guides & Tutorials
    Replies: 46
    Last Post: 08-16-2008, 09:27 AM
  3. [Lua] Gossip Script
    By LJN in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 07-20-2008, 04:38 AM
  4. [share] mini-tut on gossip scripts lua
    By b!atch in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 05-29-2008, 05:11 AM
  5. Unit Event Lua Question (Gossip Talk)
    By moongo in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 05-22-2008, 07:49 PM
All times are GMT -5. The time now is 12:02 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