LUA - Unable to get mob to cast on Target menu

User Tag List

Results 1 to 3 of 3
  1. #1
    vb4evr's Avatar Member
    Reputation
    22
    Join Date
    Oct 2007
    Posts
    113
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA - Unable to get mob to cast on Target

    So here is my problem, I've just started teaching myself LUA and have run into a problem. I've searched tons of posts and alot of people have the same problem where when the mob casts the spell it casts it on itself. I have tried it numerous ways GetClosestPlayer() GetMainTank() and always casts on itself. I am running the most recent trunk version (Could this possibly be the problem?, or perhaps my lua script) Anyhow, hopefully someone can shed some light on it.

    Code:
    function ManaWyrm_GenCast(pUnit, event)
    --1st we declare local variables
    local nSpell = math.random(0,100) --number of random general spells for mob, in this case 2. Random 0 and Random 1
    local nCheck = math.random(0,3) 
    local plr = pUnit:GetRandomPlayer(0)
    -- Check if we are casting a spell. 75% chance
    if nCheck > 0 then
    --Check nSpell to see what spell/skill we case
    if nSpell > 70 and nSpell < 90 then
    if (plr ~= nil) then pUnit:FullCastSpellOnTarget(36100,plr) end
    elseif nSpell >= 90 and nSpell < 99 then
    if (plr ~= nil) then pUnit:FullCastSpellOnTarget(6950,plr) end
    elseif nspell == 99 or nSpell == 100 then
    if (plr ~= nil) then pUnit:FullCastSpellOnTarget(16460,plr)end
    else
    if (plr ~= nil) then pUnit:FullCastSpellOnTarget(17253, plr)end
    end
    end
    end
    function ManaWyrm_OnCombat(Unit, event)
    Unit:RegisterEvent("ManaWyrm_GenCast",4000,0) -- Goes into ManaWyrm_GenCast every 4 seconds.
    end
    RegisterUnitEvent(15274, 1, "ManaWyrm_OnCombat")
    
    Last edited by vb4evr; 03-06-2008 at 10:02 PM. Reason: UPdated code to working

    LUA - Unable to get mob to cast on Target
  2. #2
    Mr.Ice.Cold's Avatar Active Member
    Reputation
    26
    Join Date
    Apr 2007
    Posts
    166
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try somthing like this..

    Code:
        local plr = pUnit:GetRandomPlayer(0)
       if (plr ~= nil) then
        pUnit:FullCastSpellOnTarget(32014, plr)

  3. #3
    vb4evr's Avatar Member
    Reputation
    22
    Join Date
    Oct 2007
    Posts
    113
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Cece.
    I think I had tried everything with the exception of the pUnit:FullCastSpellOnTarget function which seems to work perfectly.

    Thanks again
    +Rep

Similar Threads

  1. [Lua] Mobs always cast spells on themselves. Not the target
    By Wheeze201 in forum WoW EMU Questions & Requests
    Replies: 10
    Last Post: 08-17-2009, 09:12 AM
  2. Replies: 1
    Last Post: 03-23-2008, 11:34 PM
  3. lua guide on spawning mobs after death
    By runiker in forum WoW EMU Guides & Tutorials
    Replies: 2
    Last Post: 03-10-2008, 01:57 AM
  4. [Question] hmm, how do i make a mob rapidly cast spells?
    By Creepfold in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 12-27-2007, 10:38 AM
  5. [GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc
    By Greed in forum WoW EMU Guides & Tutorials
    Replies: 6
    Last Post: 12-10-2007, 07:51 PM
All times are GMT -5. The time now is 04:30 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