Page 1 of 1

Custom @zone ports

Posted: Thu Apr 30, 2015 9:33 am
by doc730
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.

Re: Custom @zone ports

Posted: Thu Apr 30, 2015 9:58 am
by Delaide
player:setPos(0, 0, 0, 0, zoneId);
in https://github.com/DarkstarProject/dark ... s/zone.lua

Re: Custom @zone ports

Posted: Thu Apr 30, 2015 12:57 pm
by doc730
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.

Re: Custom @zone ports

Posted: Thu Apr 30, 2015 1:22 pm
by TeoTwawki
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.

Re: Custom @zone ports

Posted: Thu Apr 30, 2015 4:16 pm
by doc730
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?

Re: Custom @zone ports

Posted: Thu Apr 30, 2015 5:55 pm
by whasf
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 :)

Re: Custom @zone ports

Posted: Thu Apr 30, 2015 6:55 pm
by TeoTwawki

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.

Re: Custom @zone ports

Posted: Thu Apr 30, 2015 7:01 pm
by doc730
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.

Re: Custom @zone ports

Posted: Sun May 10, 2015 10:26 pm
by tagban
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 ->"