Auto Mounts

EQ2Emulator Development forum.

Moderator: Team Members

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Auto Mounts

Post by Jabantiz » Wed Jan 20, 2016 1:45 am

Thanks to some help from smash we finally have auto mounts. Something so simple yet so exciting at the same time, well for me it is because we have tried and failed to get them working for years. Currently on the Emu server you can use the griffon from Thundering Steppes docks to Antonica Gate.

Now the boring how it works stuff, there are 2 tables and some lua needed in order to set up a path, first the tables.
flight paths.jpg
`flight_paths` is all the different paths
`id` is important here as it will be needed for lua
`zone_id` is the id of the zone the path is in
`name` is useless to the code but invaluable for content devs, it will describe the path
`speed` how fast the route is, default is 1.0
`flying` if this auto mout is flying (griffon) or on the ground (horse)
`early_dismount` set to 1 if the player can hit the jump key to get off the ride when ever they want, 0 means they are stuck until the end
flight path locations.jpg
`flight_paths_locations` is the actual list of locations that forms a route
`id` is used to order the list
`flight_path` is the id in `flight_paths` that this location belongs to
`x`
`y` These 3 are the xyz location
`z`

Order does matter in `flight_paths_locations` as you will travel from the first to the last, if they are mixed up you could be in for one wild ride.

Now to actually start an auto mount some where in a lua script you will need to use

Code: Select all

StartAutoMount(Spawn, 1)
Spawn is the player about to go for a ride, and it must be a player. 1 is the id (from `flight_paths`) of the path the player is to follow. This is also a good time to set the mount of the player, don't worry about there current mount as StartAutoMount() will take care of that for you.

Now the important part, you will need to set up a proximity location in the zone script to end the trip, this is required as with out it the player could be stuck on the auto mount until they force close the client, or /zone

Code: Select all

function init_zone_script(zone)
	SetLocationProximityFunction(zone, 172.5, 18.5, -880.97, 10, "GriffonTower", "Leave")
end

function GriffonTower(zone, Spawn)
	if IsPlayer(Spawn) and IsOnAutoMount(Spawn) then
		EndAutoMount(Spawn)
	end
end

function Leave(zone, Spawn)
end
It is important to have both an enter and leave function set in the proximity code as currently if there is no leave function the enter function can only ever be triggered once by any given player. In the enter function, "GriffonTower", we check to see if the spawn is a player and if they are on an auto mount and if they are we end the trip with EndAutoMount() which will restore player control and the mount they had before using the auto mount.
auto mount.jpg
Please log on to the emu server and give it a try, and let me know if you notice anything odd. I will see about getting all of thundering steppes set up over the next few days.
You do not have the required permissions to view the files attached to this post.

User avatar
Cynnar
Project Leader
Posts: 738
Joined: Sat Sep 27, 2014 1:22 am
EQ2Emu Server: Eq2emulator
Characters: Vlash
Veinlash
Taragak
Cynnar

Re: Auto Mounts

Post by Cynnar » Wed Jan 20, 2016 4:29 pm

VERY NICE!!!

When I get back to the house Monday I will check it out, and I will set out to put a tutorial on the wiki as well as getting the stable master automount setup for EC.

So glad you guys got it figured out. Thanks Smash and Jabantiz!
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]

Follow on:
Twitter Facebook

Contact me:
PM Discord chat email

Hardware: the parts of a computer that can be kicked

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: Auto Mounts

Post by Zcoretri » Wed Jan 20, 2016 8:03 pm

Nice stuff...will have to check this out :mrgreen:

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Auto Mounts

Post by Jabantiz » Thu Jan 21, 2016 4:03 am

All the griffon routes are now set up in thundering steppes, and I spent way to much time flying around the zone in a circle...

If any one has any problems at the end of the route please let me know the client version (data version preferably) as the opcode for landing is not set in a lot of versions still.

I also want to point out that these paths can be created by hand but they should probably be parsed as there are rather large paths in thundering steppes, largest is 199 points.

User avatar
xinux
Team Member
Posts: 680
Joined: Wed Mar 10, 2010 11:10 am
Location: Destroyer of Servers

Re: Auto Mounts

Post by xinux » Thu Jan 21, 2016 11:11 am

So what was the main issue? I know I looked into it some back in the day.
EQ II - Build=1360 (Orig) - Build=1360 (DoF) - Build=2654 (KoS) - Build=3375 (Classic) - Build=3554 (EoF)
EQ II - Build=4412 (RoK) - Build=5122 (TSO) - Build=6118 (SF) - Build=7628 (DoV) - Build=8295 (Aod)

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Auto Mounts

Post by Jabantiz » Fri Jan 22, 2016 2:09 pm

xinux wrote:So what was the main issue? I know I looked into it some back in the day.
Forgot to post the packet details, sorry about that will do that now, really the issue was we were looking in the wrong spot, they send a packet when you enter a zone with all flight paths, then the take off opcodes just reference that packet and off you go. It is really simple now that it has been figured out, but never thought to look at packets when you first enter the zone I always looked in the general area of when the flight started.

And here are the packet details. First when a client enter a zone they get the flight paths packet, this is what smash found making these mounts possible, it is currently under OP_RestartZoneMsg. The struct for this packet is unique and causes its own issues, basically the first element is the number of routes followed by an array of int16's that are each individual route lengths after that array is another array, using number or routes for size again, this array has a sub array of locations for the routes the size of these sub arrays is the element from the first array and that was the main issue with this packet as having an array of an array access a completely different array is impossible, got around it with some tricks in the xml struct though and will post only that struct as it is the one used by the server, but won't work in analyzer or parsing.

After the array with the sub array is two more arrays using number of routes for the size for both, again. The first of these two arrays has two int8's one is for if the mount is ground or flying, the other is if the player can jump off of the mount early. The second array has a single int16 and is unknown, always seems to be set to 00 though.

Here is the struct world uses

Code: Select all

<Struct Name="WS_FlightPathsMsg" ClientVersion="1" OpcodeName="OP_RestartZoneMsg">
<Data ElementName="number_of_routes" Type="int16" />
<Data ElementName="route_length_array" Type="Array" ArraySizeVariable="number_of_routes">
  <Data ElementName="route_length" Type="int16" />
</Data>
<Data ElementName="number_of_routes2" Type="int16" IfVariableNotSet="number_of_routes" />
<Data ElementName="routes_array" Type="Array" ArraySizeVariable="number_of_routes2">
  <Data ElementName="route_length2" Type="int16" IfVariableSet="number_of_routes" />
  <Data ElementName="route_coords_array" Type="Array" ArraySizeVariable="route_length2">
    <Data ElementName="x" Type="float" />
    <Data ElementName="y" Type="float" />
    <Data ElementName="z" Type="float" />
  </Data>
</Data>
<Data ElementName="number_of_routes3" Type="int16" IfVariableNotSet="number_of_routes" />
<Data ElementName="route_info" Type="Array" ArraySizeVariable="number_of_routes3">
  <Data ElementName="ground_mount" Type="int8" />
  <Data ElementName="allow_dismount" Type="int8" />
</Data>
<Data ElementName="number_of_routes4" Type="int16" IfVariableNotSet="number_of_routes" />
<Data ElementName="route_unknown" Type="Array" ArraySizeVariable="number_of_routes4">
  <Data ElementName="unknown" Type="int16" />
</Data>
</Struct>
Anything with an IfVariable in the element is not actually part of the packet and the IfVariable is used to make sure it doesn't get added, but we can still use those fake elements for array sizes and set them in code allowing us to build the correct packet.

Again this is sent when you enter a zone that has flight routes.

After that to start the route you just send

Code: Select all

<Struct Name="WS_ReadyForTakeOff" ClientVersion="1" OpcodeName="OP_ReadyForTakeOffMsg">
</Struct>
The client will respond with the same exact packet and at that point we reply with clear for takeoff

Code: Select all

<Struct Name="WS_ClearForTakeOff" ClientVersion="1" OpcodeName="OP_ClearForTakeOffMsg">
<Data ElementName="spawn_id" Type="int32" />
<Data ElementName="path_id" Type="int8" />
<Data ElementName="speed" Type="float" />
<Data ElementName="unknown3" Type="int16" />
</Struct>
spawn_id is the id of the player this packet is being sent to
path_id is the index of the id in the WS_FlightPathsMsg, I made a function in ZoneServer to get the index it was sent in by the DB id of the path to make it simple
speed is the speed of the route, have only seen 1.0f but it is set up so you can provide whatever speed you want in the DB

And at this point the player takes off on their auto mount. To give the player control back we send the clear for landing packet

Code: Select all

<Struct Name="WS_ClearForLanding" ClientVersion="1" OpcodeName="OP_ClearForLandingMsg">
<Data ElementName="spawn_id" Type="int32" />
</Struct>
spawn_id is the id of the player being sent this packet.

In order to send this packet we need to set proximity locations in the zone script to trigger when on an auto mount (see lua in first post) or if early dismount is allowed send the packet in response to OP_EarlyLandingRequestMsg, this opcode will only be sent when the player hits jump and the route allows early dismounts as specified in WS_FlightPathsMsg.

And that is it, packet flow turned out to be a lot simpler then I thought once that flight path packet was identified.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Auto Mounts

Post by John Adams » Fri Jan 22, 2016 6:55 pm

This excites me in ways you cannot imagine, because of how many years ago I wanted this implemented :) Good job, guys.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Auto Mounts

Post by Jabantiz » Fri Jan 22, 2016 11:36 pm

John Adams wrote:This excites me in ways you cannot imagine, because of how many years ago I wanted this implemented :) Good job, guys.
I spent hours the other night just flying around lol, a lot longer then it took me to set up all the NPC's

Just now I added some more parsed data to the server, only did 5 zones but the result for those are 145 routes and 10,748 locations. This is just the data, the content side has not been touched in these zones which are Enchanted Lands, Zek, Antonica, Great Divide, GFay. These zones got in because I had logs of them laying around while I was working on the eq2db2 editor and I needed more data then steppes.

Also have some bug fixes and error catching if the path is not in your zone. Code should be on the server later tonight.

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Re: Auto Mounts

Post by alfa » Sat Jan 30, 2016 4:40 am

Well done Jab !
I will log in this night for do some circle too ^^
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Re: Auto Mounts

Post by alfa » Mon Feb 01, 2016 12:12 pm

Sorry Jab, but it won't work for me. I click on npc to choose one, and then, black screen, wait for 5 min and still nothing.
Client 10586 L
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Auto Mounts

Post by Jabantiz » Mon Feb 01, 2016 4:08 pm

Sounds like bad opcodes, I will have to dig around for the data version for that client, as it doesn't match any of the clients I have, and look into its opcodes. Thanks for reporting.

EDIT: (data version 57109)
EDIT2: Ok this is odd, the opcodes look fine from what I can tell, I am not sure what would cause this. When you start an auto mount does it appear that you are ported? Do you see yourself go onto a mount briefly before it happens or does it just go black instantly?

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Re: Auto Mounts

Post by alfa » Mon Feb 01, 2016 5:56 pm

And when I log in again, still a black screen. I see a message in red about index path and game crash or it log me out
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Auto Mounts

Post by Jabantiz » Wed Feb 03, 2016 8:23 pm

The red message about index path is something I added in to help debug issues. From what I can tell the important opcodes are correct (checked logs before and after that version and they line up) and as I don't have this client it is challenging to debug so I will need more information.

Are you testing on the emu server or private?
Are you going to the griffon tamers or using /test
If using the tamers do you briefly appear on a mount?
Does it appear that you are ported after starting the auto mount?


Ok it is not working at all now, looks like the flight packet is getting corrupted some how, looking into it.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Auto Mounts

Post by Jabantiz » Thu Feb 04, 2016 12:34 am

Ok it should work again, looks like an improvement to packet struct code was actually corrupting the flight packet, removed that code and every things seems to be working again.

User avatar
alfa
Team Member
Posts: 550
Joined: Fri Jul 27, 2007 6:24 pm
Location: France
Contact:

Re: Auto Mounts

Post by alfa » Sun Feb 07, 2016 4:37 am

No, it won't :( Everytimes I try to log in I have a black screen, I cannot change zone or run commands and avec about 10 seconds my client crash
Fight with me... Or die, like the rest.
J.A. say: "I think Xinux tried to tell me this, but I ignore most things he suggests."

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests