Auto Mounts
Posted: 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` 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_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
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
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.
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.
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` 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_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)
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
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.