LUA thread! Post nonworking LUA's or FIX non working LUA's menu

User Tag List

Page 1 of 3 123 LastLast
Results 1 to 15 of 35
  1. #1
    Tikki100's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2008
    Posts
    83
    Thanks G/R
    3/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA thread! Post nonworking LUA's or FIX non working LUA's

    Well this thread is for all ho needs help with lua, or ho knows lua. They can give +Rep to help you or you can help them. Instead of everytime we get a new post lets put it in one thread. Thankyou.

    Tikki

    LUA thread! Post nonworking LUA's or FIX non working LUA's
  2. #2
    Tikki100's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2008
    Posts
    83
    Thanks G/R
    3/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll start. My proplem is that this LUA dont work. i want it to teleport me and cast that spell on me. so can you please help :?

    HTML Code:
    function ENTER_On_Gossip(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(2, "I'll would like to enter the City!", 301, 0)
    unit:GossipSendMenu(player)
    end
    
    function ENTER_Gossip_Submenus(unit, event, player, id, intid, code)
    
    if (intid == 301) then
    player:SendBroadcastMessage("Fine. You will be a murloc into you Exit.")
    pUnit:CastSpell(45278)
    player:Teleport(1, 4520.217773, -2085.955566, 1192.769165)
    pUnit:GossipComplete(player)
    end
    end
    
    RegisterUnitGossipEvent(250005, 1, "ENTER_On_Gossip")
    RegisterUnitGossipEvent(250005, 2, "ENTER_Gossip_Submenus")

  3. #3
    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)
    It's a great idea for a thread. If people start using this, well great
    As for your problem, you need to be more precise, whats the error in console, what is not working etc.
    The error I can see from looking at it like this, is that you havn't told the npc to cast the spell on the player. You told it to to cast it on it's self.
    You need to change:
    pUnit:CastSpell(4527
    to
    pUnit:FullCastSpellOnTarget(45278, player)

    The reason I put Full instead of without, is it often helps with certain spells where as it would not work without it.

    Edit:

    Add another option, otherwise it goes straight into the gossip.
    Like this:

    Code:
    function ENTER_On_Gossip(unit, event, player)
    unit:GossipCreateMenu(3544, player, 0)
    unit:GossipMenuAddItem(2, "I'll would like to enter the City!", 301, 0)
    unit:GossipMenuAddItem(2, "Nevermind", 302, 0)
    unit:GossipSendMenu(player)
    end
    function ENTER_Gossip_Submenus(unit, event, player, id, intid, code)
    if (intid == 301) then
    player:SendBroadcastMessage("Fine. You will be a murloc into you Exit.")
      pUnit:FullCastSpellOnTarget(45278, player)
    player:Teleport(1, 4520.217773, -2085.955566, 1192.769165)
    pUnit:GossipComplete(player)
    end
    if (intid == 302) then
    player:SendBroadcastMessage("Bye Bye")
    pUnit:GossipComplete(player)
    end
    end
    RegisterUnitGossipEvent(250005, 1, "ENTER_On_Gossip")
    RegisterUnitGossipEvent(250005, 2, "ENTER_Gossip_Submenus")
    Last edited by stoneharry; 04-17-2009 at 09:54 AM.

  4. #4
    Tikki100's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2008
    Posts
    83
    Thanks G/R
    3/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lets have some more people posting?

  5. #5
    DrZoyburg's Avatar Member
    Reputation
    1
    Join Date
    Jun 2007
    Posts
    11
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is too big to post here, its a pda lua thats not working, just keeps on saying "cant open file" if you could look at this and fix it we would love you forever

    Filebeam - Free Fast File Hosting

    this is too big to post here, its a pda lua thats not working, just keeps on saying "cant open file" if you could look at this and fix it we would love you forever

    PDA file

    Thanks Dr.Z
    Last edited by Fault; 04-20-2009 at 08:27 PM.

  6. #6
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can u upload it to something other than filebeam? it's not working.

    Try pastebin

  7. #7
    Shalitas's Avatar Active Member CoreCoins Purchaser
    Reputation
    27
    Join Date
    Dec 2006
    Posts
    108
    Thanks G/R
    1/0
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi guys, i'll +rep the one who do it work
    99991 to 99995 = my donator items
    100001 is my token
    555555 is my npc

    function Event_Guide(unit, event, player)
    unit:GossipCreateMenu(1, player, 0)
    unit:GossipMenuAddItem(0, "10 Donations Token Items", 4, 0)
    unit:GossipMenuAddItem(0, "20 Donations Token Items", 5, 0)
    unit:GossipSendMenu(player)
    end

    function Event_Submenu(unit, event, player, id, intid, code)

    if(intid == 1) then
    unit:GossipCreateMenu(16, player, 0)
    unit:GossipMenuAddItem(0, "10 Donations Token Items", 4, 0)
    unit:GossipMenuAddItem(0, "20 Donations Token Items", 5, 0)
    unit:GossipSendMenu(player)
    end


    10 token items
    if(intid == 4) then
    unit:GossipCreateMenu(21, player, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Dagger of Annihilation", 24, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Spectral glaive", 25, 0)
    unit:GossipMenuAddItem(0, "[Back]", 1, 0)
    unit:GossipSendMenu(player)
    end

    if(intid == 24) then
    if player:GetItemCount(100001) > 9 then
    player:RemoveItem(100001, 10)
    player:AddItem(99993, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, "How dare you try to trick me, No Tokens, No items.")
    end
    end

    if(intid == 25) then
    if player:GetItemCount(100001) > 9 then
    player:RemoveItem(100001, 10)
    player:AddItem(99994, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, "How dare you try to trick me, No Tokens, No items.")
    end
    end

    20 token items
    if(intid == 5) then
    unit:GossipCreateMenu(21, player, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Hand of the Ancient", 29, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Staff of Destruction", 30, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Arcanite Fury", 31, 0)
    --unit:GossipMenuAddItem(0, "Item 6", 32, 0)
    --unit:GossipMenuAddItem(0, "Item 3", 33, 0)
    unit:GossipMenuAddItem(0, "[Back]", 1, 0)
    unit:GossipSendMenu(player)
    end

    if(intid == 29) then
    if player:GetItemCount(100001) > 19 then
    player:RemoveItem(100001, 20)
    player:AddItem(99991, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, "How dare you try to trick me, No Tokens, No items.")
    end
    end

    if(intid == 30) then
    if player:GetItemCount(100001) > 19 then
    player:RemoveItem(100001, 20)
    player:AddItem(99992, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, "How dare you try to trick me, No Tokens, No items.")
    end
    end

    if(intid == 31) then
    if player:GetItemCount(100001) > 19 then
    player:RemoveItem(100001, 20)
    player:AddItem(99995, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, "How dare you try to trick me, No Tokens, No items.")
    end
    end

    RegisterUnitGossipEvent(555555, 1, "Event_Guide")
    RegisterUnitGossipEvent(555555, 2, "Event_Submenu")
    Thanks !
    Follow me @ Twitch.tv/ShalitasWins

  8. #8
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here soluki, try this:

    Code:
    ERR_MSG = "You don't have enough tokens to buy this item.";
    
    
    function Event_Guide(unit, event, player, misc)
    unit:GossipCreateMenu(1, player, 0)
    unit:GossipMenuAddItem(0, "10 Donations Token Items", 4, 0)
    unit:GossipMenuAddItem(0, "20 Donations Token Items", 5, 0)
    unit:GossipSendMenu(player)
    end
    
    function Event_Submenu(unit, event, player, id, intid, code, misc)
    
    if(intid == 1) then
    unit:GossipCreateMenu(16, player, 0)
    unit:GossipMenuAddItem(0, "10 Donations Token Items", 4, 0)
    unit:GossipMenuAddItem(0, "20 Donations Token Items", 5, 0)
    unit:GossipSendMenu(player)
    end
    
    
    --10 token items
    if(intid == 4) then
    unit:GossipCreateMenu(21, player, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Dagger of Annihilation", 24, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Spectral glaive", 25, 0)
    unit:GossipMenuAddItem(0, "[Back]", 1, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 24) then
    if player:GetItemCount(100001) > 9 then
    player:RemoveItem(100001, 10)
    player:AddItem(99993, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, ERR_MSG)
    end
    end
    
    if(intid == 25) then
    if player:GetItemCount(100001) > 9 then
    player:RemoveItem(100001, 10)
    player:AddItem(99994, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, )
    end
    end
    
    --20 token items
    if(intid == 5) then
    unit:GossipCreateMenu(21, player, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Hand of the Ancient", 29, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Staff of Destruction", 30, 0)
    unit:GossipMenuAddItem(0, "Gurubashi Arcanite Fury", 31, 0)
    --unit:GossipMenuAddItem(0, "Item 6", 32, 0)
    --unit:GossipMenuAddItem(0, "Item 3", 33, 0)
    unit:GossipMenuAddItem(0, "[Back]", 1, 0)
    unit:GossipSendMenu(player)
    end
    
    if(intid == 29) then
    if player:GetItemCount(100001) > 19 then
    player:RemoveItem(100001, 20)
    player:AddItem(99991, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, ERR_MSG)
    end
    end
    
    if(intid == 30) then
    if player:GetItemCount(100001) > 19 then
    player:RemoveItem(100001, 20)
    player:AddItem(99992, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, ERR_MSG)
    end
    end
    
    if(intid == 31) then
    if player:GetItemCount(100001) > 19 then
    player:RemoveItem(100001, 20)
    player:AddItem(99995, 1)
    player:GossipComplete()
    else
    player:SendChatMessage(12, 0, ERR_MSG)
    end
    end
    
    end
    
    RegisterUnitGossipEvent(555555, 1, "Event_Guide")
    RegisterUnitGossipEvent(555555, 2, "Event_Submenu")

  9. #9
    Shalitas's Avatar Active Member CoreCoins Purchaser
    Reputation
    27
    Join Date
    Dec 2006
    Posts
    108
    Thanks G/R
    1/0
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    script look fine now but still not working, npc is telling me :
    ''Hey There, Clazzy. How can I help you?''
    Follow me @ Twitch.tv/ShalitasWins

  10. #10
    y2kss66's Avatar Member
    Reputation
    104
    Join Date
    Jan 2008
    Posts
    778
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @soluki
    you need to change the npcs flags. in the database.

    my turn for help:

    I am using aspire/hearstone core and sun++ Lua Engine

    here is teh code:
    Code:
    function spell1(Unit, Event)
    Unit:FullCastSpell(15011)
    end
    
    function spell2(Unit, Event)
    Unit:FullCastSpellOnTarget(48824, Unit:GetMainTank())
    end
    
    function spell3(Unit,Event)
    Unit:FullCastSpellOnTarget(48819, Unit:GetRandomPlayer())
    end
    
    function spell4(Unit,Event)
    Unit:FullCastSpellOnTarget(48135, Unit:GetMaxMana())
    end
    
    function spell5(Unit,Event)
    Unit:FullCastSpellOnTarget(48078, Unit:GetRandomPlayer())
    end
    
    function spell6(Unit,Event)
    Unit:FullCastSpellOnTarget(20165, Unit:GetMainTank())
    end
    
    function spell7(Unit, Event)
    Unit:FullCastSpell(642)
    end
    
    function spell8(Unit, Event)
    Unit:FullCastSpell(10308)
    end
    
    function spell9(Unit, Event)
    Unit:FullCastSpell(33776)
    end
    
    function spell10(Unit, Event)
    Unit:FullCastSpell(5)
    end
    
    
    function HolyBoss_phase1(Unit, Event)
    if Unit:GetHealthPct() <= 97 then
       Unit:RemoveEvents()
       Unit:SendChatMesssage(14, 0, "You have entered this house as an unwelcomed guest and now you will leave as a corpse.... hahaha")
       Unit:RegisterEvent("spell1", 41300, 7)
       Unit:RegisterEvent("spell2", 64000, 3)
       Unit:RegisterEvent("HolyBoss_phase2", 2000, 0)
      end
    end
    
    function HolyBoss_phase2(Unit, Event)
    if Unit:GetHealthPct() <= 85 then
       Unit:RemoveEvents()
       Unit:SendChatMessage(14, 0, "I guess I am mortal. No matter! My Father will give me aid when I request it.")
       Unit:RegisterEvent("spell2", 64000, 3)
       Unit:RegisterEvent("spell4", 17500, 2)
       Unit:RegisterEvent("spel6", 32333, 8)
       Unit:RegisterEvent("HolyBoss_phase3", 2000, 0)
      end
    end
    
    function HolyBoss_phase3(Unit, Event)
    if Unit:GetHealthPct() <= 73 then
       Unit:RemoveEvents()
       Class = Unit:GetPlayerClass()
       if Class == 5 then
          Unit:SendChatMessage(6, 0, "You call yourself a priest? For betraying the Father... you shall die!")
          Unit:RegisterEvent("spell10", 100000, 1)
          else
          Unit:SendChatMessage(6, 0, "You are not a priest? Where is he?")
        end
       Unit:RegisterEvent("HolyBoss_phase4", 2000, 0)
      end
    end
    
    function HolyBoss_phase4(Unit, Event)
    if Unit:GetHealthPct() <= 50 then
       Unit:RemoveEvents()
       Unit:SendChatMessage(14, 0, "Am I weakening? This was not how it was supposed to be....")
       Unit:RegisterEvent("spel6", 32333, 8)
       Unit:RegisterEvent("spell3", 12000, 7)
       Unit:RegisterEvent("spell7", 17600, 8)
       Unit:SetMaxMana()
       Unit:RegisterEvent("HolyBoss_phase5", 2000, 0)
      end
    end
    
    function HolyBoss_phase5(Unit, Event)
    if Unit:GetHealthPct() <= 35 then
       Unit:RemoveEvents()
       Unit:SendChatMessage(14, 0, "The Father will not leave me! He will banish you... FROM THIS EARTH!")
       Unit:RegisterEvent("spell5", 14900, 9)
       Unit:RegisterEvent("spell9", 50000, 8)
       Unit:RegisterEvent("HolyBoss_phase6", 2000, 0)
      end
    end
    
    function HolyBoss_phase6(Unit, Event)
    if Unit:GetHealthPct() <= 15 then
       Unit:RemoveEvents()
       Unit:SendChatMessage(14, 0, "Why have you abandoned me....?")
       Unit:RegisterEvent("spell8", 17600, 8)
       Unit:RegisterEvent("spell9", 50000, 8)
       Unit:RegisterEvent("spell2", 64000, 3)
       Unit:RegisterEvent("spell2", 64000, 3)
       Unit:RegisterEvent("spell1", 41300, 7)
       Unit:RegisterEvent("spell2", 64000, 3)
       Unit:RegisterEvent("spell3", 12000, 7)
       Unit:RegisterEvent("spell4", 17500, 2)
       Unit:RegisterEvent("spell5", 14900, 9)
       Unit:RegisterEvent("spel6", 32333, 8)
       Unit:RegisterEvent("spell7", 17600, 8)
       Unit:RegisterEvent("spell8", 17600, 8)
       Unit:RegisterEvent("spell9", 50000, 8)
       Unit:RegisterEvent("spell10", 100000, 1)
      end
    end
    
    function HolyBoss_OnCombat(Unit, Event) 
       Unit:RemoveEvents()
       Unit:SendChatMessage(12, 0, "You dare enter The House of God like that? Humble yourself before me!")
       Unit:RegisterEvent("HolyBoss_phase1", 1000, 0)
    end
    
    function HolyBoss_OnLeaveCombat(Unit, Event) 
       Unit:RemoveEvents() 
       Unit:SendChatMessage(12, 0, "The Lord will forgive all!") 
    end
    
    function HolyBoss_OnDied(Unit, Event) 
       Unit:RemoveEvents() 
       Unit:SendChatMessage(12, 0, "I am sorry Father.... I have failed You....") 
    end
    
    function HolyBoss_OnKilledTarget(Unit, Event) 
       Unit:SendChatMessage(11, 0, "My Father has been avenged! No more will people disgrace His temple.") 
    end
    
    RegisterUnitEvent(13371337, 1, "HolyBoss_OnCombat")
    RegisterUnitEvent(13371337, 2, "HolyBoss_OnLeaveCombat")
    RegisterUnitEvent(13371337, 3, "HolyBoss_Died")
    RegisterUnitEvent(13371337, 4, "HolyBoss_OnKilledTarget")
    will +Rep if ya fix it! Thanks
    Last edited by y2kss66; 04-20-2009 at 07:25 PM.

  11. #11
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Y2k I don't see anything wrong. Make sure that none of your other LUA scripts share function or variable names.

    The one thing I found is this:
    Code:
       Class = Unit:GetPlayerClass()
    Unit, in the context, is a creature not a player, so this will throw an error.

  12. #12
    Dr. Livingstone's Avatar Member
    Reputation
    113
    Join Date
    Mar 2008
    Posts
    290
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    y2kss66's script just crashes the server... On Hearthstone the server just crashes with on error in the console...

  13. #13
    Shalitas's Avatar Active Member CoreCoins Purchaser
    Reputation
    27
    Join Date
    Dec 2006
    Posts
    108
    Thanks G/R
    1/0
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you know witch flag I need to put?
    Follow me @ Twitch.tv/ShalitasWins

  14. #14
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    npc flags 1.

  15. #15
    Shalitas's Avatar Active Member CoreCoins Purchaser
    Reputation
    27
    Join Date
    Dec 2006
    Posts
    108
    Thanks G/R
    1/0
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks, will try it right away
    Follow me @ Twitch.tv/ShalitasWins

Page 1 of 3 123 LastLast

Similar Threads

  1. The sobber thread! Post sad endings here
    By Zantas in forum The Back Room
    Replies: 1
    Last Post: 05-15-2010, 07:49 PM
  2. Zolofighter threads - post in here
    By KuRIoS in forum World of Warcraft Bots and Programs
    Replies: 29
    Last Post: 04-16-2009, 06:35 AM
  3. [Now open] Ascent Help-me Thread. POST QUESTIONS HERE.
    By Equ1N0X in forum World of Warcraft Emulator Servers
    Replies: 0
    Last Post: 01-07-2008, 09:28 AM
  4. New Thread Post/Search
    By Scarmaker in forum Suggestions
    Replies: 2
    Last Post: 01-04-2007, 02:58 PM
All times are GMT -5. The time now is 01:59 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