Not working, plus other scripts conflicting with eachother menu

User Tag List

Results 1 to 5 of 5
  1. #1
    covert_cat's Avatar Member
    Reputation
    55
    Join Date
    Sep 2009
    Posts
    96
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Not working, plus other scripts conflicting with eachother

    I'm having multiple problems with Lua on my server.
    The first, and most important is my innkeeper script. I've turned off health regeneration on my server and multiplied the base HP by 10. The Innkeeper is a very important part, as I'm planning on placing buildings with innkeepers all over the game world.

    I've created a script which will sell you a room at an inn and heal you to full health for a price based on your level. My server's max level is set to 120, which is why it goes up to that.

    The problem I run into is that when I click either of the options, "Make this Inn your home", "How much for a room" or "I'd like to purchase a room", nothing happens.

    "Make this Inn your home" should make the npc cast "Bind" on you. I taught myself the spell and cast it on myself, and it worked. But the npc won't cast it.


    I've tried countless things and have looked over my script at least 20 times. It doesn't work for me or anyone else who plays on my server. I'm ready for it to be some stupid tiny detail I missed.. but please. If anyone thinks they can solve my problem, look over my script:
    Code:
    local NPCID = 60004
    
    function Inn_Gossip(Unit, event, player)
    	Unit:GossipCreateMenu(60002, player, 0)
    	Unit:GossipMenuAddItem(5, "Make this Inn your home", 1, 0)
    	Unit:GossipMenuAddItem(7, "How much for a room?", 2, 0)
    	Unit:GossipMenuAddItem(6, "I'd like to purchase a room.", 3, 0)
    	Unit:GossipMenuAddItem(0, "Nevermind.", 4, 0)
    	Unit:GossipSendMenu(player)
    end
    
    function Inn_Gossip_SubMenus(Unit, event, player, id, intid, code)
    	if (intid == 1) then
    		Unit:FullCastSpellOnTarget(3286, player)
    		player:GossipComplete()
    		player:SendBroadcastMessage("If this worked for you, and the innkeeper casts Bind, TELL ME!")
    	end
    	
    	if (intid == 2) then
    	Unit:RegisterEvent("CheckLevel", 1000, 1)
    	Unit:GossipCreateMenu(60003, player, 0)
    	Unit:GossipMenuAddItem(6, "I'd like to purchase a room.", 3, 0)
    	Unit:GossipMenuAddItem(0, "Nevermind.", 4, 0)
    	Unit:GossipSendMenu(player)
    	end
    	
    	if (intid == 3) then
    	player:GossipComplete()
    	Unit:RegisterEvent("Purchase", 1000, 1)
    	end
    	
    	if (intid == 4) then
    	player:GossipComplete()
    	end
    end
    
    	function CheckLevel(Unit, event, player)
    		local level = Unit:GetPlayerLevel()
    			if (level <= 9) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for only 30 copper, how's that?")
    
    			elseif (level <= 19) and (level >= 10) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 2 silver, 40 copper. How's that?")
    
    			elseif (level <= 29) and (level >= 20) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 20 silver, 40 copper. How's that?")
    
    			elseif (level <= 39) and (level >= 30) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 36 silver, 10 copper. How's that?")
    
    			elseif (level <= 49) and (level >= 40) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 64 silver, 10 copper. How's that?")
    
    			elseif (level <= 59) and (level >= 50) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 86 silver, 90 copper. How's that?")
    
    			elseif (level <= 69) and (level >= 60) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 1 gold, 20 silver, 40 copper. How's that?")
    
    			elseif (level <= 79) and (level >= 70) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 2 gold. How's that?")
    
    			elseif (level <= 89) and (level >= 80) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for 2 gold, 54 silver, 50 copper. How's that?")
    
    			elseif (level <= 99) and (level >= 90) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 12 gold, 18 silver, 90 copper. How's that?")
    
    			elseif (level <= 109) and (level >= 100) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 32 gold, 98 silver, 90 copper. How's that?")
    
    			elseif (level <= 119) and (level >= 110) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 40 gold, 98 silver, 90 copper. How's that?")
    
    			elseif (level >= 120) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for 50 gold. How's that?")
    			end
    	end
    	
    	function Purchase(Unit, event, player)
    		local level = Unit:GetPlayerLevel()
    		local money = player:GetCoinage()
    		if (level <= 9) then
    			if (money >= 30) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(30)
    			elseif (money < 30) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 19) and (level >= 10) then
    			if (money >= 240) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(240)
    			elseif (money < 240) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 29) and (level >= 20) then
    			if (money >= 2040) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(2040)
    			elseif (money < 2040) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 39) and (level >= 30) then
    			if (money >= 3610) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(3610)
    			elseif (money < 3610) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 49) and (level >= 40) then
    			if (money >= 6410) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(6410)
    			elseif (money < 6410) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 59) and (level >= 50) then
    			if (money >= 8690) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(8690)
    			elseif (money < 8690) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 69) and (level >= 60) then
    			if (money >= 12040) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(12040)
    			elseif (money < 12040) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 79) and (level >= 70) then
    			if (money >= 20000) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(20000)
    			elseif (money < 20000) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 89) and (level >= 80) then
    			if (money >= 25450) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(25450)
    			elseif (money < 25450) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 99) and (level >= 90) then
    			if (money >= 121890) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(121890)
    			elseif (money < 121890) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 109) and (level >= 100) then
    			if (money >= 329890) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(329890)
    			elseif (money < 329890) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 119) and (level >= 110) then
    			if (money >= 409890) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(409890)
    			elseif (money < 409890) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level >= 120) then
    			if (money >= 500000) then
    			Unit:FullCastSpellOnTarget(25840, player)
    			player:AddItem(89001, 1)
    			player:DealGoldCost(500000)
    			elseif (money < 500000) then
    				player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		end
    	end
    
    function On_Gossip_Complete(Unit, event, player)
    	Unit:RemoveEvents()
    end
    
    RegisterUnitGossipEvent(60004, 1, "Inn_Gossip")
    RegisterUnitGossipEvent(60004, 2, "Inn_Gossip_SubMenus")
    RegisterUnitGossipEvent(60004, 3, "On_Gossip_Complete")
    The other problem I run into is with two separate Lua scripts, and two separate NPCs.
    The first NPC's entryid: 60010
    The second's entryid: 60012

    Now, NPC #1 is supposed to just fight enemies like so:
    Code:
    local NPCID = 60010
    
    function EquipWepsOnLoad_60010(pUnit, event)
    	local equipchance = math.random(1,3)
    	if (equipchance == 1) then
    	pUnit:EquipWeapons(38632, 0, 0)
    	end
    	
    	if (equipchance == 2) then
    	pUnit:EquipWeapons(40491, 45287, 34334)
    	pUnit:SetCombatRangedCapable(true)
    	end
    	
    	if (equipchance == 3) then
    	pUnit:EquipWeapons(40491, 30314, 0)
    	end
    end
    
    function Guard_OnCombat_60010(pUnit, event)
    	local taunt = math.random(1,5)
    		if (taunt == 1) then
    		pUnit:SendChatMessage(14, 0, "Die scum!")
    		end
    		
    		if (taunt == 2) then
    		pUnit:SendChatMessage(14, 0, "Your existence is pointless! You will be eliminated!")
    		end
    		
    		if (taunt == 3) then
    		pUnit:SendChatMessage(14, 0, "Back to hell with you!")
    		end
    		
    		if (taunt == 4) then
    		pUnit:SendChatMessage(14, 0, "You dare challenge the order?")
    		end
    		
    		if (taunt == 5) then
    		pUnit:SendChatMessage(14, 0, "I shall bring death upon you!")
    		end
    	pUnit:FullCastSpell(54043)
    	pUnit:RegisterEvent("SpellChoosing_60010", 4000, 0)
    	pUnit:RegisterEvent("CombatTalk_60010", 8000, 0)
    end
    
    function Guard_OnLeaveCombat_60010(pUnit, event)
    	local modelchance = pUnit:GetNativeDisplay()
    	pUnit:SetModel(modelchance)
    	pUnit:SendChatMessage(12, 0, "Disgusting.")
    	pUnit:RemoveEvents()
    end
    
    	function CombatTalk_60010(pUnit, event)
    		local say = math.random(1,4)
    		if (say == 1) then
    		pUnit:SendChatMessage(12, 0, "You shall perish.")
    		end
    		
    		if (say == 2) then
    		pUnit:SendChatMessage(12, 0, "Your persistence will mean the death of you!")
    		end
    		
    		if (say == 4) then
    		pUnit:SendChatMessage(12, 0, "Give up the fight.")
    		end
    	end
    
    	function SpellChoosing_60010(pUnit, event)
    	if pUnit:GetHealthPct() <= 30 then
    	pUnit:RegisterEvent("PhSpellChoosing_60010", 3000, 0)
    		local spell = math.random(1,4)
    		if (spell == 1) then
    		pUnit:FullCastSpell(66003)
    		end
    		
    		if (spell == 2) then
    		pUnit:FullCastSpell(66007)
    		end
    		
    		if (spell == 4) then
    		pUnit:FullCastSpell(67251)
    		end
    	end
    
    function PhSpellChoosing_60010(pUnit, event)
    	local phspell = math.random(1,2)
    	local phtarget = pUnit:GetPrimaryCombatTarget()
    	pUnit:SendChatMessage(14, 10, "I will not fall! Not here, not now!")
    	pUnit:SetModel(19682)
    			
    			if (phspell == 1) then
    			pUnit:FullCastSpell(75419, phtarget)
    			end
    			
    			if (phspell == 2) then
    			pUnit:FullCastSpell(75413, phtarget)
    			end
    end
    
    RegisterUnitEvent(60010, 1, "Guard_OnCombat_60010")
    RegisterUnitEvent(60010, 2, "Guard_OnLeaveCombat_60010")
    RegisterUnitEvent(60010, 18, "EquipWepsOnLoad_60010")
    And NPC #2 is actually an NPC summoned via a gossip script with another NPC. This NPC defends you from enemies for 90 seconds. Anyways, the problem isn't that. The problem is that both NPCs cast Divine shield every 31 seconds. Only NPC #2 should do that. It's as if the two scripts were merged or something. Here's the second script:
    Code:
    local NPCID = 60012
    
    function EquipWepsOnLoad_60012(pUnit, event)
    	local equipchance = math.random(1,3)
    	if (equipchance == 1) then
    	pUnit:EquipWeapons(38632, 0, 0)
    	end
    	
    	if (equipchance == 2) then
    	pUnit:EquipWeapons(40491, 45287, 34334)
    	pUnit:SetCombatRangedCapable(true)
    	end
    	
    	if (equipchance == 3) then
    	pUnit:EquipWeapons(40491, 30314, 0)
    	end
    end
    
    function Protect_Player_60012(pUnit, event)
    		local player = pUnit:GetClosestPlayer()
    		if(player ~= nil) then
    	pUnit:FullCastSpellOnTarget(10278, player)
    	pUnit:RegisterEvent("Protect_Player_Repeats", 31000, 0)
    		else
    		end
    end
    
    function Protect_Player_Repeats_60012(pUnit, event)
    		local cplayer = pUnit:GetClosestPlayer()
    		if(player ~= nil) then
    		pUnit:FullCastSpellOnTarget(10278, cplayer)
    		else
    		end
    end
    
    function Guard_OnCombat_60012(pUnit, event)
    	local cplayer = pUnit:GetClosestPlayer()
    	pUnit:SendChatMessageToPlayer(13, 0, "Wait here, ".. pUnit:GetPlayerClass() ..". I'll take care of this mongrel..", cplayer)
    	pUnit:SendChatMessage(14, 10, "Die scum! For Lord Amun!!")
    	pUnit:FullCastSpell(54043)
    	pUnit:RegisterEvent("Protect_Player_60012", 1000, 1)
    end
    
    function Guard_Combat_Actions_60012(pUnit, event)
    	pUnit:RegisterEvent("SpellChoosing_60012", 3500, 0)
    end
    	
    function SpellChoosing_60012(pUnit, event)
    	local spell = math.random(1,4)
    	local target = pUnit:GetPrimaryCombatTarget()
    			if pUnit:GetHealthPct() <=30 then
    			pUnit:RemoveEvents()
    			pUnit:RegisterEvent("PhSpellChoosing_60012", 3000, 0)
    			end
    			
    	if (spell == 1) then
    	pUnit:FullCastSpellOnTarget(66003, target)
    	end
    	
    	if (spell == 2) then
    	pUnit:FullCastSpellOnTarget(66007, target)
    	end
    	
    	if (spell == 4) then
    	pUnit:FullCastSpellOnTarget(67251, target)
    	end
    end
    
    function PhSpellChoosing_60012(pUnit, event)
    	local phspell = math.random(1,2)
    	local phtarget = pUnit:GetPrimaryCombatTarget()
    	pUnit:SendChatMessage(14, 10, "I will not fall! Not here, not now!")
    	pUnit:SetModel(19682)
    	
    	if (phspell == 1) then
    	pUnit:FullCastSpellOnTarget(75419, phtarget)
    	end
    	
    	if (phspell == 2) then
    	pUnit:FullCastSpellOnTarget(75413, phtarget)
    	end
    end
    
    function Reset_OnExit_60012(pUnit, event)
    	pUnit:RemoveEvents()
    	local modelchance = pUnit:GetNativeDisplay()
    	pUnit:SetModel(modelchance)
    	pUnit:RegisterEvent("Speak_Player", 2500, 1)
    end
    
    function Speak_Player_60012(pUnit, event, player)
    	pUnit:SendChatMessage(12, 0, "Enemy eliminated. Sorry for that, let us continue on. I need to get you to the gate.")
    end
    
    RegisterUnitEvent(60012, 18, "EquipWepsOnLoad_60012")
    RegisterUnitEvent(60012, 23, "Guard_Combat_Actions_60012")
    RegisterUnitEvent(60012, 1, "Guard_OnCombat_60012")
    RegisterUnitEvent(60012, 2, "Reset_OnExit_60012")
    Last edited by covert_cat; 07-29-2010 at 04:56 AM.

    Not working, plus other scripts conflicting with eachother
  2. #2
    Nitrominator's Avatar Private
    Reputation
    5
    Join Date
    Jan 2010
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by covert_cat View Post
    I'm having multiple problems with Lua on my server.
    The first, and most important is my innkeeper script. I've turned off health regeneration on my server and multiplied the base HP by 10. The Innkeeper is a very important part, as I'm planning on placing buildings with innkeepers all over the game world.

    I've created a script which will sell you a room at an inn and heal you to full health for a price based on your level. My server's max level is set to 120, which is why it goes up to that.

    The problem I run into is that when I click either of the options, "Make this Inn your home", "How much for a room" or "I'd like to purchase a room", nothing happens.

    "Make this Inn your home" should make the npc cast "Bind" on you. I taught myself the spell and cast it on myself, and it worked. But the npc won't cast it.


    I've tried countless things and have looked over my script at least 20 times. It doesn't work for me or anyone else who plays on my server. I'm ready for it to be some stupid tiny detail I missed.. but please. If anyone thinks they can solve my problem, look over my script:
    Code:
    local NPCID = 60004
    
    function Inn_Gossip(Unit, event, player)
    	Unit:GossipCreateMenu(60002, player, 0)
    	Unit:GossipMenuAddItem(5, "Make this Inn your home", 1, 0)
    	Unit:GossipMenuAddItem(7, "How much for a room?", 2, 0)
    	Unit:GossipMenuAddItem(6, "I'd like to purchase a room.", 3, 0)
    	Unit:GossipMenuAddItem(0, "Nevermind.", 4, 0)
    	Unit:GossipSendMenu(player)
    end
    
    function Inn_Gossip_SubMenus(Unit, event, player, id, intid, code)
    	if (intid == 1) then
    		Unit:FullCastSpellOnTarget(3286, player)
    		player:GossipComplete()
    		player:SendBroadcastMessage("If this worked for you, and the innkeeper casts Bind, TELL ME!")
    	end
    	
    	if (intid == 2) then
    	Unit:RegisterEvent("CheckLevel", 1000, 1)
    	Unit:GossipCreateMenu(60003, player, 0)
    	Unit:GossipMenuAddItem(6, "I'd like to purchase a room.", 3, 0)
    	Unit:GossipMenuAddItem(0, "Nevermind.", 4, 0)
    	Unit:GossipSendMenu(player)
    	end
    	
    	if (intid == 3) then
    	player:GossipComplete()
    	Unit:RegisterEvent("Purchase", 1000, 1)
    	end
    	
    	if (intid == 4) then
    	player:GossipComplete()
    	end
    end
    
    	function CheckLevel(Unit, event, player)
    		local level = Unit:GetPlayerLevel()
    			if (level <= 9) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for only 30 copper, how's that?")
    
    			elseif (level <= 19) and (level >= 10) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 2 silver, 40 copper. How's that?")
    
    			elseif (level <= 29) and (level >= 20) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 20 silver, 40 copper. How's that?")
    
    			elseif (level <= 39) and (level >= 30) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 36 silver, 10 copper. How's that?")
    
    			elseif (level <= 49) and (level >= 40) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 64 silver, 10 copper. How's that?")
    
    			elseif (level <= 59) and (level >= 50) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 86 silver, 90 copper. How's that?")
    
    			elseif (level <= 69) and (level >= 60) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 1 gold, 20 silver, 40 copper. How's that?")
    
    			elseif (level <= 79) and (level >= 70) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 2 gold. How's that?")
    
    			elseif (level <= 89) and (level >= 80) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for 2 gold, 54 silver, 50 copper. How's that?")
    
    			elseif (level <= 99) and (level >= 90) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 12 gold, 18 silver, 90 copper. How's that?")
    
    			elseif (level <= 109) and (level >= 100) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 32 gold, 98 silver, 90 copper. How's that?")
    
    			elseif (level <= 119) and (level >= 110) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for about 40 gold, 98 silver, 90 copper. How's that?")
    
    			elseif (level >= 120) then
    				Unit:SendChatMessage(12, 0, "I could give you a room for 50 gold. How's that?")
    			end
    	end
    	
    	function Purchase(Unit, event, player)
    		local level = Unit:GetPlayerLevel()
    		local money = player:GetCoinage()
    		if (level <= 9) then
    			if (money >= 30) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(30)
    			elseif (money < 30) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 19) and (level >= 10) then
    			if (money >= 240) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(240)
    			elseif (money < 240) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 29) and (level >= 20) then
    			if (money >= 2040) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(2040)
    			elseif (money < 2040) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 39) and (level >= 30) then
    			if (money >= 3610) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(3610)
    			elseif (money < 3610) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 49) and (level >= 40) then
    			if (money >= 6410) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(6410)
    			elseif (money < 6410) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 59) and (level >= 50) then
    			if (money >= 8690) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(8690)
    			elseif (money < 8690) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 69) and (level >= 60) then
    			if (money >= 12040) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(12040)
    			elseif (money < 12040) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 79) and (level >= 70) then
    			if (money >= 20000) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(20000)
    			elseif (money < 20000) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 89) and (level >= 80) then
    			if (money >= 25450) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(25450)
    			elseif (money < 25450) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 99) and (level >= 90) then
    			if (money >= 121890) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(121890)
    			elseif (money < 121890) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    
    		elseif (level <= 109) and (level >= 100) then
    			if (money >= 329890) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(329890)
    			elseif (money < 329890) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level <= 119) and (level >= 110) then
    			if (money >= 409890) then
    		Unit:FullCastSpellOnTarget(25840, player)
    		player:AddItem(89001, 1)
    		player:DealGoldCost(409890)
    			elseif (money < 409890) then
    			player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		
    		elseif (level >= 120) then
    			if (money >= 500000) then
    			Unit:FullCastSpellOnTarget(25840, player)
    			player:AddItem(89001, 1)
    			player:DealGoldCost(500000)
    			elseif (money < 500000) then
    				player:SendAreaTriggerMessage("Not enough gold.")
    			end
    		end
    	end
    
    function On_Gossip_Complete(Unit, event, player)
    	Unit:RemoveEvents()
    end
    
    RegisterUnitGossipEvent(60004, 1, "Inn_Gossip")
    RegisterUnitGossipEvent(60004, 2, "Inn_Gossip_SubMenus")
    RegisterUnitGossipEvent(60004, 3, "On_Gossip_Complete")
    The other problem I run into is with two separate Lua scripts, and two separate NPCs.
    The first NPC's entryid: 60010
    The second's entryid: 60012

    Now, NPC #1 is supposed to just fight enemies like so:
    Code:
    local NPCID = 60010
    
    function EquipWepsOnLoad_60010(pUnit, event)
    	local equipchance = math.random(1,3)
    	if (equipchance == 1) then
    	pUnit:EquipWeapons(38632, 0, 0)
    	end
    	
    	if (equipchance == 2) then
    	pUnit:EquipWeapons(40491, 45287, 34334)
    	pUnit:SetCombatRangedCapable(true)
    	end
    	
    	if (equipchance == 3) then
    	pUnit:EquipWeapons(40491, 30314, 0)
    	end
    end
    
    function Guard_OnCombat_60010(pUnit, event)
    	local taunt = math.random(1,5)
    		if (taunt == 1) then
    		pUnit:SendChatMessage(14, 0, "Die scum!")
    		end
    		
    		if (taunt == 2) then
    		pUnit:SendChatMessage(14, 0, "Your existence is pointless! You will be eliminated!")
    		end
    		
    		if (taunt == 3) then
    		pUnit:SendChatMessage(14, 0, "Back to hell with you!")
    		end
    		
    		if (taunt == 4) then
    		pUnit:SendChatMessage(14, 0, "You dare challenge the order?")
    		end
    		
    		if (taunt == 5) then
    		pUnit:SendChatMessage(14, 0, "I shall bring death upon you!")
    		end
    	pUnit:FullCastSpell(54043)
    	pUnit:RegisterEvent("SpellChoosing_60010", 4000, 0)
    	pUnit:RegisterEvent("CombatTalk_60010", 8000, 0)
    end
    
    function Guard_OnLeaveCombat_60010(pUnit, event)
    	local modelchance = pUnit:GetNativeDisplay()
    	pUnit:SetModel(modelchance)
    	pUnit:SendChatMessage(12, 0, "Disgusting.")
    	pUnit:RemoveEvents()
    end
    
    	function CombatTalk_60010(pUnit, event)
    		local say = math.random(1,4)
    		if (say == 1) then
    		pUnit:SendChatMessage(12, 0, "You shall perish.")
    		end
    		
    		if (say == 2) then
    		pUnit:SendChatMessage(12, 0, "Your persistence will mean the death of you!")
    		end
    		
    		if (say == 4) then
    		pUnit:SendChatMessage(12, 0, "Give up the fight.")
    		end
    	end
    
    	function SpellChoosing_60010(pUnit, event)
    	if pUnit:GetHealthPct() <= 30 then
    	pUnit:RegisterEvent("PhSpellChoosing_60010", 3000, 0)
    		local spell = math.random(1,4)
    		if (spell == 1) then
    		pUnit:FullCastSpell(66003)
    		end
    		
    		if (spell == 2) then
    		pUnit:FullCastSpell(66007)
    		end
    		
    		if (spell == 4) then
    		pUnit:FullCastSpell(67251)
    		end
    	end
    
    function PhSpellChoosing_60010(pUnit, event)
    	local phspell = math.random(1,2)
    	local phtarget = pUnit:GetPrimaryCombatTarget()
    	pUnit:SendChatMessage(14, 10, "I will not fall! Not here, not now!")
    	pUnit:SetModel(19682)
    			
    			if (phspell == 1) then
    			pUnit:FullCastSpell(75419, phtarget)
    			end
    			
    			if (phspell == 2) then
    			pUnit:FullCastSpell(75413, phtarget)
    			end
    end
    
    RegisterUnitEvent(60010, 1, "Guard_OnCombat_60010")
    RegisterUnitEvent(60010, 2, "Guard_OnLeaveCombat_60010")
    RegisterUnitEvent(60010, 18, "EquipWepsOnLoad_60010")
    And NPC #2 is actually an NPC summoned via a gossip script with another NPC. This NPC defends you from enemies for 90 seconds. Anyways, the problem isn't that. The problem is that both NPCs cast Divine shield every 31 seconds. Only NPC #2 should do that. It's as if the two scripts were merged or something. Here's the second script:
    Code:
    local NPCID = 60012
    
    function EquipWepsOnLoad_60012(pUnit, event)
    	local equipchance = math.random(1,3)
    	if (equipchance == 1) then
    	pUnit:EquipWeapons(38632, 0, 0)
    	end
    	
    	if (equipchance == 2) then
    	pUnit:EquipWeapons(40491, 45287, 34334)
    	pUnit:SetCombatRangedCapable(true)
    	end
    	
    	if (equipchance == 3) then
    	pUnit:EquipWeapons(40491, 30314, 0)
    	end
    end
    
    function Protect_Player_60012(pUnit, event)
    		local player = pUnit:GetClosestPlayer()
    		if(player ~= nil) then
    	pUnit:FullCastSpellOnTarget(10278, player)
    	pUnit:RegisterEvent("Protect_Player_Repeats", 31000, 0)
    		else
    		end
    end
    
    function Protect_Player_Repeats_60012(pUnit, event)
    		local cplayer = pUnit:GetClosestPlayer()
    		if(player ~= nil) then
    		pUnit:FullCastSpellOnTarget(10278, cplayer)
    		else
    		end
    end
    
    function Guard_OnCombat_60012(pUnit, event)
    	local cplayer = pUnit:GetClosestPlayer()
    	pUnit:SendChatMessageToPlayer(13, 0, "Wait here, ".. pUnit:GetPlayerClass() ..". I'll take care of this mongrel..", cplayer)
    	pUnit:SendChatMessage(14, 10, "Die scum! For Lord Amun!!")
    	pUnit:FullCastSpell(54043)
    	pUnit:RegisterEvent("Protect_Player_60012", 1000, 1)
    end
    
    function Guard_Combat_Actions_60012(pUnit, event)
    	pUnit:RegisterEvent("SpellChoosing_60012", 3500, 0)
    end
    	
    function SpellChoosing_60012(pUnit, event)
    	local spell = math.random(1,4)
    	local target = pUnit:GetPrimaryCombatTarget()
    			if pUnit:GetHealthPct() <=30 then
    			pUnit:RemoveEvents()
    			pUnit:RegisterEvent("PhSpellChoosing_60012", 3000, 0)
    			end
    			
    	if (spell == 1) then
    	pUnit:FullCastSpellOnTarget(66003, target)
    	end
    	
    	if (spell == 2) then
    	pUnit:FullCastSpellOnTarget(66007, target)
    	end
    	
    	if (spell == 4) then
    	pUnit:FullCastSpellOnTarget(67251, target)
    	end
    end
    
    function PhSpellChoosing_60012(pUnit, event)
    	local phspell = math.random(1,2)
    	local phtarget = pUnit:GetPrimaryCombatTarget()
    	pUnit:SendChatMessage(14, 10, "I will not fall! Not here, not now!")
    	pUnit:SetModel(19682)
    	
    	if (phspell == 1) then
    	pUnit:FullCastSpellOnTarget(75419, phtarget)
    	end
    	
    	if (phspell == 2) then
    	pUnit:FullCastSpellOnTarget(75413, phtarget)
    	end
    end
    
    function Reset_OnExit_60012(pUnit, event)
    	pUnit:RemoveEvents()
    	local modelchance = pUnit:GetNativeDisplay()
    	pUnit:SetModel(modelchance)
    	pUnit:RegisterEvent("Speak_Player", 2500, 1)
    end
    
    function Speak_Player_60012(pUnit, event, player)
    	pUnit:SendChatMessage(12, 0, "Enemy eliminated. Sorry for that, let us continue on. I need to get you to the gate.")
    end
    
    RegisterUnitEvent(60012, 18, "EquipWepsOnLoad_60012")
    RegisterUnitEvent(60012, 23, "Guard_Combat_Actions_60012")
    RegisterUnitEvent(60012, 1, "Guard_OnCombat_60012")
    RegisterUnitEvent(60012, 2, "Reset_OnExit_60012")

    Have you tried changing "FullCastSpellOnTarget" to "player:CastSpell(ID)"?
    So it would look something like:

    function Inn_Gossip_SubMenus(Unit, event, player, id, intid, code)
    if (intid == 1) then
    player:CastSpell(3286)
    player:GossipComplete()
    player:SendBroadcastMessage("If this worked for you, and the innkeeper casts Bind, TELL ME!")
    end

    That works for me. I use a diff spell, but it the same function of course.

    And for the second... There I'm not really sure. Sorry.
    Tell me if the first one works though ; )
    And you might want to get an engine build-in or w/e. GuaEngine works epicly. Fixed quite alot for me.

  3. #3
    covert_cat's Avatar Member
    Reputation
    55
    Join Date
    Sep 2009
    Posts
    96
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, bind works now, but purchasing a room or checking the price doesn't work.. maybe GetPlayerLevel() just doesn't work? I'm using LuaHypArc..

  4. #4
    Nitrominator's Avatar Private
    Reputation
    5
    Join Date
    Jan 2010
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not every function works with the basic one you get with after compiling ArcEmu. Get the GuaEngine Gastric made. Search for it here on MMOwned, and you should be fine Fixes quite alot lol.

  5. #5
    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 Nitrominator View Post
    Not every function works with the basic one you get with after compiling ArcEmu. Get the GuaEngine Gastric made. Search for it here on MMOwned, and you should be fine Fixes quite alot lol.
    Your a bit out of date mate, LuaHypArc (comes default with ArcEmu) is the best Lua engine in a long time, far better than the GuaEngine.

    As far as this thread goes:

    Add to each intid to print, e.g:

    if (intid == 1) then
    print("Button 1 was pressed.")
    player:CastSpell(3286)
    player:GossipComplete()
    player:SendBroadcastMessage("If this worked for you, and the innkeeper casts Bind, TELL ME!")
    end

    And so on, then after a server restart look in the core and see which buttons work when you press them and which give an error.

Similar Threads

  1. Need some Help with a script of mine! not working and i dont know why.
    By Flesh0209 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 08-08-2009, 08:10 PM
  2. Glitchy's MES not working so I need help with HEX editing..
    By fearkite in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 07-28-2009, 05:10 AM
  3. SwitchBlade - Play WoW With xbox 360 (This is not related to other 2 ones)
    By Nightfel in forum World of Warcraft Bots and Programs
    Replies: 22
    Last Post: 10-23-2007, 03:36 PM
  4. BC not working with Chrispee
    By frogtheman in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 10-17-2007, 07:50 PM
  5. Need help with putting Mpqs into Data folder, not working!!!
    By Korey16 in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 12-26-2006, 12:15 PM
All times are GMT -5. The time now is 03:03 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