[Eluna] How to custom creature stop melee attacks? menu

User Tag List

Results 1 to 3 of 3
  1. #1
    holyreign's Avatar Member
    Reputation
    1
    Join Date
    Aug 2012
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Eluna] How to custom creature stop melee attacks?

    Hello. I'm using ElunaLuaEngine on AzerothCore. I'm making a custom creature, and that creature is a CAST mob.

    However, the mob has the problem of continuing to run towards the player. It even made me constantly casting spells., It still approaches the player for a short time. Is there any way to prevent this?


    creature_template used the entry number 36620 as it is, and it was confirmed that it was only cast in place in the game. I only edited the model ID.
    Soulguard Adept - NPC - World of Warcraft


    I've checked a lot of shared Creature Lua scripts, but they all come up to the player and throw a jab.

    try list:

    - DB : AIName > TurretAI (NOT WOLK)
    - DB : xxxFlag things change (NOT WOLK)
    - Lua : Unit:AttackStop (NOT WOLK)
    - Lua : Unit:MoveXXXX (NOT WOLK)


    please help.. How to stop the jab...



    This is the script I used to get away from the player again.
    local x1, y1, z1 = creature:GetRelativePoint(math.random(6, 12), (math.random(math.pi / 12, math.pi * 2)));
    creature:CastSpell(creature:GetVictim(), 865, true)
    creature:MoveJump(x1, y1, z1, 15, 6)
    Last edited by holyreign; 02-05-2022 at 12:17 PM.

    [Eluna] How to custom creature stop melee attacks?
  2. #2
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    You can use SetReactState to stop the NPCs normal attack behaviour. You can also root the creature with SetRooted.

    Creature:SetReactState - Eluna
    Code:
    --Reactstates
    REACT_PASSIVE                                       = 0
    REACT_DEFENSIVE                                     = 1
    REACT_AGGRESSIVE                                    = 2
    Unit:SetRooted - Eluna

    Can you share the full Lua script that you are using and the issue? Is it that you want the NPC to stop chasing and fighting players temporarily, but still cast spells?

  3. #3
    holyreign's Avatar Member
    Reputation
    1
    Join Date
    Aug 2012
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Can you share the full Lua script that you are using and the issue? Is it that you want the NPC to stop chasing and fighting players temporarily, but still cast spells?
    Thank you for answer.
    What I want is to move as much as possible as a human being.
    Caster thinks it's right to stay away from Melee dealers.
    Caster can't run away smartly, but she wants to avoid getting too close.

    This is my full script.

    Code:
    local ENTRY_VEREESA = 90077;
    local combatIsDone = false;
    local VereesaWindrunner = {
      Spells = {
        71130,
        42846,
        71118,
      },
    };
    
    local magicInterrupt = 0;
    local isIcyVeinUse = false
    local isIceBlock = false
    
    
    function VereesaWindrunner.CastRandomSpell(eventId, dely, calls, creature)
      if not combatIsDone then
        if not creature:IsCasting() then
          local randomSpell = math.random(1, 3)
          if randomSpell == 71118 then
            local x1, y1, z1 = creature:GetVictim():GetRelativePoint(math.random(1, 2), (math.random(math.pi / 12, math.pi * 2)));
            creature:CastSpellAoF(x1, y1, z1, randomSpell)
          else
            creature:CastSpell(creature:GetVictim(), VereesaWindrunner.Spells[randomSpell])
          end
        end 
      end
    end
    
    function VereesaWindrunner.PantiRun(eventId, dely, calls, creature)
      if not combatIsDone then
        creature:CastSpell(creature:GetVictim(), 865, true) -- Frost Nova
        creature:CastSpell(creature, 14514, true) -- Blink
      end
    end
    
    function VereesaWindrunner.CombatEnd(event, delay, repeats, creature)
      creature:SetFaction(1760)
      combatIsDone = false
      creature:RemoveEvents()
    end
    
    
    function VereesaWindrunner.GiveUp(event, delay, repeats, creature)
        local player_unit = creature:GetVictim()
        local Player = GetPlayerByGUID(player_unit:GetGUID())
        combatIsDone = true
        creature:RemoveAllAuras()
        creature:StopSpellCast(0)
        creature:SendUnitYell("I'll give you this. Please...", 0)
        creature:SetHealth(creature:GetMaxHealth())
        creature:AttackStop()
        player_unit:AttackStop()
        player_unit:StopSpellCast(0)
        creature:ClearInCombat()
        player_unit:ClearInCombat()
        creature:PerformEmote(20)
        player_unit:PerformEmote(1)
        Player:AddItem(43102, 1) -- reward
        isIcyVeinUse = false
        isIceBlock = false
        magicInterrupt = 0
        creature:SetFaction(35)
        creature:MoveHome()
        creature:RegisterEvent(VereesaWindrunner.CombatEnd, 5000, 1)
    end
    
    function VereesaWindrunner.TrackingVictim(event, delay, repeats, creature)
      local victim = creature:GetVictim()
      local victimIsCast = victim:IsCasting()
    
      if victimIsCast and (magicInterrupt < 1) then
        creature:SendUnitYell("Nope!", 0)
        creature:CastSpell(victim, 65790, true)
        magicInterrupt = 15 -- 마차 쿨
      else 
        magicInterrupt = magicInterrupt - 1
      end
    end
    
    function VereesaWindrunner.CheckHealth(event, delay, repeats, creature)
        local HealthPct = creature:GetHealthPct()
    
        if (HealthPct <= 80 and HealthPct > 50) then
          if not isIcyVeinUse then
            creature:CastSpell(creature, 65547, true) -- Removes all movement impairing effects
            creature:CastSpell(creature, 12472, true) -- IcyVein
            creature:CastSpell(creature:GetVictim(), 7655, true) -- 디벞
            creature:CastSpell(creature:GetVictim(), 30449, true) -- spellsteal
            isIcyVeinUse = true
          end
        end
        if (HealthPct <= 40 and HealthPct > 30) then
          if not isIceBlock then
            creature:CastSpell(creature, 65547, true) -- Removes all movement impairing effects
            creature:CastSpell(creature, 29842, true) -- second-wind
            creature:CastSpell(creature, 36911, true) -- IceBlock
            isIceBlock = true
          end
        end
        if (HealthPct <= 20 and HealthPct >= 1) then
          creature:RegisterEvent(VereesaWindrunner.GiveUp, 1000, 1)
        end
    end
    
    function VereesaWindrunner.OnEnterCombat(event, creature, target)
        creature:SetReactState(1) -- still following if 0 can't attack player
        creature:RegisterEvent(VereesaWindrunner.CastRandomSpell, 500, 0)
        creature:RegisterEvent(VereesaWindrunner.CheckHealth, 1000, 0)
        creature:RegisterEvent(VereesaWindrunner.TrackingVictim, 1000, 0)
        creature:RegisterEvent(VereesaWindrunner.PantiRun, {5000, 12000}, 0)
    end
    
    function VereesaWindrunner.OnLeaveCombat(event, creature)
        isIcyVeinUse = false
        isIceBlock = false
        combatIsDone = false
        creature:RemoveEvents()
    end
    
    function VereesaWindrunner.OnDied(event, creature, killer)
        if(killer:GetObjectType() == "Player") then
            killer:SendBroadcastMessage("You killed " ..creature:GetName().."!")
            creature:Respawn()
        end
        creature:RemoveEvents()
    end
    
    RegisterCreatureEvent(ENTRY_VEREESA, 1, VereesaWindrunner.OnEnterCombat)
    RegisterCreatureEvent(ENTRY_VEREESA, 2, VereesaWindrunner.OnLeaveCombat)
    RegisterCreatureEvent(ENTRY_VEREESA, 4, VereesaWindrunner.OnDied)

    i'm try this

    SetReactState
    REACT_PASSIVE = 0 // can't attack player
    REACT_DEFENSIVE = 1 // still move

    SetRooted(true) // It was very close to what I wanted, but it didn't move at all when I hid behind a wall.

    thanks again !

Similar Threads

  1. How to customized Bosses and the Loots
    By Asbfaw in forum WoW EMU Guides & Tutorials
    Replies: 10
    Last Post: 11-16-2009, 01:41 PM
  2. How to find Creature ID
    By finalball in forum World of Warcraft Guides
    Replies: 2
    Last Post: 03-02-2009, 06:24 AM
  3. [Tutorial: How to customize NPC Talk Texts]
    By Syrup in forum WoW EMU Guides & Tutorials
    Replies: 1
    Last Post: 09-25-2008, 08:29 PM
  4. How to:Custom Gm announcement ranks
    By Ezxen in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 05-14-2008, 10:30 PM
  5. how to change Creature green to hostile or reverse
    By marcosgue in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 02-06-2008, 09:13 AM
All times are GMT -5. The time now is 07:27 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