Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 2 of 2
  1. #1
    Graphics Guru

    Join Date
    Feb 2009
    Posts
    1,377
    Post Thanks / Like
    Rep Power
    22
    Reputation
    382

    Honorable Kills Shop (script + NPC)


    Register to remove this ad
    Hey guys. I just want to start with a little heads-up as a result from some of my other releases.. I am not a professional C++ coder, so I'm sure it can be done in a better way, but as far as it works, I'm happy about it and I'm just doing this to share what I can with you guys.
    So, what does the script do? It checks if the player who's using it has (IN MY CASE - EDITABLE) 5,000 kills or more (also, editable!!), and if so - he can view the shop which you need to add ingame via .npc add item command, like any other vendor.
    So, the creature for this script:
    Code:
    INSERT INTO `creature_template` (`entry`,`difficulty_entry_1`,`difficulty_entry_2`,`difficulty_entry_3`,`KillCredit1`,`KillCredit2`,`modelid1`,`modelid2`,`modelid3`,`modelid4`,`name`,`subname`,`IconName`,`gossip_menu_id`,`minlevel`,`maxlevel`,`exp`,`faction`,`npcflag`,`speed_walk`,`speed_run`,`scale`,`rank`,`mindmg`,`maxdmg`,`dmgschool`,`attackpower`,`dmg_multiplier`,`baseattacktime`,`rangeattacktime`,`unit_class`,`unit_flags`,`unit_flags2`,`dynamicflags`,`family`,`trainer_type`,`trainer_spell`,`trainer_class`,`trainer_race`,`minrangedmg`,`maxrangedmg`,`rangedattackpower`,`type`,`type_flags`,`lootid`,`pickpocketloot`,`skinloot`,`resistance1`,`resistance2`,`resistance3`,`resistance4`,`resistance5`,`resistance6`,`spell1`,`spell2`,`spell3`,`spell4`,`spell5`,`spell6`,`spell7`,`spell8`,`PetSpellDataId`,`VehicleId`,`mingold`,`maxgold`,`AIName`,`MovementType`,`InhabitType`,`HoverHeight`,`Health_mod`,`Mana_mod`,`Armor_mod`,`RacialLeader`,`questItem1`,`questItem2`,`questItem3`,`questItem4`,`questItem5`,`questItem6`,`movementId`,`RegenHealth`,`mechanic_immune_mask`,`flags_extra`,`ScriptName`,`VerifiedBuild`) VALUES (151516, 0, 0, 0, 0, 0, 23445, 0, 0, 0, 'Name', 'Subname', '', 0, 80, 80, 0, 35, 129, 1, 1, 1, 0, 0, 0, 0, 0, 0, 2000, 2000, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 'hk_kills_shop', 1);
    Edit <SubName> if you wish. Also, feel free to change the displayID of the creature.


    The script:
    Code:
    class honorable_kills_shop : public CreatureScript
    {
    public:
        honorable_kills_shop() : CreatureScript("hk_kills_shop") { }
    
        bool OnGossipHello(Player* player, Creature* creature)
        {
            player->ADD_GOSSIP_ITEM(4, "[5,000 Lifetime Kills are required in order to view my goods. Make sure you have it, or you won't be able to view nor purchase anything.]", GOSSIP_SENDER_MAIN, 1001); //first menu option - a note for what this creature is
            player->ADD_GOSSIP_ITEM(4, "[5k kills] Show me what you got!", GOSSIP_SENDER_MAIN, 1002); //second option, click to send to the vendor (if he has 5k kills)
            player->SEND_GOSSIP_MENU(1, creature->GetGUID()); // This sends the menu to the player
            return true;
        }
    
        bool OnGossipSelect(Player* player, Creature* pCreature, uint32 /*uiSender*/, uint32 action)
        {
            player->PlayerTalkClass->ClearMenus();
            switch (action)
            {
                ///////////START ACTIONS//////////////////
            case 1001:
                player->CLOSE_GOSSIP_MENU();
                break;
            
    
            case 1002:
                if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KIL  LS) >= 5000)
                {
                    player->GetSession()->SendListInventory(pCreature->GetGUID()), //send to the vendor himself. add items via .npc add item command
                        pCreature->MonsterWhisper("You have 5,000 kills or more, therefore you can view my goods.", player, true); //if the player has 5k kills, send this message when 
                }
                else
                {
                    player->MonsterWhisper("You do not have 5,000 kills or more, therefore I cannot allow you to check my store. Sorry.", player, true), player->CLOSE_GOSSIP_MENU(); //send this "error" message and close everything
                }
                break;
        }
            return true;
        }
    };
    
    void AddSC_Honorable_Kills_Shop()
    {
        new honorable_kills_shop();
    }
    To modify it from 5000 LIFETIME kills to any other number, find the following line and modify 5000 to any number you want.
    The following code also includes if you want the script the script to an exact number of kills, more kills than (..) or less kills than (..).
    To make it exact, edit the ">=" to "==".
    To make it more than (..), leave it as it is.
    To make it less than (..), edit the ">=" to "<=".
    Code:
    if (player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KIL  LS) >= 5000)
    When you are done, just modify all the options and texts to the number you want it to be.




    Update - sorry for the huge delay, but instead of several screenshots I made a video.



    Credits : Zeraax


    › See More: Honorable Kills Shop (script + NPC)



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Dr.Core
    Guest

    Register to remove this ad
    Respect =)

    But here is a Fixxed Version =)

    PHP Code:
    class honorable_kills_shop : public CreatureScript
    {
    public:
        
    honorable_kills_shop() : CreatureScript("hk_kills_shop") { }


        
    bool OnGossipHello(PlayerplayerCreaturecreature)
        {
            
    player->ADD_GOSSIP_ITEM(4"[500 Lifetime Kills are required in order to view my goods. Make sure you have it, or you won't be able to view nor purchase anything.]"GOSSIP_SENDER_MAIN1001); //first menu option - a note for what this creature is
            
    player->ADD_GOSSIP_ITEM(4"[500 Kills] Show me what you got!"GOSSIP_SENDER_MAIN1002); //second option, click to send to the vendor (if he has 500 Kills)
            
    player->SEND_GOSSIP_MENU(1creature->GetGUID()); // This sends the menu to the player
            
    return true;
        }


        
    bool OnGossipSelect(PlayerplayerCreaturepCreatureuint32 /*uiSender*/uint32 action)
        {
            
    player->PlayerTalkClass->ClearMenus();
            switch (
    action)
            {
                
    ///////////START ACTIONS//////////////////
            
    case 1001:
                
    player->CLOSE_GOSSIP_MENU();
                break;
            


            case 
    1002:
                if (
    player->GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS) >= 500)
                {
                    
    player->GetSession()->SendListInventory(pCreature->GetGUID()), //send to the vendor himself. add items via .npc add item command
                    
    pCreature->Whisper("You have 500 kills or more, therefore you can view my goods."LANG_UNIVERSALplayertrue); //if the player has 500 Kills, send this message when 
                
    }
                else
                {
                    
    pCreature->Whisper("You do not have 500 kills or more, therefore I cannot allow you to check my store. Sorry."LANG_UNIVERSALplayertrue), player->CLOSE_GOSSIP_MENU(); //send this "error" message and close everything
                
    }
                break;
        }
            return 
    true;
        }
    };


    void AddSC_Honorable_Kills_Shop()
    {
        new 
    honorable_kills_shop();


 

 

Visitors found this page by searching for:

SendListInventory

SEO Blog

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 06:36 PM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org