LUA, Talking vendor problem menu

User Tag List

Results 1 to 10 of 10
  1. #1
    XinuX's Avatar Contributor
    Reputation
    129
    Join Date
    Apr 2007
    Posts
    583
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA, Talking vendor problem

    Here is the code:

    Code:
    function talk(unit, event, player)
    	unit:SendChatMessage(12, 0, "Hello!")
    end
    
    RegisterUnitGossipEvent(99904, 1, "talk")
    What i want to do is make the vendor say hello, but only to the interacting player when he talks to the vendor.
    What it does right now is that it says Hello, but to everyone nearby and the vendor buying pane doesn't pop up.

    Help please!

    LUA, Talking vendor problem
  2. #2
    Death_Master's Avatar Member
    Reputation
    4
    Join Date
    Mar 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm... wierd

  3. #3
    Death_Master's Avatar Member
    Reputation
    4
    Join Date
    Mar 2009
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    are you sure it's not because you did "unit" and not "Unit"?

  4. #4
    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)
    This can't really be done with LUA, as there's no function to send a vendor to a player in LUA.

  5. #5
    XinuX's Avatar Contributor
    Reputation
    129
    Join Date
    Apr 2007
    Posts
    583
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Jotox1 View Post
    This can't really be done with LUA, as there's no function to send a vendor to a player in LUA.
    K, too bad :/ if anyone knows how to make this in cpp help is welcome

  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)
    Code:
    //Custom Vendor Script for XinuX
    //Made by Classic/Jotox
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    //Change this.
    #DEFINE NPC_ID 0
    
    //Change this if u wanna make him say sumthin different.
    #DEFINE MOB_MSG "Hello!"
    
    class SCRIPT_DECL CustomVendor : public GossipScript
    {
    public:
        void GossipHello(Object * pObject, Player * plr, bool AutoSend)
        {
    		plr->GetSession()->SendInventoryList( static_cast< Creature* >( pObject ) );
    		static_cast<Unit*>(pObject)->SendChatMessageToPlayer(CHAT_MSG_MONSTER_SAY, 0, MOB_MSG, plr);
        }
        void Destroy()
        {
            delete this;
        }
    };
    
    void SetupVendorScript(ScriptMgr * mgr)
    {
        mgr->register_gossip_script(NPC_ID, &CustomVendor);
    }
    Here ya go.

  7. #7
    XinuX's Avatar Contributor
    Reputation
    129
    Join Date
    Apr 2007
    Posts
    583
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Jotox1 View Post
    Code:
    //Custom Vendor Script for XinuX
    //Made by Classic/Jotox
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    //Change this.
    #DEFINE NPC_ID 0
    
    //Change this if u wanna make him say sumthin different.
    #DEFINE MOB_MSG "Hello!"
    
    class SCRIPT_DECL CustomVendor : public GossipScript
    {
    public:
        void GossipHello(Object * pObject, Player * plr, bool AutoSend)
        {
    		plr->GetSession()->SendInventoryList( static_cast< Creature* >( pObject ) );
    		static_cast<Unit*>(pObject)->SendChatMessageToPlayer(CHAT_MSG_MONSTER_SAY, 0, MOB_MSG, plr);
        }
        void Destroy()
        {
            delete this;
        }
    };
    
    void SetupVendorScript(ScriptMgr * mgr)
    {
        mgr->register_gossip_script(NPC_ID, &CustomVendor);
    }
    Here ya go.
    Thanks a bunch!
    I'm not entirely sure how to add these though, i tried putting it in trunk\src\scripts\src and compiling it but that didn't work :P
    Should i put it in some other folder or something?
    [EDIT] Okay looked up a guide on how to compile it :P
    When i compile i get the error:
    Code:
    'CustomVendor' : illegal use of this type as an expression
            ..\src\GossipScripts\customvendor.cpp(7) : see declaration of 'CustomVendor'
    Last edited by XinuX; 04-12-2009 at 05:31 PM.

  8. #8
    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)
    My bad, syntax error.

    Code:
    void SetupVendorScript(ScriptMgr * mgr)
    {
        mgr->register_gossip_script(NPC_ID, &CustomVendor);
    }
    Change it to this:

    Code:
    void SetupVendorScript(ScriptMgr * mgr)
    {
        mgr->register_gossip_script(NPC_ID, (GossipScript*) new CustomVendor() );
    }

  9. #9
    XinuX's Avatar Contributor
    Reputation
    129
    Join Date
    Apr 2007
    Posts
    583
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Jotox1 View Post
    My bad, syntax error.

    Code:
    void SetupVendorScript(ScriptMgr * mgr)
    {
        mgr->register_gossip_script(NPC_ID, &CustomVendor);
    }
    Change it to this:

    Code:
    void SetupVendorScript(ScriptMgr * mgr)
    {
        mgr->register_gossip_script(NPC_ID, (GossipScript*) new CustomVendor() );
    }
    Awesome! Works now i will +repz u again when i can

  10. #10
    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)
    ty :] (filler)

Similar Threads

  1. [Help] Vendor problem
    By pewor in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 05-18-2008, 03:10 PM
  2. Lua script spell problem
    By bill45 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 05-13-2008, 01:56 PM
  3. Vendor problems...
    By Nubbadon in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 03-19-2008, 07:20 AM
  4. Lua Boss Script Problems!!
    By blah7 in forum World of Warcraft Emulator Servers
    Replies: 14
    Last Post: 01-22-2008, 08:59 PM
  5. Vendor Problem...
    By Kurosan in forum World of Warcraft Emulator Servers
    Replies: 10
    Last Post: 10-06-2007, 09:09 PM
All times are GMT -5. The time now is 11:54 PM. 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