How do I make a NPC cast some spell on his Summoner menu

User Tag List

Results 1 to 1 of 1
  1. #1
    chaplisimo's Avatar Private
    Reputation
    1
    Join Date
    Aug 2014
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I make a NPC cast some spell on his Summoner

    So, I wanna fix some bugs on NPC summoned by the player.
    I need that the player, use some object, that object summons a NPC (you know, that kind of 'Minion of player'/'Guardian of player')
    This part works like it should.

    Now, I want that summoned NPC (i don't know if 'summoned' its the word i should use) cast a spell on the player who summoned it.

    I tried several things, which didn't work at all.

    First, I wrote a script and attached to the creature_template in 'ScriptName'. Did not work. (I've done some scripting on creatures that worked, but never summoned creatures).

    This is my script
    Code:
    #include "ScriptPCH.h"
    
    enum Spells
    {
    	SPELL_HEALTH = 139
    };
    
    class summoned_creature : public CreatureScript
    {
        public:
            summoned_creature() : CreatureScript("summoned_creature") { }
    
            struct summoned_creatureAI : public CreatureAI
            {
    			summoned_creatureAI(Creature* creature) : CreatureAI(creature)
                {
                }
    			
                void EnterCombat(Unit* /*who*/) override
                {
                }
    			
                void KilledUnit(Unit * /*victim*/) override
                {
                }
    			
                void JustDied(Unit * /*victim*/) override
                {
                }
                
                void JustSummoned(Creature * Summoner/*summoner*/)
                {
    				DoCast(Summoner, SPELL_HEALTH);
    				me->DisappearAndDie();
    			}
    
                void UpdateAI(uint32 diff) override
                {
                    if (!UpdateVictim())
                        return;
    
                    if (me->HasUnitState(UNIT_STATE_CASTING))
                        return;
                }
            };
    
            CreatureAI* GetAI(Creature* creature) const override
            {
                return new summoned_creatureAI(creature);
            }
    };
    
    void AddSC_summoned_creature()
    {
    	new summoned_creature();
    }
    Second, I tryed modifying the smart_scripts table, (erasing the ScriptName field) and with this link help, make the NPC do its work.

    It didn't.

    Luckily, you'll guide me to resolve this.
    I hope I'd not make any mistakes, since I'm not an English expert

    Thanks

    How do I make a NPC cast some spell on his Summoner

Similar Threads

  1. [Guide] How to make a NPC cast spells. NO LUA!
    By Power of Illuminati in forum WoW EMU Guides & Tutorials
    Replies: 52
    Last Post: 05-06-2011, 07:13 AM
  2. Replies: 9
    Last Post: 09-20-2008, 07:53 PM
  3. How do I make an NPC Stand Still When in Combat?
    By kevinno in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 08-01-2008, 04:48 PM
  4. how do i make a npc talk
    By edded in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 07-01-2008, 10:44 PM
  5. LUA help, how to make npc cast a spell at a certain HP???
    By pioneer1337 in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 03-30-2008, 06:27 PM
All times are GMT -5. The time now is 02:54 AM. 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