Would this Lua script work as I am unable to test on my computer. menu

User Tag List

Results 1 to 14 of 14
  1. #1
    ScarySheep's Avatar Member
    Reputation
    10
    Join Date
    Oct 2009
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Would this Lua script work as I am unable to test on my computer.

    Would this Lua script work as I am unable to test it on my computer?
    Can someone please tell me if it would work and what errors are in it.
    Thank-you.
    //(I hope that is the comment button :|) First ever Lua script by me (Tom)
    function Demon_OnCombat(Unit, Event)
    Unit:SendChatMessage(14, 0, "You have chosen annialation!")
    end

    function Demon_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    end

    function Demon_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(14, 0, "Puny, pathetic creature; you have failed to defeat me, my masters reign of terror shal continue!")
    end

    function Demon_OnDied(Unit, Event)
    Unit:SendChatMessage(14, 0, "You may have successfully put an end to me but you shal never put an end to my master!")
    Unit:SendChatMessage(14, 8, "/cough This is inpossible, how have you achived this! Master, ready your magic the reconing has come!")
    Unit:RemoveEvents()
    end

    function Demon_OnSpawn(Unit, Event)
    Unit:SetScale(2)
    Unit:SendChatMessage(14, 0, "I guard the dephs of the maelstrom, second only to Deathwing himself.")
    Unit:SendChatMessage(14, 0, "Enrage me, you enrage my master!")
    end

    function Demon_PlayerInRange(Unit, Event)
    Unit:SendChatMessage(14, 0, "So you have chosen death!")
    end

    function Demon_Spell1(Unit, Event)
    Unit:SendChatMessage(14, 0, "Prepare to DIE!")
    Unit:FullCastSpellOnTarget(47838, Unit:GetClosestPlayer()
    end
    end

    function Demon_Phase1(Unit, Event)
    if Unit:GetHealthPct() <= 35 then
    Unit:SendChatMessage(14, 0, "Die!.")
    Unit:CastSpell(47809)
    end
    end

    RegisterUnitEvent(10430, 1, "Demon_OnCombat")
    RegisterUnitEvent(10430, 2, "Demon_OnLeaveCombat")
    RegisterUnitEvent(10430, 3, "Demon_OnKilledTarget")
    RegisterUnitEvent(10430, 4, "Demon_OnDied")
    RegisterUnitEvent(10430, 6, "Demon_OnSpawn")
    RegisterUnitEvent("Demon_Spell1", 10000, 10)
    RegisterUnitEvent("Demon_Phase1", 5000, 1)
    end

    I am trying to learn Lua so I can get out of 'the leach'. Don't moan at me if I have spelling mistakes, I can't be bothered to correct them, also I cannot be bothered to pick a good name for 'his master' as I am very lazy.

    Would this Lua script work as I am unable to test on my computer.
  2. #2
    Sounddead's Avatar Contributor
    Reputation
    160
    Join Date
    Sep 2007
    Posts
    1,126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't need an end on the bottom and uh, the comment thing is -- not //. Good shit otherwise.

    I live in a shoe

  3. #3
    ScarySheep's Avatar Member
    Reputation
    10
    Join Date
    Oct 2009
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay I will change them. So apart from that it works? Thanks for the help +rep if I can.

  4. #4
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I love to see people trying

    Its a good scripts dude just that one error on the 'end'
    +3 rep

    there only 1 left, thanks for making an effort unlike many others in this community
    Lunar Gaming - Reaching For The Stars

  5. #5
    ScarySheep's Avatar Member
    Reputation
    10
    Join Date
    Oct 2009
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just want to get out of the leacher status but I have no idea how people make the more complex scripts, I want to become a contributor someday. Thanks for the rep mager.
    Last edited by ScarySheep; 12-21-2009 at 05:11 PM. Reason: Spelling mistakes :S.

  6. #6
    ScarySheep's Avatar Member
    Reputation
    10
    Join Date
    Oct 2009
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, would this script work even if I used a NPC id as the model id or whatever it is, it is meant to be a 'Towelie' mob from southpark (using the flying carpet npc id) I don't know if it will work, can people tell me what they think of it and if it will work?
    -- This is not meant to be a boss, it just has boss phrases, it is towlie. --



    function Towelie_OnCombat(Unit, Event)
    Unit:SendChatMessage(12, 0, "I am Towelie and I am going to make you shittt highhh")
    SetPlayerSpeed(RUN,500)
    Unit:SendChatMessage(12, 0, "Let's get high!")
    end

    function Towelie_OnSpawn
    Unit:SendChatMessage(12, 0, "Whoa, I am actully a Towel!"
    Unit:SendChatMessage(12, 0, "If you can kill my 100000 little fibers I will make you high!")
    Unit:SendChatMessage(12, 0, "Do you want to be high?")
    end
    end

    function Towelie_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    SetPlayerSpeed(RUN,1)
    end

    function Towelie_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(12, 0, "Oh dear, you didn't really want to get high then?") -- searosly, how do you die when I have casted uber heal over time O_O?
    end

    function Towelie_OnDied(Unit, Event)
    Unit:SendChatMessage(12, 0, "YAY, YOU ACTULLY GOT HIGH")
    SetPlayerSpeed(run,1)
    Unit:RemoveEvents()
    end

    function Towelie_Phase1(Unit, Event)
    if Unit:GetHealthPct() < 100 then
    Unit:SendChatMessage(14, 0, "LETS GET HIGH")
    Unit:FullCastSpellOnTarget(1908, Unit:GetRandomPlayer(0))
    end
    end

    function Towelie_Phase2(Unit, Event)
    if Unit:GetHealthPct() <20
    Unit:SendChatMessage(12, 0, "The high is going..."(
    Unit:FullCastSpellOnTarget(30839, Unit:GetRandomPlayer(0))
    end
    end

    RegisterUnitEvent(25460, 1, "Towelie_OnCombat")
    RegisterUnitEvent(25460, 2, "Towelie_OnLeaveCombat")
    RegisterUnitEvent(25460, 3, "Towelie_OnKilledTarget")
    RegisterUnitEvent(25460, 4, "Towelie_OnDied")
    RegisterUnitEvent(25460, 6, "Towelie_OnSpawn")
    RegisterUnitEvent("Towelie_Phase1", 5000, 1)
    RegisterUnitEvent("Towelie_Phase2", 30000, 1)

  7. #7
    RyeRye's Avatar Contributor
    Reputation
    240
    Join Date
    Aug 2008
    Posts
    996
    Thanks G/R
    0/1
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ScarySheep View Post
    Also, would this script work even if I used a NPC id as the model id or whatever it is, it is meant to be a 'Towelie' mob from southpark (using the flying carpet npc id) I don't know if it will work, can people tell me what they think of it and if it will work?
    If I understand what your saying it wouldn't work. You would have to make a new NPC with the display of the flying carpet.
    Fixed your script: (highlighted the errors red)

    -- This is not meant to be a boss, it just has boss phrases, it is towlie. --

    function Towelie_OnSpawn -- changed the order of it, I like to be neat(it doesnt have to be changed though)
    Unit:SendChatMessage(12, 0, "Whoa, I am actully a Towel!"
    ) --forgot a )
    Unit:SendChatMessage(12, 0, "If you can kill my 100000 little fibers I will make you high!")
    Unit:SendChatMessage(12, 0, "Do you want to be high?")
    end

    end
    -- you don't need two ends here.

    function Towelie_OnCombat(Unit, Event)
    Unit:SendChatMessage(12, 0, "I am Towelie and I am going to make you shittt highhh")
    SetPlayerSpeed(RUN,500)
    Unit:SendChatMessage(12, 0, "Let's get high!")
    end

    function Towelie_Phase1(Unit, Event)
    --changed order.
    if Unit:GetHealthPct() < 100 then
    Unit:SendChatMessage(14, 0, "LETS GET HIGH")
    Unit:FullCastSpellOnTarget(1908, Unit:GetRandomPlayer(0))
    end
    end --you don't need 2 ends here.

    function Towelie_Phase2(Unit, Event)
    if Unit:GetHealthPct() <20
    Unit:SendChatMessage(12, 0, "The high is going..."
    ) --fixed it was (
    Unit:FullCastSpellOnTarget(30839, Unit:GetRandomPlayer(0))
    end
    end -- don't need 2 ends.

    function Towelie_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    SetPlayerSpeed(RUN,1)
    end

    function Towelie_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(12, 0, "Oh dear, you didn't really want to get high then?") -- searosly, how do you die when I have casted uber heal over time O_O?
    end

    function Towelie_OnDied(Unit, Event)
    Unit:SendChatMessage(12, 0, "YAY, YOU ACTULLY GOT HIGH")
    SetPlayerSpeed(run,1)
    Unit:RemoveEvents()
    end

    RegisterUnitEvent(25460, 1, "Towelie_OnCombat")
    RegisterUnitEvent(25460, 2, "Towelie_OnLeaveCombat")
    RegisterUnitEvent(25460, 3, "Towelie_OnKilledTarget")
    RegisterUnitEvent(25460, 4, "Towelie_OnDied")
    RegisterUnitEvent(25460, 6, "Towelie_OnSpawn")
    RegisterUnitEvent("Towelie_Phase1", 5000, 1)
    RegisterUnitEvent("Towelie_Phase2", 30000, 1)

    Suggestions: When they get "high" add like a daze spell to them? Like a drunk spell, so its all blurry on there screen. And it looks good for a first script!
    Last edited by RyeRye; 12-22-2009 at 12:04 AM.



  8. #8
    ScarySheep's Avatar Member
    Reputation
    10
    Join Date
    Oct 2009
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thankyour for the infomation and help, I would +Rep you but I have run out of rep to give .

  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)
    Well, there are quite a few errors that I will point out that none of you have spotted and iRaw got wrong.

    Code:
    --(I hope that is the comment button :|) First ever Lua script by me (Tom)    -- not // as a few of you noticed
    function Demon_OnCombat(Unit, Event)
    Unit:SendChatMessage(14, 0, "You have chosen annialation!")
    end
    
    function Demon_OnLeaveCombat(Unit, Event)
    Unit:RemoveEvents()
    end
    
    function Demon_OnKilledTarget(Unit, Event)
    Unit:SendChatMessage(14, 0, "Puny, pathetic creature; you have failed to defeat me, my masters reign of terror shal continue!")
    end
    
    function Demon_OnDied(Unit, Event)
    Unit:SendChatMessage(14, 0, "You may have successfully put an end to me but you shal never put an end to my master!")
    Unit:SendChatMessage(14, 8, "/cough This is inpossible, how have you achived this! Master, ready your magic the reconing has come!") -- You sure you want language 8?
    Unit:RemoveEvents()
    end
    
    function Demon_OnSpawn(Unit, Event)
    Unit:SetScale(2)
    Unit:SendChatMessage(14, 0, "I guard the dephs of the maelstrom, second only to Deathwing himself.")
    Unit:SendChatMessage(14, 0, "Enrage me, you enrage my master!")
    end
    
    function Demon_PlayerInRange(Unit, Event)
    Unit:SendChatMessage(14, 0, "So you have chosen death!")
    end
    
    function Demon_Spell1(Unit, Event)
    Unit:SendChatMessage(14, 0, "Prepare to DIE!")
    Unit:FullCastSpellOnTarget(47838, Unit:GetClosestPlayer()) -- You missed a ) here since you open ( get closest player () then you need to close again )
    end
    --end -- Don't need this end
    
    function Demon_Phase1(Unit, Event)
    if Unit:GetHealthPct() <= 35 then
    Unit:SendChatMessage(14, 0, "Die!.")
    Unit:CastSpell(47809)
    end -- Yes we DO need two ends here because of the if statement
    end
    
    RegisterUnitEvent(10430, 1, "Demon_OnCombat")
    RegisterUnitEvent(10430, 2, "Demon_OnLeaveCombat")
    RegisterUnitEvent(10430, 3, "Demon_OnKilledTarget")
    RegisterUnitEvent(10430, 4, "Demon_OnDied")
    RegisterUnitEvent(10430, 6, "Demon_OnSpawn")
    --RegisterUnitEvent("Demon_Spell1", 10000, 10) -- This will not work since it's being globaly registered
    --RegisterUnitEvent("Demon_Phase1", 5000, 1) -- The correct way would to be to put it into a function Unit:RegisterEvent...
    --end -- Not needed as you spotted

  10. #10
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,504
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    RegisterUnitEvent(25460, 18, "Towelie_OnSpawn") because 18 is on Spawn.

  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 Ground Zero View Post
    RegisterUnitEvent(25460, 18, "Towelie_OnSpawn") because 18 is on Spawn.

    Depends what engine they use, it's only been 18 with GuaEngine, LuaAppArc and LuaHypArc. Aspire engines still use 6 I think.

  12. #12
    RyeRye's Avatar Contributor
    Reputation
    240
    Join Date
    Aug 2008
    Posts
    996
    Thanks G/R
    0/1
    Trade Feedback
    3 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops. I missed a few then, thanks stone.



  13. #13
    ScarySheep's Avatar Member
    Reputation
    10
    Join Date
    Oct 2009
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thankyou all of you for your help, where can I find a good Lua tutorial what can go further than just boss fights?

  14. #14
    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 ScarySheep View Post
    Thankyou all of you for your help, where can I find a good Lua tutorial what can go further than just boss fights?
    Just browse the emulater server guides section, it's not hard.

Similar Threads

  1. Will this teleporter npc lua script work?
    By Bapes in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 05-22-2008, 11:50 AM
  2. [helpzerz] What is wrong with this lua script?
    By w21froster in forum World of Warcraft Emulator Servers
    Replies: 8
    Last Post: 05-21-2008, 09:45 PM
  3. Whats wrong with this LUA Script?
    By controlsx2 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 05-20-2008, 03:03 PM
  4. Help with this LUA script
    By jordash in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 03-08-2008, 04:19 PM
  5. How to fix this LUA Script???
    By marcosgue in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 02-08-2008, 07:51 AM
All times are GMT -5. The time now is 11:19 AM. 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