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

    Visual Spells NPC (+ script + SQL)


    Register to remove this ad
    Hey. I just looked online for any similar script and I didn't find it at the updated version, so I just had in mind to release one of my own!
    It's my first release!
    The creature:
    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 (199934, 0, 0, 0, 0, 0, 23445, 0, 0, 0, 'Visual NPC', 'Sub-Name', '', 0, 1, 1, 0, 35, 1, 1, 1, 0.13, 0, 1, 2, 0, 0, 20, 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, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 'Visual_NPC', 1);
    The item (Visual Coin - tradeable)
    Code:
    INSERT INTO `item_template` (`entry`,`class`,`subclass`,`SoundOverrideSubclass`,`name`,`displayid`,`Quality`,`Flags`,`FlagsExtra`,`BuyCount`,`BuyPrice`,`SellPrice`,`InventoryType`,`AllowableClass`,`AllowableRace`,`ItemLevel`,`RequiredLevel`,`RequiredSkill`,`RequiredSkillRank`,`requiredspell`,`requiredhonorrank`,`RequiredCityRank`,`RequiredReputationFaction`,`RequiredReputationRank`,`maxcount`,`stackable`,`ContainerSlots`,`StatsCount`,`stat_type1`,`stat_value1`,`stat_type2`,`stat_value2`,`stat_type3`,`stat_value3`,`stat_type4`,`stat_value4`,`stat_type5`,`stat_value5`,`stat_type6`,`stat_value6`,`stat_type7`,`stat_value7`,`stat_type8`,`stat_value8`,`stat_type9`,`stat_value9`,`stat_type10`,`stat_value10`,`ScalingStatDistribution`,`ScalingStatValue`,`dmg_min1`,`dmg_max1`,`dmg_type1`,`dmg_min2`,`dmg_max2`,`dmg_type2`,`armor`,`holy_res`,`fire_res`,`nature_res`,`frost_res`,`shadow_res`,`arcane_res`,`delay`,`ammo_type`,`RangedModRange`,`spellid_1`,`spelltrigger_1`,`spellcharges_1`,`spellppmRate_1`,`spellcooldown_1`,`spellcategory_1`,`spellcategorycooldown_1`,`spellid_2`,`spelltrigger_2`,`spellcharges_2`,`spellppmRate_2`,`spellcooldown_2`,`spellcategory_2`,`spellcategorycooldown_2`,`spellid_3`,`spelltrigger_3`,`spellcharges_3`,`spellppmRate_3`,`spellcooldown_3`,`spellcategory_3`,`spellcategorycooldown_3`,`spellid_4`,`spelltrigger_4`,`spellcharges_4`,`spellppmRate_4`,`spellcooldown_4`,`spellcategory_4`,`spellcategorycooldown_4`,`spellid_5`,`spelltrigger_5`,`spellcharges_5`,`spellppmRate_5`,`spellcooldown_5`,`spellcategory_5`,`spellcategorycooldown_5`,`bonding`,`description`,`PageText`,`LanguageID`,`PageMaterial`,`startquest`,`lockid`,`Material`,`sheath`,`RandomProperty`,`RandomSuffix`,`block`,`itemset`,`MaxDurability`,`area`,`Map`,`BagFamily`,`TotemCategory`,`socketColor_1`,`socketContent_1`,`socketColor_2`,`socketContent_2`,`socketColor_3`,`socketContent_3`,`socketBonus`,`GemProperties`,`RequiredDisenchantSkill`,`ArmorDamageModifier`,`duration`,`ItemLimitCategory`,`HolidayId`,`ScriptName`,`DisenchantID`,`FoodType`,`minMoneyLoot`,`maxMoneyLoot`,`flagsCustom`,`VerifiedBuild`) VALUES (123456, 0, 0, -1, "Visual Coin", 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
            10, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, -1, 0, 'Use the Visual NPC to get visuals!', 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, 0, 0, 0, 12340);
    The script:
    Code:
    enum Spells
    {
        VISUAL_1 = 60451, //spell 1
        VISUAL_2 = 56075, //spell 2
        VISUAL_3 = 42438, //spell 3
        VISUAL_4 = 45948, //spell 4
        VISUAL_5 = 37805, //spell 5
        VISUAL_6 = 35466, //spell 6
        VISUAL_7 = 37810, //spell 7
        VISUAL_8 = 20373, //spell 8
        VISUAL_9 = 20374, //spell 9
        VISUAL_10 = 20370 //spell 10
    };
    
    enum Items
    {
        REQUIRED_ITEM = 123456 //item required to cast spells
    };
    
    
    class VisualNPC : public CreatureScript
    {
    public:
        VisualNPC() : CreatureScript("Visual_NPC") { }
    
        bool OnGossipHello(Player* player, Creature* creature)
        {
            player->ADD_GOSSIP_ITEM(4, "Visual Name 1", GOSSIP_SENDER_MAIN, 1001);
            player->ADD_GOSSIP_ITEM(4, "Visual Name 2", GOSSIP_SENDER_MAIN, 1002);
            player->ADD_GOSSIP_ITEM(4, "Visual Name 3", GOSSIP_SENDER_MAIN, 1003);
            player->ADD_GOSSIP_ITEM(4, "Visual Name 4", GOSSIP_SENDER_MAIN, 1004);
            player->ADD_GOSSIP_ITEM(4, "Visual Name 5", GOSSIP_SENDER_MAIN, 1005);
            player->ADD_GOSSIP_ITEM(4, "Visual Name 6", GOSSIP_SENDER_MAIN, 1006);
            player->ADD_GOSSIP_ITEM(4, "Visual Name 7", GOSSIP_SENDER_MAIN, 1007);
            player->ADD_GOSSIP_ITEM(4, "Visual Name 8", GOSSIP_SENDER_MAIN, 1008);
            player->ADD_GOSSIP_ITEM(4, "Visual Name 9", GOSSIP_SENDER_MAIN, 1009);
            player->ADD_GOSSIP_ITEM(4, "Visual Name 10", GOSSIP_SENDER_MAIN, 1010);
            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)
            {
                
                char moveon[500]; //if the player has the item - send this message
                sprintf(moveon, "You got the visual you wanted.");
                char error[500]; //if the player does not have the item - send this message
                sprintf(error, "You do not have the required item to continue.");
    
    
                ///////////START ACTIONS//////////////////
            case 1001: //visual #1
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_1, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
    
    
            case 1002: //visual #2
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_2, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
    
    
            case 1003: //visual #3
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_3, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
    
    
    
            case 1004: //visual #4
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_4, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
    
    
            case 1005: //visual #5
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_5, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
    
    
            case 1006: //visual #6
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_6, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
    
    
            case 1007: //visual #7
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_7, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
    
    
            case 1008: //visual #8
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_8, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
    
    
            case 1009: //visual #9
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_9, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
    
    
            case 1010: //visual #10
                if (player->HasItemCount(REQUIRED_ITEM, 1, true))
                {
                    player->DestroyItemCount(REQUIRED_ITEM, 1, true, false);
                    player->AddAura(VISUAL_10, player);
                    player->Whisper(moveon, LANG_UNIVERSAL, player, true);
                    player->CLOSE_GOSSIP_MENU();
                }
                else
                {
                    player->Whisper(error, LANG_UNIVERSAL, player, true), player->CLOSE_GOSSIP_MENU();
                }
                break;
    
                return true;
            }
    
    
        }
    
    };
    
    void AddSC_VisualNPC()
    {
        new VisualNPC();
    }
    HOW TO ADD YOUR OWN VISUAL OR SPELL:
    Go to the beggining of the script, and add there the same as it says there BUT add to the previous line a comma ( , ) at the end. Then replace 10 with 11, and insert the spell ID you want it to be.
    Now we've confirmed the spell and it'll work within the script!

    Now, go to the menu (player->ADD_SOSSIP) thing and copy the last line in there, which is
    Code:
    player->ADD_GOSSIP_ITEM(4, "Visual Name 10", GOSSIP_SENDER_MAIN, 1010);
    Then paste it onto a new line and replace the following: "Visual Name 10", "1010".
    In our case, it'll be
    Code:
    player->ADD_GOSSIP_ITEM(4, "Visual Name 11", GOSSIP_SENDER_MAIN, 1011);
    Last thing to do, roll down till you see the case "1010". Copy ALL OF IT starting from "case 1010:" to "break;".
    Now replace the following:
    "case 1010:" to "case 1011" and VISUAL_10 to VISUAL_11.
    It should work now with your own customized option.
    Feel free to edit it as you wish! Enjoy,

    Credits Zeraax


    › See More: Visual Spells NPC (+ script + SQL)

  2. #2
    Beginner

    Join Date
    Apr 2016
    Posts
    26
    Post Thanks / Like
    Rep Power
    9
    Reputation
    1

    Register to remove this ad
    gives the error when compiling




    3>scripts.lib(custom_script_loader.obj) : error LNK2019: unresolved external symbol "void __cdecl AddSC_VisualNPC(void)" (?AddSC_VisualNPC@@YAXXZ) referenced in function "void __cdecl AddCustomScripts(void)" (?AddCustomScripts@@YAXXZ)



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

 

 

Visitors found this page by searching for:

Nobody landed on this page from a search engine, yet!
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 12:34 AM.
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