Custom @zone ports

Post Reply
doc730
Posts: 9
Joined: Mon Apr 06, 2015 8:18 am

Custom @zone ports

Post by doc730 » Thu Apr 30, 2015 9:33 am

I am trying to find any information on how to create custom @zone Id command. where to find the file with the @pos you are ported to when using @zone id# and how to create a custom @command to make new zone ports. Any information would be greatly appreciated.

Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Re: Custom @zone ports

Post by Delaide » Thu Apr 30, 2015 9:58 am

player:setPos(0, 0, 0, 0, zoneId);
in https://github.com/DarkstarProject/dark ... s/zone.lua

doc730
Posts: 9
Joined: Mon Apr 06, 2015 8:18 am

Re: Custom @zone ports

Post by doc730 » Thu Apr 30, 2015 12:57 pm

Delaide wrote:player:setPos(0, 0, 0, 0, zoneId);
in https://github.com/DarkstarProject/dark ... s/zone.lua


Im looking specificly way to port to a @where position. When I use @zone for Chocobo Circuit, it places me inside a will with no ground in middle of the race track. Also would like to make for custom ports for experience camps ect. Thank you for your reply BTW. If this is telling me how to do it, I apologize, i am not good with programming, am I am however trying to learn and understand how these files work.

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: Custom @zone ports

Post by TeoTwawki » Thu Apr 30, 2015 1:22 pm

doc730 wrote:
Delaide wrote:player:setPos(0, 0, 0, 0, zoneId);
in https://github.com/DarkstarProject/dark ... s/zone.lua

Im looking specificly way to port to a @where position.
That would be the function he just showed you, just replace the zeros. They are: x, y, z, rotation, zoneId. The GM command to use them is @pos

@pos 51 -113 15 64 49
Would place me at x51 y-113 z15 rot64 in zone 49.

Ouside of the Gm command, you'd use object:setpos() inside your script as Delaide showed you replacing the values with what you need.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

doc730
Posts: 9
Joined: Mon Apr 06, 2015 8:18 am

Re: Custom @zone ports

Post by doc730 » Thu Apr 30, 2015 4:16 pm

teotwawki wrote:
doc730 wrote:
Delaide wrote:player:setPos(0, 0, 0, 0, zoneId);
in https://github.com/DarkstarProject/dark ... s/zone.lua

Im looking specificly way to port to a @where position.
That would be the function he just showed you, just replace the zeros. They are: x, y, z, rotation, zoneId. The GM command to use them is @pos

@pos 51 -113 15 64 49
Would place me at x51 y-113 z15 rot64 in zone 49.

Ouside of the Gm command, you'd use object:setpos() inside your script as Delaide showed you replacing the values with what you need.

Ok, after I added my x, y, z, rotation, zoneId and I attempt to use the command it tells me "YOu must enter a zone id." Please tell me what I am doing wrong.

This is what I have:



---------------------------------------------------------------------------------------------------
-- func: onTrigger
-- desc: Called when this command is invoked.
---------------------------------------------------------------------------------------------------
function onTrigger(player, zoneId)
local word = "";
local i = 0;
local zone = 70;

-- Ensure a zone was given..
if (zoneId == nil) then
player:PrintToPlayer("You must enter a zone id.");
return;
end

-- Was the zone auto-translated..
if (string.sub(zoneId, 1, 2) == '\253\02' and string.byte(zoneId, 5) ~= nil and string.byte(zoneId, 6) == 0xFD) then
-- Pull the group and message id from the translated string..
local groupId = string.byte(zoneId, 4);
local messageId = string.byte(zoneId, 5);

-- Attempt to lookup this zone..
for k, v in pairs(zone_list) do
if (v[1] == groupId and v[2] == messageId) then
player:setPos(0, 0, 0, 0, v[3]);
return;
end
end

-- Zone was not found, allow the user to know..
player:PrintToPlayer('Unknown zone, could not teleport.');
return;
end

player:setPos(-320, 0, -474, 61, 70);
end



And i inputing the pos in the wrong line?

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Custom @zone ports

Post by whasf » Thu Apr 30, 2015 5:55 pm

You have a local "zone" set to 70, then right after you check for zoneID.. Of course zoneID is going to be nil, you didn't set it a value first :)
-- Whasf

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: Custom @zone ports

Post by TeoTwawki » Thu Apr 30, 2015 6:55 pm

Code: Select all

code tags
learn to love them.

Code: Select all

function onTrigger(player, zoneId)

Code: Select all

if (zoneId == nil) then
Guessing that either you you failed to set the command properties or else didn't supply the zoneId to your command.

Code: Select all

cmdprops =
{
    permission = 1,
    parameters = "i"
};
i is for an integer param, s is for a string.
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

doc730
Posts: 9
Joined: Mon Apr 06, 2015 8:18 am

Re: Custom @zone ports

Post by doc730 » Thu Apr 30, 2015 7:01 pm

whasf wrote:You have a local "zone" set to 70, then right after you check for zoneID.. Of course zoneID is going to be nil, you didn't set it a value first :)

Ok, lol. I am getting to where I need to be, I just want this to work where I could type in a command without having to type in a zoneid, just use the @commandname instead of @commandname 70 but I am totally lost on this. Any help is appreciated.

User avatar
tagban
Posts: 352
Joined: Fri Dec 28, 2012 11:31 am
Location: Pennsylvania, USA

Re: Custom @zone ports

Post by tagban » Sun May 10, 2015 10:26 pm

You can also set the enter location in the zone's Lua file, then upload the fix to DSP.. ;) The Lua file basically says "If user comes in at 0,0,0 etc.. then put them here ->"

Post Reply