[Guide][LUA] Make a mob speak/use spell on a %! menu

User Tag List

Results 1 to 15 of 15
  1. #1
    Meltoor's Avatar Contributor
    Reputation
    146
    Join Date
    Jan 2007
    Posts
    292
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Guide][LUA] Make a mob speak/use spell on a %!

    Okay, I've found a way how to make a mob do something on a certain % with LUA.
    Many people said that we need C++ for that, but that FALSE!
    Here's the script!

    This will make a mob speak at 75%.

    You have to change the red words in it.

    Code:
    buffer = 0
    function testmob_phase(unit)
    local percento = unit:GetHealthPct()
        if buffer == 0 then
        if (percento <= 75) then
        buffer = 1
        unit:SendChatMessage(12, 0, "Speak something")
    --You can insert random other commands here, such as Castspell and etc, what you want your mob to do.
    end
    end
    end
    
    function testmob_entercombat(unit)
        buffer = 0
        unit:RegisterEvent("testmob_phase",3000, 0)
    end
    
    function testmob_LeaveCombat(unit)
        buffer = 0
    end
    
    RegisterUnitEvent(12345, 1, "testmob_entercombat")
    RegisterUnitEvent(12345, 2, "testmob_leavecombat")
    Looks a bit difficult? Let me help.

    testmob = the name of the function, name it whatever you want, but name it on every place.
    75 = the precent of when the mob should do the action.
    Speak something = The text you want the mob to say.
    3000 = Important! This is the delay of checking if his hp is below the current precent or not. Don't change it, I will explain this further.

    =====FAQ=====


    Q: Please tell me how is this working!
    A: This checks the mob's hp's precent within a delay, which is now for
    3000 example
    Q: Why can't we use AI_Tick?
    A: I couldn't get that work, besides this would not lag the server that much since it's not trying to check it continously.
    Q: What does "buffer" mean?
    A: The function is being checked every
    3000 (=3 sec), and let's say you're doing the boss, it gets below the HP and it would trigger the function always, meaning it would continously do the function (Speak for example).
    "buffer" variable makes that it will trigger only one time, and resetting it if the mob gets out of combat/gets in combat.

    I know this full thing is a bit hard-to-understand, so if you have any problem, post it in this section, I will help.

    You can change the
    3000 to something lower, like 1000 (so the delay would be 1sec) if you're killing a low hp mob or whatsoever, it's up to you
    Last edited by Meltoor; 01-10-2008 at 05:11 PM.

    [Guide][LUA] Make a mob speak/use spell on a %!
  2. #2
    Dee2001's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    53
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    uuhhh in this code if u change the unit:SendChatMessage(12, 0, "Speak something")

    too unit:castspell()



    would that work ??

  3. #3
    zerohero's Avatar Member
    Reputation
    3
    Join Date
    May 2007
    Posts
    30
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    would :

    buffer = 2
    function testmob_phase(unit)
    local percento = unit:GetHealthPct()
    if buffer == 2 then
    if (percento <= 75) then
    buffer = 1
    unit:SendChatMessage(12, 0, "Speak something")

    if buffer == 2 then
    if (percento <= 40) then
    buffer = 1
    unit:SendChatMessage(12, 0, "Speak something ELSE")
    end
    end
    end

    function testmob_entercombat(unit)
    buffer = 0
    unit:RegisterEvent("testmob_phase",3000, 0)
    end

    function testmob_LeaveCombat(unit)
    buffer = 0
    end

    RegisterUnitEvent(12345, 1, "testmob_entercombat")
    RegisterUnitEvent(12345, 2, "testmob_leavecombat")

  4. #4
    Meltoor's Avatar Contributor
    Reputation
    146
    Join Date
    Jan 2007
    Posts
    292
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    buffer = 2
    function testmob_phase(unit)
    local percento = unit:GetHealthPct()
    if buffer == 2 then
    if (percento <= 75) then
    buffer = 1
    unit:SendChatMessage(12, 0, "Speak something")

    if buffer == 2 then
    if (percento <= 40) then
    buffer = 1
    unit:SendChatMessage(12, 0, "Speak something ELSE")
    end
    end
    end

    function testmob_entercombat(unit)
    buffer = 2
    unit:RegisterEvent("testmob_phase",3000, 0)
    end

    function testmob_LeaveCombat(unit)
    buffer = 2
    end

    Now it would work. But I don't advise you to change the value of the buffer since it's clearly not neccesary, also it can easily make the whole script don't work properly.




    Originally Posted by Dee2001 View Post
    uuhhh in this code if u change the unit:SendChatMessage(12, 0, "Speak something")

    too unit:castspell()



    would that work ??
    Yes, it would work. That is the point, you can add your own code!
    Last edited by Meltoor; 01-10-2008 at 05:09 PM.

  5. #5
    zerohero's Avatar Member
    Reputation
    3
    Join Date
    May 2007
    Posts
    30
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can u help me out???? i can seem to get it to work.... can u set up an example? lets say with ILLidaN? ID 22917..... thnks ( and possible make him cast healing spell???? thnkx

  6. #6
    entrepid's Avatar Member
    Reputation
    7
    Join Date
    Nov 2007
    Posts
    66
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea id also like to know what to do with it and how i link it to a mob

  7. #7
    Dee2001's Avatar Member
    Reputation
    8
    Join Date
    Aug 2007
    Posts
    53
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how do u get a lua script to work i have scripts folder and everything. do i add the extention .LUA on the end ???

  8. #8
    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)
    No offense, but you totally stole my idea :P
    Anyway, this is a pretty bad way of making phases between bosses. Using this method, any called functions in phase one would persist through phase 2 and so on. Using "Buffer" or "didthat" is bound to fail.

    I recommend looking at my new guide and using Unit:RemoveEvents()
    Life Puzzler WoW - Website | Forums

  9. #9
    Meltoor's Avatar Contributor
    Reputation
    146
    Join Date
    Jan 2007
    Posts
    292
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. You are wrong, totally, using that is variable is like a switch, which you turn off when the spell was used 1time. "Unit:RemoveEvents()" is needed after every phase, that's true
    2. Stole "your" idea? Since when do you think I'd steal anybody's work or anything else? EVEN I posted this a little faster then you as I know. I'm offended because of the statement.
    Last edited by Meltoor; 01-12-2008 at 12:16 PM.

  10. #10
    yojimbojk's Avatar Member
    Reputation
    1
    Join Date
    Jan 2008
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm it doent seem to work on mine

  11. #11
    Meltoor's Avatar Contributor
    Reputation
    146
    Join Date
    Jan 2007
    Posts
    292
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please post your screen so I might be able to help you.

  12. #12
    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)
    Jeez Meltoor, i was just kidding : /
    Life Puzzler WoW - Website | Forums

  13. #13
    Illidan1's Avatar Banned
    Reputation
    244
    Join Date
    Jul 2007
    Posts
    2,251
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol, when your Elite User gastric, every one Be leaves you.. lol

  14. #14
    Meltoor's Avatar Contributor
    Reputation
    146
    Join Date
    Jan 2007
    Posts
    292
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Gastric View Post
    Jeez Meltoor, i was just kidding : /
    Hm.. mkay, I wasn't in the mood when I made ze post

  15. #15
    Xtinction's Avatar Member
    Reputation
    11
    Join Date
    Jan 2008
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool Dude nice guide +Rep

Similar Threads

  1. [LUA] Let a mob cast a spell, On another mob
    By Skatee in forum WoW EMU Guides & Tutorials
    Replies: 3
    Last Post: 07-13-2009, 09:54 AM
  2. [Question] Make a Mob Cast a Spell When Critted?
    By kevinno in forum World of Warcraft Emulator Servers
    Replies: 17
    Last Post: 05-27-2008, 07:10 PM
  3. [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
  4. [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 06:05 PM. 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