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
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
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")
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.
Lets have some more people posting?
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.
Can u upload it to something other than filebeam? it's not working.
Try pastebin
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
Thanks !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")
Follow me @ Twitch.tv/ShalitasWins
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")
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
@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:
will +Rep if ya fix it! ThanksCode: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")
Last edited by y2kss66; 04-20-2009 at 07:25 PM.
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:
Unit, in the context, is a creature not a player, so this will throw an error.Code:Class = Unit:GetPlayerClass()
y2kss66's script just crashes the server... On Hearthstone the server just crashes with on error in the console...
do you know witch flag I need to put?
Follow me @ Twitch.tv/ShalitasWins
npc flags 1.
ok thanks, will try it right away
Follow me @ Twitch.tv/ShalitasWins