Teryaki
Exalted Member
Hey there everyone,
I have just started using Eluna for TrinityCore, because I recently switched from ArcEmu so I wanted to switch into scripting as smoothly as possible. I have to say Eluna is quite good, and I dont quite know C++ as well as LUA. Anyway, on to my question. I am having a problem with a script I had on my ArcEmu server. I think I have it mostly converted to Eluna I think, I am still quite new to Eluna itself.
I am getting an error in my worldserver stating "attempt to index local 'pUnit' (a number value)" I looked at the custom scripts as well, and the setup is a little different than what I have in this script. So I don't know if I will have to go through and edit some more of the code to make it match the gossip script for the teleporter or what. And if that is the case, then is it possible to register the flight path and having it require an item? Here is the code of the script I have so far, if there is any help that I could get or something to point me in the right direction that would be wonderful! Thank you!
I have just started using Eluna for TrinityCore, because I recently switched from ArcEmu so I wanted to switch into scripting as smoothly as possible. I have to say Eluna is quite good, and I dont quite know C++ as well as LUA. Anyway, on to my question. I am having a problem with a script I had on my ArcEmu server. I think I have it mostly converted to Eluna I think, I am still quite new to Eluna itself.
I am getting an error in my worldserver stating "attempt to index local 'pUnit' (a number value)" I looked at the custom scripts as well, and the setup is a little different than what I have in this script. So I don't know if I will have to go through and edit some more of the code to make it match the gossip script for the teleporter or what. And if that is the case, then is it possible to register the flight path and having it require an item? Here is the code of the script I have so far, if there is any help that I could get or something to point me in the right direction that would be wonderful! Thank you!
Code:
local GetDisplay = 17699
local NPCID = 99993
local item1id = 49623
local MyFlightPath = {
{1, 16218.30, 16277.84, 25},
{1, 16206.73, 16251.14, 32},
{1, 16228.76, 16230.82, 42},
{1, 16266.93, 16246.27, 63},
{1, 16275.62, 16281.19, 66},
{1, 16250.80, 16298.93, 51},
{1, 16224.79, 16301.91, 49},
{1, 16206.46, 16313.54, 39},
{1, 16189.04, 16307.65, 34},
{1, 16214.10, 16285.48, 26},
{1, 16218.45, 16281.15, 21}
}
local GMIslandTest = {
{1, 16218.30, 16277.84, 25},
{1, 16206.73, 16251.14, 32},
{1, 16228.76, 16230.82, 42},
{1, 16266.93, 16246.27, 63},
{1, 16275.62, 16281.19, 66},
{1, 16250.80, 16298.93, 51},
{1, 16224.79, 16301.91, 49},
{1, 16206.46, 16313.54, 39},
{1, 16189.04, 16307.65, 34},
{1, 16214.10, 16285.48, 26},
{1, 16218.45, 16281.15, 21}
}
function Flight_Master_OnGossipTalk(pUnit, event, player, pMisc)
pUnit:GossipCreateMenu(50, player, 0)
pUnit:GossipMenuAddItem(9, "Show Me Where I Can fly.", 1, 0)
pUnit:GossipMenuAddItem(4, "Show Me What Else You Have To Offer.", 5, 0)
pUnit:GossipMenuAddItem(9, "Never Mind", 2, 0)
pUnit:GossipSendMenu(player)
end
function Flight_Master_OnGossipSelect(pUnit, event, player, id, intid, code, pMisc)
if (intid == 1) then
pUnit:GossipCreateMenu(50, player, 0)
pUnit:GossipMenuAddItem(9, "Custom Location", 3, 0, "The Cost: 1 Shadowmourne")
pUnit:GossipMenuAddItem(9, "GM Island Joy Ride", 4, 0, "The Cost: 1 Shadowmourne", 100)
pUnit:GossipMenuAddItem(9, "Never Mind", 2, 0)
pUnit:GossipSendMenu(player)
end
if (intid == 2) then
player:GossipComplete()
end
if (intid == 3) then
if (player:IsInCombat()==true) then
player:SendAreaTriggerMessage("You are in combat!")
elseif (player:GetItemCount(item1id)) > 0 then
CustomFlightPath = LuaTaxi:CreateTaxi()
for i = 1, #MyFlightPath do
MYFP = MyFlightPath[i]
CustomFlightPath:AddPathNode(MYFP[1], MYFP[2], MYFP[3], MYFP[4])
end
player:RemoveItem(item1id, 1)
player:StartTaxi(CustomFlightPath, GetDisplay)
else
player:SendAreaTriggerMessage("You do not have the required item in your inventory!")
end
player:GossipComplete()
end
if (intid == 4) then
GMIslandJoy = LuaTaxi:CreateTaxi()
for i = 1, #GMIslandTest do
local GMFP = GMIslandTest[i]
GMIslandJoy:AddPathNode(GMFP[1], GMFP[2], GMFP[3], GMFP[4])
end
player:DealGoldCost(100)
player:StartTaxi(GMIslandJoy, GetDisplay)
player:GossipComplete()
end
if (intid == 5) then
pUnit:GossipCreateMenu(50, player, 0)
pUnit:GossipMenuAddItem(4, "Weather", 6, 0)
pUnit:GossipMenuAddItem(5, "Queue Me For A Battleground!", 7, 0)
pUnit:GossipMenuAddItem(5, "Show Me The Money!", 8, 0)
pUnit:GossipMenuAddItem(5, "Screw the Battlegrounds, give me honor! (200 honor)", 9, 0, "The Cost:", 2000000)
pUnit:GossipMenuAddItem(9, "Never Mind", 2, 0)
pUnit:GossipSendMenu(player)
end
if (intid == 6) then
pUnit:GossipCreateMenu(50, player, 0)
pUnit:GossipMenuAddItem(6, "Sunny", 10, 0)
pUnit:GossipMenuAddItem(6, "Foggy", 11, 0, "The Cost:", 20000)
pUnit:GossipMenuAddItem(6, "Rainy", 12, 0, "The Cost:", 23000)
pUnit:GossipMenuAddItem(6, "Monsoon", 13, 0, "The Cost:", 25000)
pUnit:GossipMenuAddItem(6, "Snowy", 14, 0 , "The Cost:", 34000)
pUnit:GossipMenuAddItem(6, "Sandstorm", 15, 0, "The Cost:", 22000)
pUnit:GossipMenuAddItem(9, "Never Mind", 2, 0)
pUnit:GossipSendMenu(player)
end
if (intid == 9) then
player:DealGoldCost(2000000)
player:GiveHonor(200)
player:GossipComplete()
end
if (intid == 10) then
player:SetPlayerWeather(0, 1)
player:GossipComplete()
end
if (intid == 11) then
player:DealGoldCost(20000)
player:SetPlayerWeather(1, 1)
player:GossipComplete()
end
if (intid == 12) then
player:DealGoldCost(23000)
player:SetPlayerWeather(2, 1)
player:GossipComplete()
end
if (intid == 13) then
player:DealGoldCost(25000)
player:SetPlayerWeather(4, 1)
player:GossipComplete()
end
if (intid == 14) then
player:DealGoldCost(34000)
player:SetPlayerWeather(8, 1)
player:GossipComplete()
end
if (intid == 15) then
player:DealGoldCost(22000)
player:SetPlayerWeather(16, 1)
player:GossipComplete()
end
if (intid == 8) then
player:SendBankWindow(player)
player:GossipComplete()
end
end
RegisterCreatureGossipEvent(NPCID, 1, Flight_Master_OnGossipTalk)
RegisterCreatureGossipEvent(NPCID, 2, Flight_Master_OnGossipSelect)