[C++] Advanced Mob Script menu

Shout-Out

User Tag List

Results 1 to 15 of 15
  1. #1
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] Advanced Mob Script

    Advanced Mob

    Inspiration

    Do you ever sit there, making mobs and you want the same mob to have different spells than the other one, and you hate that you have to make a whole new Npc for it. Well, i felt that same way when writing an instance one time and i wrote this script

    How to Use
    This script is entirely basic, anything you need to know has a comment to the right of it, so its no challenge, this Npc is a mage, but in the future i may decide to make a melee fighter as well. I hope you enjoy this release, maybe learn from it and save yourself the wasted effort of 2 npcs' and 2 scripts. Enjoy

    Code:
    /********************************************
    **********Created By Mager*******************
    ********Advanced Mob Script******************
    ********Created for MMowned******************
    ********************************************/
    
    
    #define CN_ADVANCEDMOB 100015
    #define FIRECAST 38692///Choose a normal firespell
    #define FIREAOE 27086///Choose a AoE Firespell
    #define FROSTCAST 38697//Choose a normal frostspell
    #define FROSTAOE 27384//Choose a AoE frostspell
    #define SHADOWCAST 27209//Choose a normal Shadow Spell
    #define SHADOWAOE 30414// Choose a shadow AoE spell
    #define FIRESHIELD 30663//Choose a firebased mage-shield ex."Molten Armor"
    #define FROSTSHIELD 27124//Choose a frostbased mage-shield ex. "Ice Armor"
    #define SHADOWSHIELD 27260//Choose a shadowbased mage-shield ex. "Demon Skin" p.s. yes i know its warlock but you get the point
    #define FIRESUMMON 40133//Choose a fire pet to summon (shammy spells have fire elements)
    #define FROSTSUMMON 45067//Choose a frost pet to summon, "Summon Water Elemental" is good
    #define SHADOWSUMMON 34237//Choose a shadow pet to summon, usually a warlocks demon
    //Start talking to people about how awesome mager is and how much you know it XD
    
    class AdvancedMobAI : CreatureAIScript
    {
    public:
        ADD_CREATURE_FACTORY_FUNCTION(MafiaSpellWeaverAI);
        MafiaSpellWeaverAI(Creature* pCreature) : CreatureAIScript(pCreature)
        {
            m_fire = m_frost = m_shadow = false;
            m_cast = m_aoe = m_shield = m_summon = true;
            ChooseSpec();
        }
        
        void ChooseSpec()
        {
            int RandType;
                RandType=rand()%3;
                switch (RandType)
                {
                case 0:
                m_fire = true;
                infocast = dbcSpell.LookupEntry(FIRECAST);
                infoaoe = dbcSpell.LookupEntry(FIREAOE);
                infoshield = dbcSpell.LookupEntry(FIRESHIELD);
                infosummon = dbcSpell.LookupEntry(FIRESUMMON);
                break;
                case 1:
                m_frost = true;
                infocast = dbcSpell.LookupEntry(FROSTCAST);
                infoaoe = dbcSpell.LookupEntry(FROSTAOE);
                infoshield = dbcSpell.LookupEntry(FROSTSHIELD);
                infosummon = dbcSpell.LookupEntry(FROSTSUMMON);
                break;
                case 2:
                m_shadow = true;
                infocast = dbcSpell.LookupEntry(SHADOWCAST);
                infoaoe = dbcSpell.LookupEntry(SHADOWAOE);
                infoshield = dbcSpell.LookupEntry(SHADOWSHIELD);
                infosummon = dbcSpell.LookupEntry(SHADOWSUMMON);
                break;
                }
        }
        
        void OnCombatStart(Unit* mTarget)
        {
            RegisterAIUpdateEvent(_unit->GetUInt32Value(UNIT_FIELD_BASEATTACKTIME));
            _unit->CastSpell(_unit, infoshield, false);
            m_shield = false;
            
            int RandType;
                RandType=rand()%3;
                switch (RandType)
                {
                case 0:
                    _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Stop them they threaten our plans!!");
                
                break;
                }
                
        }
        
        void OnCombatStop(Unit *mTarget)
        {
    
            _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL);
            _unit->GetAIInterface()->SetAIState(STATE_IDLE);
            RemoveAIUpdateEvent();
        }
        
        void OnDied(Unit * mKiller)
        {
           RemoveAIUpdateEvent();
        }
        
         void AIUpdate()
        {
            uint32 val = RandomUInt(1000);
            SpellCast(val);
        }
        
        void SpellCast(uint32 val)
        {
            if(_unit->GetCurrentSpell() == NULL && _unit->GetAIInterface()->GetNextTarget())//_unit->getAttackTarget())
            {
                if(m_cast)
                {
                    _unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infocast, false);
                    m_cast = false;
                    return;
                }
                
                if(m_aoe)
                {
                    _unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infoaoe, false);
                    m_aoe = false;
                    
                    return;
                }
                if(m_summon)
                {
                    _unit->CastSpell(_unit->GetAIInterface()->GetNextTarget(), infosummon, false);
                    m_summon = false;
                    return;
                }
    
                if(val >= 1 && val <= 499)
                {
                    _unit->setAttackTimer(2000, false);
                    m_cast = true;
                }
                
                if(val >= 500 && val <= 700)
                {
                    _unit->setAttackTimer(3000, false);
                    m_summon = true;
                }
                
                if(val >= 701 && val <= 1000)
                {
                    _unit->setAttackTimer(4000, false);
                    m_aoe = true;
                }
            }
        }
    
    protected:
    
       bool m_cast;
       bool m_aoe;
       bool m_fire;
       bool m_frost;
       bool m_shadow;
       bool m_summon;
       bool m_shield;
       SpellEntry *infocast, *infoaoe, *infoshield, *infosummon;
    };
    
    void SetupAdvancedMobScriptMgr * mgr)
    {
        mgr->register_creature_script(CN_ADVANCEDMOB, &AdvancedMobAI::Create);
    }
    Last edited by mager1794; 05-23-2009 at 08:54 PM.
    Lunar Gaming - Reaching For The Stars

    [C++] Advanced Mob Script
  2. #2
    TheZaronz's Avatar Active Member
    Reputation
    97
    Join Date
    Dec 2007
    Posts
    567
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice script, easy to use as well. Haven't seen anything like this in C++ yet.

  3. #3
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mgr->register_creature_script(CN_SPELLWEAVER,

    Yet you define CN_ADVANCEDMOB
    Life Puzzler WoW - Website | Forums

  4. #4
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah sorry about that, it was originally a private script of mine i just changed some stuff and i guess i missed a spot
    Lunar Gaming - Reaching For The Stars

  5. #5
    svedin's Avatar Contributor
    Reputation
    124
    Join Date
    Jun 2008
    Posts
    557
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know C++ but its sound good


    ¨¨¨¨¨¨¨¨Edit¨¨¨¨¨¨¨¨¨¨
    can't give +Rep need to spread

  6. #6
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great guide script nonetheless mager! +9 rep
    Life Puzzler WoW - Website | Forums

  7. #7
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alot glad you like it XD
    Lunar Gaming - Reaching For The Stars

  8. #8
    Exacute's Avatar Active Member
    Reputation
    67
    Join Date
    Mar 2008
    Posts
    337
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just facepalming a little.. should learn to compile xD..
    Anyway to topic
    Looks smexy +Rep x2


    Edit: need to spread .. you've been to active *smile*
    [/COLOR]

  9. #9
    AzolexX's Avatar Contributor
    Reputation
    179
    Join Date
    May 2007
    Posts
    587
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heh, good thing, but using moon class(base class) should be better thing, since you don't need to care for a lot of things such as handling targets IN script and some other stuff anyway +rep x2!

    Find about scripting, programming and music! My blog: https://worldofsmth.wordpress.com!

  10. #10
    Performer's Avatar Contributor
    Reputation
    212
    Join Date
    Nov 2007
    Posts
    874
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not bad mager. You should comment it throughout and tell the nubs what everything does :P Also a tip for compiling its easier to add it to an existing thing such as InstanceScripts. So add it to InstanceScripts in the solution and put it in InstanceScripts Setup.h and Setup.cpp

    Dont think i can rep mager :P


  11. #11
    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 didn't understand most of the script, but it looks good nonetheless. +2 rep
    Could you explain a bit more on what it does exactly though? Does it randomly use a set of spells?

  12. #12
    Performer's Avatar Contributor
    Reputation
    212
    Join Date
    Nov 2007
    Posts
    874
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its a tiny bit random. Basically its based on a mage. It randomly chooses the spec Fire frost or shadow. And when it chooses which spec. it configures a certain set of spells. Like fire it would configure

    FIREAOE
    FIRESHIELD
    FIRESUMMON
    FIRECAST


    so basically if you change the spell id's in the defines at the top of the script for Firecast say you can change it to Soul fire or Pyroblast.

    Hope i was correct.



  13. #13
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that was exactly correct performer XD good job

    @AzolexX
    Moon class isn't really better, all it is, is Creature AI only easier to use for noobs, i prefer the normal old creature class anyway
    Last edited by mager1794; 05-23-2009 at 10:09 AM.
    Lunar Gaming - Reaching For The Stars

  14. #14
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mager, that's right, Moon++ is kinda confusing ^^.
    Why do I need a signature?

  15. #15
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the agreeing, but i never really thought of moon++ as confusing, just always has trouble compiling for me and, it isn't as good as a normal CreatureAIScript because MoonScript is based off of CreatureAI
    Lunar Gaming - Reaching For The Stars

Similar Threads

  1. [Hack] WoWPlus - An advanced hacking/scripting suite for 5.0+ (working telehack & more!)
    By Jadd in forum World of Warcraft Bots and Programs
    Replies: 551
    Last Post: 11-04-2012, 12:08 PM
  2. Need help with threat mob scripting
    By yashirotcm in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 07-31-2009, 02:05 PM
  3. [GUIDE]Through the Database [MOB SCRIPTING]
    By Lonehwolf in forum WoW EMU Guides & Tutorials
    Replies: 8
    Last Post: 06-09-2009, 11:09 AM
  4. [Release]Halls of Lightning Mob Scripts! combined Heroic and Normal
    By svedin in forum WoW EMU General Releases
    Replies: 27
    Last Post: 04-12-2009, 02:13 PM
  5. [2.4] Sunwell Plateau Mob Script
    By BrantX in forum World of Warcraft Emulator Servers
    Replies: 15
    Last Post: 07-01-2008, 03:15 PM
All times are GMT -5. The time now is 11:44 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