Help: Make an NPC channel a spell. menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Nicholax80's Avatar Corporal
    Reputation
    1
    Join Date
    Aug 2010
    Posts
    34
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help: Make an NPC channel a spell.

    I need some help here. I'm a newer server owner, and I'm trying to figure out how to make an NPC channel a spell, as decoration, so to speak. You see, I've got a custom area, and a Dalaran bubble spawned, covering this place. What I'm trying to get, is the 4 mages I have spawned in the right places, to look like they're channeling a spell to keep that bubble up.

    I've been trying and can't figure it out. If someone could make an Lua script for me, or guide me through my HeidiSQL to accomplish it there, that would be great.

    I'm using a Kirin Tor Battle-Mage (Entry = 91011)

    +Rep to all who try to help me.

    ---------- Post added at 01:55 PM ---------- Previous post was at 12:43 PM ----------

    I have this so far, and I'm getting an error.

    ---------------------------------------------

    function NPCCHANNEL(91011, event)
    if(unit:GetClosestEnemy()~=nil) then
    unit:ChannelSpell(47855, unit:GetClosestEnemy()) -- Drain Soul
    end
    end

    -------------------------------------------------

    I'm getting,

    scripts/Channeling.lua:1: <name> or '...' expected near '91011'

    So, what needs to be fixed?

    Help: Make an NPC channel a spell.
  2. #2
    Pharcide's Avatar Member
    Reputation
    18
    Join Date
    Jul 2009
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    function NPCCHANNEL(91011, event)
    you can't have just a value as a function parameter, if you want to send it 91011, have the function take in an int or whatever the Lua equivalent is, and pass it 91011

  3. #3
    Nicholax80's Avatar Corporal
    Reputation
    1
    Join Date
    Aug 2010
    Posts
    34
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok I'm not so great with Lua language, lol. Please, give me an example.

    I +Rep 'ed you already.

  4. #4
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function NPCCHANNEL(unit, event)
        unit:ChannelSpell(47855, unit:GetCreatureNearestCoords(x,y,z,entryid)
    end
    
    RegisterUnitEvent(91011, 18, "NPCCHANNEL")
    Change x, y, z to the position of the creature your trying to channel on and the entryid to the creature your trying to channel on.

    To channel to a location simple make a invisible creature (displayid 4, scale 0.01), move him to where you want (.way addfly) then /target nameofcreature and do .mod flags -10. This makes the creature invisible at the location, then you can channel to that creature and it will look like that position.

  5. #5
    Pharcide's Avatar Member
    Reputation
    18
    Join Date
    Jul 2009
    Posts
    28
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nvm, do what stoneharry said
    Last edited by Pharcide; 09-06-2010 at 01:25 PM. Reason: beat me to it

  6. #6
    Nicholax80's Avatar Corporal
    Reputation
    1
    Join Date
    Aug 2010
    Posts
    34
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, stoneharry. I gave you rep. Now to see if this works.

  7. #7
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I missed a ) on the end of it btw. It should be:

    Code:
    function NPCCHANNEL(unit, event)
        unit:ChannelSpell(47855, unit:GetCreatureNearestCoords(x,y,z,entryid))
    end
    
    RegisterUnitEvent(91011, 18, "NPCCHANNEL")

  8. #8
    Nicholax80's Avatar Corporal
    Reputation
    1
    Join Date
    Aug 2010
    Posts
    34
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I made the changes and am loading it up now, but even yet, before the changes, the error came up in my World.exe and says

    scripts/Channeling.lua:1: <name> or '...' expected near '91011'

    ---------- Post added at 02:38 PM ---------- Previous post was at 02:37 PM ----------

    Well, loading it this time, the World.exe did not give me that error. Lets see if this worked. *Praying* lol

    ---------- Post added at 02:40 PM ---------- Previous post was at 02:38 PM ----------

    Ok so the script was loaded and what-not, but the npc's are still not doing anything.



    ---------- Post added at 02:41 PM ---------- Previous post was at 02:40 PM ----------

    function NPCCHANNEL(unit, event)
    unit:ChannelSpell(47855, unit:GetCreatureNearestCoords(5260.15,-2162.73,1260.70,7395))
    end

    RegisterUnitEvent(91011, 18, "NPCCHANNEL")

  9. #9
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function zegeaygeaygeaa(unit, event)
        unit:RegisterEvent("test_Test_test_onetwothree", 2500, 0)
        --unit:ChannelSpell(47855, unit:GetCreatureNearestCoords(x,y,z,entryid))
    end
    
    function test_Test_test_onetwothree(unit)
        local plr = pUnit:GetClosestPlayer()
        if plr ~= nil then
        unit:RemoveEvents()
        unit:ChannelSpell(47855, plr)
        end
    end
    
    RegisterUnitEvent(91011, 18, "zegeaygeaygeaa")
    Test that.

  10. #10
    Nicholax80's Avatar Corporal
    Reputation
    1
    Join Date
    Aug 2010
    Posts
    34
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are there things in that script that I need to change?

  11. #11
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Nicholax80 View Post
    Are there things in that script that I need to change?
    No. That script gets your npc (91011) and then when it spawns every 2.5 seconds checks for a nearby player, if it finds one it stops checking and channels the spell on them.

    This allows you to check whether the spell actually channels properly.

  12. #12
    Nicholax80's Avatar Corporal
    Reputation
    1
    Join Date
    Aug 2010
    Posts
    34
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright it loaded. Testing now.

    It's not working.

    NOTE: This is repeating in my World.exe

    scripts\channeling.lua:7: attempt to index global 'punit' <a nil value>

  13. #13
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Sorry, force of habbit.

    Change line 7,
    from: pUnit:GetClosestPlayer()
    To:
    unit:GetClosestPlayer()

    edit: or just use this script:

    Code:
    function zegeaygeaygeaa(unit, event)
        unit:RegisterEvent("test_Test_test_onetwothree", 2500, 0)
        --unit:ChannelSpell(47855, unit:GetCreatureNearestCoords(x,y,z,entryid))
    end
    
    function test_Test_test_onetwothree(unit)
        local plr = unit:GetClosestPlayer()
        if plr ~= nil then
        unit:RemoveEvents()
        unit:ChannelSpell(47855, plr)
        end
    end
    
    RegisterUnitEvent(91011, 18, "zegeaygeaygeaa")

    Last edited by stoneharry; 09-06-2010 at 02:02 PM.

  14. #14
    Nicholax80's Avatar Corporal
    Reputation
    1
    Join Date
    Aug 2010
    Posts
    34
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Testing that now. World.exe is loading.

    ---------- Post added at 03:03 PM ---------- Previous post was at 03:00 PM ----------

    RegisterUnitEvent(91011, 18, "zegeaygeaygeaa")


    Where does that go?

  15. #15
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Nicholax80 View Post
    Testing that now. World.exe is loading.

    ---------- Post added at 03:03 PM ---------- Previous post was at 03:00 PM ----------

    RegisterUnitEvent(91011, 18, "zegeaygeaygeaa")


    Where does that go?
    Bottom of the script.

    The RegisterUnitEvent tells the server your registering a script for a unit, and then you follow with the npc id, type of event and the name of the function that it's going to trigger. Event 18 = on spawn, so on spawn the function is called and the script starts... This is basic stuff, you should have read a guide or two before trying to script Lua to be honest.


Page 1 of 2 12 LastLast

Similar Threads

  1. [Trinity] How do I make a NPC cast some spell on his Summoner
    By chaplisimo in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 08-29-2014, 05:48 PM
  2. Replies: 9
    Last Post: 09-20-2008, 07:53 PM
  3. [HELP]making skill npc(please help)
    By Kazard123 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 06-27-2008, 09:32 AM
  4. 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
  5. [Help] Making a NPC Teach you spells
    By Haza in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 12-18-2007, 11:45 AM
All times are GMT -5. The time now is 02:26 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