This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [SOLVED] [Trinity Core 3.3.5] New Flight Path doesn't work  (Read 6012 times)

Namiriu

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 57
    • View Profile
[SOLVED] [Trinity Core 3.3.5] New Flight Path doesn't work
« on: October 26, 2014, 09:58:27 am »
Hi everyone,

I actually try to add custom flight path to my trinity server, i correctly edit the DBC files and i put them in the server side and i do the MPQ patch with these DBC files.

So when i go to the arrival of the flight path i spawn the gryphon master of Stormwind and he give me a new path when i speak to him "You have discover new location to travel" and after that i speak again to him and i've this message : " You dont know any locations bound to this one".

And when i go to the start of my custom flight path i spawn the same gryphon master, and he didn't want to send me at my arrival, in the flight map i only can choose Westfall.

My flight path start ahead stormwind door, and finish in a little camp in the same map ( Azeroth ).

Someone can help me please ? There is the .dbc files i've edit if someone whant to take a look.

Thanks in advance !
« Last Edit: November 01, 2014, 06:31:18 pm by Admin »

Namiriu

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 57
    • View Profile
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #1 on: October 27, 2014, 10:30:26 pm »
Nobody ? :o
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #2 on: October 28, 2014, 08:02:09 pm »
Had the same problem and was too lazy to solve it. I never really found solution, but I was also working on map where no blizzlike FPs are, so I thought that problem is there. I suppose you missed something in DBCs related to world/zone maps and such things, but I'm just guessing here. If you won't find real solution, you can use smart_scripts for that, there is action 52 - activate taxi. You can connect such smart script with for instance some gossip menu option, you can also set there prize (via box money in gossip_menu_option). I'm sorry, there's no better solution from me right now.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz

Namiriu

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 57
    • View Profile
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #3 on: October 29, 2014, 12:09:47 am »
Okay thanks for the answer "Mr King of Banana" ! (Joke :p)

Thanks Amaroth ! I going to see this way ... That's too bad Trinity "lock" that, because with MaNGOS only DBC edit is needed and the flight path work correctly  :lol:

Maybe can show me an exemple of what you mean ? I'm new user of Trinity Core and never work with SmartAI or something else. Only with SC2 long time ago in MaNGOS and i've never use gossip at all  :oops:
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #4 on: October 29, 2014, 02:26:30 pm »
Just a question to be sure - TC2, 3.3.5a? If it is so for you, I can write/screenshot a short tutorial for this.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz

Namiriu

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 57
    • View Profile
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #5 on: October 29, 2014, 03:57:50 pm »
I use TrinityCore 3.3.5a yes

I compilate my own core with this github :

https://github.com/TrinityCore/TrinityCore

Is this is you ask ^^'

Because idk what is TC2 :(
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #6 on: October 29, 2014, 07:17:07 pm »
TC2 - trinitycore 2 :D

So, ok:
1) You already did all DBC work, just for being sure you did it well. I have nearly everywhere Z=0 because my taxis are actually boats, so they are all on water level):
- create 2 new Taxi Nodes (point A and point B) > TaxiNode.dbc
- create 1 new Taxi Path (2 if you want to be able to go to both directions - from point A to B AND from B to A) > TaxiPath.dbc
- create waypoints fro both your Taxi Paths > TaxiPathNode.dbc


2) Create new gossip menu (Note: I used 61001 only as root menu, paths themselves are accesed in submenus which are accesed from root menu, submenu for our Taxi path 2003 from A to B has ID 61011):
- create new gossip menu in world.gossip_menu > will be used by NPC
- create new "welcome" text in world.npc_text used by gossip menu > optional
- create new options for gossip menu in gossip_menu_option > possibilities to select in gossip menu


3) Create new NPC which has npc flag including flag 1 (gossip) and your gossip menu id filled, the rest NPC setting is optional. No screens needed here, are they?

4) Create smart script for NPC. I make smart scripts in Truice, its faster there.:


5) Result (1st screen is with menu 61001, our welcome&select path menu, 2nd screen is from our submenu 61011, our I want mount/sry, no mount, show me root welcome menu again)



For more info google these:
TaxiNode.dbc
TaxiPath.dbc
TaxiPatNode.dbc
creature_template
gossip_menu
gossip_menu_option
npc_text
smart_scripts
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz

Namiriu

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 57
    • View Profile
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #7 on: October 29, 2014, 10:09:40 pm »
Thanks a lot for that i going to try this week and come back to say you if it's work for me ! :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #8 on: October 30, 2014, 08:52:22 pm »
If you still want the nice UI but don't want to work with the horrible DBC structure:

I hacked my own system together:



FrameXML edit to TaxiFrame.lua:

Code: [Select]
--[[
Status list:
- CURRENT
- REACHABLE
- DISTANT
- NONE
]]
-- X, Y, Name, NumRoutes, Cost (100 = 1 silver), nodes accessable, npc name, status, available to faction in string
local coords_m = {
{0.5, 0.3, "Blackrock Mountain", 4, 0, {2, 3, 4, 5}, "Lae Dualade", "NONE", "BOTH"},
{0.9, 0.3, "The Race Track", 1, 0, {1}, "stuff3", "NONE", "BOTH"},
{0.52, 0.25, "Redridge, Stonewatch", 1, 0, {1}, "Black War Gryphon", "NONE", "BOTH"},
{100.56, 100.28, "Badlands", 1, 0, {1}, "Gorrik", "NONE", "BOTH"},
{0.5, 0.51, "Arathi Highlands, Stromgarde City", 3, 0, {1, 6, 7, 8, 9,10,11,12,13}, "Shavalius the Fancy", "NONE", "BOTH"},
{0.45, 0.6, "Silverpine Forest", 1, 0, {5}, "DEBUG", "NONE", "Alliance"},
{0.54, 0.52, "Arathi Highlands, Refugee Point", 1, 0, {5}, "Kip Trawlskip", "NONE", "Alliance"},
{0.4, 0.58, "Silverpine Forest, The Sepulcher", 1, 0, {5}, "Karos Razok", "NONE", "Horde"},
{0.56, 0.49, "Arathi Highlands, Hammerfall", 1, 0, {5}, "DEBUG3", "NONE", "Horde"},
{0.85, 0.77, "Snowdrift Peaks, Excavation Camp", 1, 0, {5}, "DEBUGZ", "NONE", "BOTH"},
{0.76, 0.79, "Snowdrift Peaks, Illidari Camp", 1, 0, {5}, "DEBUGZ", "NONE", "BOTH"},
{0.82, 0.87, "Sandy Plains, Taunka'le Village", 1, 0, {5}, "DEBUGZ", "NONE", "BOTH"},
{0.89, 0.84, "Sandy Plains, Oomlot Village", 1, 0, {5}, "DEBUGZ", "NONE", "BOTH"},

--kalimdor--14+

{0.6, 0.67, "Snowdrift Peaks, Excavation Camp", 1, 0, {15,16,17,18}, "Breck Rockbrow", "NONE", "BOTH"},
{0.85, 0.81, "Arathi Highlands, Stromgarde City", 3, 0, {15}, "DEBUGZ", "NONE", "BOTH"},
{0.5, 0.70, "Snowdrift Peaks, Illidari Camp", 1, 0, {14,15,17,18}, "Maddix", "NONE", "BOTH"},
{0.65, 0.77, "Sandy Plains, Oomlot Village", 1, 0, {14,15,16,18}, "Nutral", "NONE", "BOTH"},
{0.6, 0.79, "Sandy Plains, Taunka'le Village", 1, 0, {14,15,16,17}, "Helidan Lightwing", "NONE", "BOTH"},
--{0.9, 0.2, "Test2", 3, 1000, {1, 2, 4}, "stuff2", "DISTANT"},
}

local current = 0

TAXI_MAP_WIDTH = 316;
TAXI_MAP_HEIGHT = 352;
NUM_TAXI_BUTTONS = 0;
NUM_TAXI_ROUTES = 0;

TaxiButtonTypes = { };
TaxiButtonTypes["CURRENT"] = {
file = "Interface\TaxiFrame\UI-Taxi-Icon-Green"
}
TaxiButtonTypes["REACHABLE"] = {
file = "Interface\TaxiFrame\UI-Taxi-Icon-White"
}
TaxiButtonTypes["DISTANT"] = {
file = "Interface\TaxiFrame\UI-Taxi-Icon-Yellow"
}

TAXI_BUTTON_HALF_WIDTH = 8;
TAXI_BUTTON_HALF_HEIGHT = 8;


function TaxiFrame_OnLoad(self)
self:RegisterEvent("TAXIMAP_OPENED");
self:RegisterEvent("TAXIMAP_CLOSED");
end

function TaxiFrame_OnEvent(self, event, ...)
if ( event == "TAXIMAP_OPENED" ) then
-- Show the merchant we're dealing with
local name = UnitName("npc")
TaxiMerchant:SetText(name);
SetPortraitTexture(TaxiPortrait, "npc");

current = 0
for i=1, #coords_m do
coords_m[i][8] = "NONE";
if name == coords_m[i][7] then
current = i
coords_m[current][8] = "CURRENT";
end
end
if current == 0 then
UIErrorsFrame:AddMessage("ERROR: No path found for this creature.", 1.0, 0.1, 0.1, 1.0);
HideUIPanel(TaxiFrame);
return;
end
for k,v in pairs(coords_m[current][6]) do
coords_m[v][8] = "REACHABLE";
end

-- Set the texture coords on the map
TaxiMap:SetTexCoord(0,1,0,1);
SetTaxiMap(TaxiMap)

-- Show the taxi node map and buttons
local num_nodes = #coords_m
if ( num_nodes > NUM_TAXI_BUTTONS ) then
local button;
for i = NUM_TAXI_BUTTONS+1, num_nodes do
button = CreateFrame("Button", "TaxiButton"..i, TaxiRouteMap, "TaxiButtonTemplate");
button:SetID(i);
end
end
-- Draw nodes
local taxiNodePositions = {};
local numValidFlightNodes = 0;
for index = 1, #coords_m do
local type = coords_m[index][8]
local button = _G["TaxiButton"..index];
local PlrFaction = UnitFactionGroup("player")
taxiNodePositions[index] = {};
if ( type ~= "NONE" ) and ( coords_m[index][9] == PlrFaction or coords_m[index][9] == "BOTH" ) then
numValidFlightNodes = numValidFlightNodes + 1;
local x, y = coords_m[index][1], coords_m[index][2]
local currX = x*TAXI_MAP_WIDTH;
local currY = y*TAXI_MAP_HEIGHT;
taxiNodePositions[index].x = currX;
taxiNodePositions[index].y = currY;
-- check if we are obscuring a previous placement (eg: Ebon Hold and Light's Hope Chapel)
--[[if ( numValidFlightNodes > 1 ) then
for checkNode = 1, index do
local checkX = taxiNodePositions[checkNode].x;
local checkY = taxiNodePositions[checkNode].y;
if ( taxiNodePositions[checkNode].x ) then
if ( (currX > checkX - TAXI_BUTTON_HALF_WIDTH) and (currX < checkX + TAXI_BUTTON_HALF_WIDTH) ) then
if ( (currY > checkY - TAXI_BUTTON_HALF_HEIGHT) and (currY < checkY + TAXI_BUTTON_HALF_HEIGHT) ) then
taxiNodePositions[index].x = currX + (currX - checkX) * 0.5;
taxiNodePositions[index].y = currY + (currY - checkY) * 0.5;
taxiNodePositions[checkNode].x = checkX + (checkX - currX) * 0.5;
taxiNodePositions[checkNode].y = checkY + (checkY - currY) * 0.5;
end
end
end
end
end]]
-- set the button position
button:ClearAllPoints();
button:SetPoint("CENTER", "TaxiMap", "BOTTOMLEFT", taxiNodePositions[index].x, taxiNodePositions[index].y);
button:SetNormalTexture(TaxiButtonTypes[type].file);
button:Show();
else
button:Hide();
end
end

if ( num_nodes > NUM_TAXI_BUTTONS ) then
NUM_TAXI_BUTTONS = num_nodes
end

-- All set...
ShowUIPanel(self);
if ( not self:IsShown() ) then
CloseTaxiMap();
end
return;
end
if ( event == "TAXIMAP_CLOSED" ) then
HideUIPanel(self);
return;
end
end

function TaxiNodeOnButtonEnter(button)
local index = button:GetID();
GameTooltip:SetOwner(button, "ANCHOR_RIGHT");
GameTooltip:AddLine(coords_m[index][3], "", 1.0, 1.0, 1.0);

-- Setup variables
local numRoutes = coords_m[current][4];
local line;
local sX, sY, dX, dY;
local w = TaxiRouteMap:GetWidth();
local h = TaxiRouteMap:GetHeight();

local type = coords_m[index][8]
if ( type == "REACHABLE" ) then
SetTooltipMoney(GameTooltip, coords_m[index][5]);
TaxiNodeSetCurrent(index);

if ( numRoutes > NUM_TAXI_ROUTES ) then
for i = NUM_TAXI_ROUTES+1, numRoutes do
line = TaxiRouteMap:CreateTexture("TaxiRoute"..i, "BACKGROUND");
line:SetTexture("Interface\TaxiFrame\UI-Taxi-Line");
end
NUM_TAXI_ROUTES = numRoutes;
end

for i=1, NUM_TAXI_ROUTES do
line = _G["TaxiRoute"..i];
if ( i <= numRoutes ) then
sX = coords_m[current][1]*w;
sY = coords_m[current][2]*h;
dX = coords_m[index][1]*w;
dY = coords_m[index][2]*h;
DrawRouteLine(line, "TaxiRouteMap", sX, sY, dX, dY, 32);
line:Show();
else
line:Hide();
end
end
elseif ( type == "CURRENT" ) then
GameTooltip:AddLine(TAXINODEYOUAREHERE, "", 0.5, 1.0, 0.5);
DrawOneHopLines();
end

GameTooltip:Show();
end

-- Draw all flightpaths within one hop of current location
function DrawOneHopLines()
local line;
local sX, sY, dX, dY;
local w = TaxiRouteMap:GetWidth();
local h = TaxiRouteMap:GetHeight();
local numNodes = #coords_m
local numLines = 0;
local numSingleHops = 0;
for i=1, numNodes  do
--if ( GetNumRoutes(i) == 1 ) then
numSingleHops = numSingleHops + 1;
numLines = numLines + 1;
if ( numLines > NUM_TAXI_ROUTES ) then
line = TaxiRouteMap:CreateTexture("TaxiRoute"..numLines, "BACKGROUND");
line:SetTexture("Interface\TaxiFrame\UI-Taxi-Line");
NUM_TAXI_ROUTES = numLines;
else
line = _G["TaxiRoute"..numLines];
end
if ( line ) then
sX = coords_m[current][1]*w;
sY = coords_m[current][2]*h;
dX = coords_m[current][1]*w;
dY = coords_m[current][2]*h;
DrawRouteLine(line, "TaxiRouteMap", sX, sY, dX, dY, 32);
line:Show();
end
--end
end
for i=numLines+1, NUM_TAXI_ROUTES do
_G["TaxiRoute"..i]:Hide();
end
if ( numSingleHops == 0 ) then
UIErrorsFrame:AddMessage(ERR_TAXINOPATHS, 1.0, 0.1, 0.1, 1.0);
HideUIPanel(TaxiFrame);
end
end


-- The following function is used with permission from Daniel Stephens <iriel@vigilance-committee.org>
TAXIROUTE_LINEFACTOR = 32/30; -- Multiplying factor for texture coordinates
TAXIROUTE_LINEFACTOR_2 = TAXIROUTE_LINEFACTOR / 2; -- Half o that

-- T        - Texture
-- C        - Canvas Frame (for anchoring)
-- sx,sy    - Coordinate of start of line
-- ex,ey    - Coordinate of end of line
-- w        - Width of line
-- relPoint - Relative point on canvas to interpret coords (Default BOTTOMLEFT)
function DrawRouteLine(T, C, sx, sy, ex, ey, w, relPoint)
   if (not relPoint) then relPoint = "BOTTOMLEFT"; end

   -- Determine dimensions and center point of line
   local dx,dy = ex - sx, ey - sy;
   local cx,cy = (sx + ex) / 2, (sy + ey) / 2;

   -- Normalize direction if necessary
   if (dx < 0) then
      dx,dy = -dx,-dy;
   end

   -- Calculate actual length of line
   local l = sqrt((dx * dx) + (dy * dy));

   -- Quick escape if it's zero length
   if (l == 0) then
      T:SetTexCoord(0,0,0,0,0,0,0,0);
      T:SetPoint("BOTTOMLEFT", C, relPoint, cx,cy);
      T:SetPoint("TOPRIGHT",   C, relPoint, cx,cy);
      return;
   end

   -- Sin and Cosine of rotation, and combination (for later)
   local s,c = -dy / l, dx / l;
   local sc = s * c;

   -- Calculate bounding box size and texture coordinates
   local Bwid, Bhgt, BLx, BLy, TLx, TLy, TRx, TRy, BRx, BRy;
   if (dy >= 0) then
      Bwid = ((l * c) - (w * s)) * TAXIROUTE_LINEFACTOR_2;
      Bhgt = ((w * c) - (l * s)) * TAXIROUTE_LINEFACTOR_2;
      BLx, BLy, BRy = (w / l) * sc, s * s, (l / w) * sc;
      BRx, TLx, TLy, TRx = 1 - BLy, BLy, 1 - BRy, 1 - BLx;
      TRy = BRx;
   else
      Bwid = ((l * c) + (w * s)) * TAXIROUTE_LINEFACTOR_2;
      Bhgt = ((w * c) + (l * s)) * TAXIROUTE_LINEFACTOR_2;
      BLx, BLy, BRx = s * s, -(l / w) * sc, 1 + (w / l) * sc;
      BRy, TLx, TLy, TRy = BLx, 1 - BRx, 1 - BLx, 1 - BLy;
      TRx = TLy;
   end

   -- Set texture coordinates and anchors
   T:ClearAllPoints();
   T:SetTexCoord(TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy);
   T:SetPoint("BOTTOMLEFT", C, relPoint, cx - Bwid, cy - Bhgt);
   T:SetPoint("TOPRIGHT",   C, relPoint, cx + Bwid, cy + Bhgt);
end

Server side code should listen for the message sent by the player (use addon messages, currently uses invisible whisper messages), verify they are next to the taxi master, then send the taxi if they are.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Namiriu

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 57
    • View Profile
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #9 on: November 01, 2014, 09:28:15 am »
Okay thanks for the help stoneharry, this seems a little bit complicated for me, but maybe i going to try :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Namiriu

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 57
    • View Profile
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #10 on: November 01, 2014, 10:43:11 am »
Here is my try with the little tutorial made by Amaroth :

Here is the Translate of the red message i've in game when i paid the price for my fly :
SERVER ERROR UNSPECIFIED TRANSPORT



And now lot of screenshot about what i exactly doing :

Truice - SmartAI of the creature


Truice - Creature Template


SQLYog - Gossip Menu


SQLYog - Gossip Menu Options 01


SQLYog - Gossip Menu Options 02


SQLYog - NPC Text



If someone can give a look, maybe you Amaroth if you come again in my thread, please help me :)
+ Download Link for the Taxis DBC's i've edited in attached files.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #11 on: November 01, 2014, 11:10:40 am »
TaxiNodes.dbc. You missed last 2 columns, they define which mount (from creature_template) shall be used for you. First is for alliance players, second for horde. And don't be misled by WoWDev, I'm pretty sure its creature_template.entry and NOT displayID there. Gonna fix it.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz

Namiriu

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 57
    • View Profile
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #12 on: November 01, 2014, 11:43:42 am »
Thanks this work nice now :) Sry for the mistake. Can i adapt and translate your tutorial for french community plz ?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: [QUESTION] [Trinity Core 3.3.5] New Flight Path doesn't
« Reply #13 on: November 01, 2014, 03:38:35 pm »
You mean this way around? :D

You can, if you want to.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz