Outpost Teleport - Region Values Differ
Posted: Sat Dec 08, 2012 11:12 am
r2067 (Didn't find any new revision related to Outpost Warp/Teleport so I haven't updated yet...)
First of note, all San d'Oria owned (default) teleports to Region [toOutpost(player,option)] work for me, except when trying to Teleport to Elshimo Lowlands. I'm using the NPC Jeanvirgaud in San d'Oria to Teleport (obviously you know who teleports in San d'Oria...).
Jeanvirgaud's onEventFinish:
When I try to teleport to Elshimo Lowlands, I get the following error, which is related to the Gil transaction for the Warp service:
After playing around with printf to verify which values are being passed around, I found the following: When I select Elshimo Lowlands, the region passed as paremeter is 19, and is used to teleport to the specific region through function toOutpost(player,option). However, GetRegionOwner uses different region values contained in the conquest.lua file where ELSHIMOLOWLANDS is value 14, not 19, and no value 19 exists. When the GetRegionOwner(region) is executed, it finds no match. It then goes through the else section, and when it tries to return the tpFees, it's null because region 19 does not exist in conquest.lua.
These are the differences:
Conquest.lua
conquestguards.lua
Conveniently, and probably not a coincidence, the Region Option Value in conquestguards.lua is 5 points higher than the Region Option Value in conquest.lua. So, as a temporary fix, I'm using if(player:delGil(OP_TeleFee(player,option-5))) then in Jeanvirgaud.lua.
I apologize for the long post and hope the information is useful (and not a duplicate). Couldn't find anything solid in the forums through search using keywords: Elshimo, Lowlands, Outpost, Teleport, etc.
First of note, all San d'Oria owned (default) teleports to Region [toOutpost(player,option)] work for me, except when trying to Teleport to Elshimo Lowlands. I'm using the NPC Jeanvirgaud in San d'Oria to Teleport (obviously you know who teleports in San d'Oria...).
Jeanvirgaud's onEventFinish:
Code: Select all
function onEventFinish(player,csid,option)
printf("CSID: %u",csid);
printf("RESULT: %u,option);
if(option >= 5 and option <= 23) then
if(player:delGil(OP_TeleFee(player,option))) then
toOutpost(player,option);
end
end
end
This error occurs on the following statement: player:delGil(OP_TeleFee(player,option) on the "onEventFinish" function. I opened up the file that contains the OP_TeleFee() function: conquestguards.lua. The function reads:[05:39:23][LUA Script] CSID: 716
[05:39:23][LUA Script] RESULT: 19
[05:39:23][Error] luautils::OnEventFinish ./scripts/globals/conquestguards.lua:405: attempt to perform arithmetic on field '?' (a nil value)
Code: Select all
-----------------------------------------------------------------
-- function OP_TeleFee(player,region)
-----------------------------------------------------------------
function OP_TeleFee(player,region)
printf("REGION_FEE: %u",region);
if(GetRegionOwner(region) == player:getNation()) then
printf("REGION_O: %u",1);
return tpFees[region + 5];
else
printf("REGION_O: %u",0);
return tpFees[region + 5] * 3;
end
end;
These are the differences:
Conquest.lua
Code: Select all
-----------------------------------
-- convenience constants
-----------------------------------
SANDORIA = 0;
BASTOK = 1;
WINDURST = 2;
BEASTMEN = 3;
OTHER = 4;
RONFAURE = 0;
ZULKHEIM = 1;
NORVALLEN = 2;
GUSTABERG = 3;
DERFLAND = 4;
SARUTABARUTA = 5;
KOLSHUSHU = 6;
ARAGONEU = 7;
FAUREGANDI = 8;
VALDEAUNIA = 9;
QUFIMISLAND = 10;
LITELOR = 11;
KUZOTZ = 12;
VOLLBOW = 13;
ELSHIMOLOWLANDS = 14;
ELSHIMOUPLANDS = 15;
TULIA = 16;
MOVALPOLOS = 17;
TAVNAZIA = 18;
Code: Select all
---------------------------------
-- Teleport Nation > Outpost
---------------------------------
function toOutpost(player,option)
-- Ronfaure
if(option == 5) then
player:setPos(-446, -20 , -220, 0, 100);
-- Zulkheim
elseif(option == 6) then
player:setPos(149, -7 , 94, 154, 103);
-- Norvallen
elseif(option == 7) then
player:setPos(62, 0 , -1, 67, 104);
-- Gustaberg
elseif(option == 8) then
player:setPos(-579, 39 , 62, 89, 106);
-- Derfland
elseif(option == 9) then
player:setPos(465, 24 , 422, 29, 109);
-- Sarutabatura
elseif(option == 10) then
player:setPos(-15, -13 , 318, 128, 115);
-- Kolshushu
elseif(option == 11) then
player:setPos(-480, -30 , 57, 62, 118);
-- Aragoneu
elseif(option == 12) then
player:setPos(-298, 17 , 418, 98, 119);
-- Fauregandi
elseif(option == 13) then
player:setPos(-18, -59, -108, 100, 111);
-- Valdeaunia
elseif(option == 14) then
player:setPos(210, -23, -206, 160, 112);
-- Qufim Island
elseif(option == 15) then
player:setPos(-246, -20 , 301, 192, 126);
-- Lil'Telor
elseif(option == 16) then
player:setPos(-38, 0, -140, 69, 121);
-- Kuzotz
elseif(option == 17) then
player:setPos(-250, 8, -252, 122, 114);
-- Vollbow
elseif(option == 18) then
player:setPos(-184, 8, -66, 0, 113);
-- Elshimo Lowlands
elseif(option == 19) then
player:setPos(-243, 0, -400, 192, 123);
-- Elshimo Uplands
elseif(option == 20) then
player:setPos(203, 0, -82, 36, 124);
-- Tulia ?!
elseif(option == 21) then
player:setPos(4, -54, -600, 192, 130);
-- Tavnazia
elseif(option == 23) then
player:setPos(-535, -6, -53, 122, 24);
end;
end;
I apologize for the long post and hope the information is useful (and not a duplicate). Couldn't find anything solid in the forums through search using keywords: Elshimo, Lowlands, Outpost, Teleport, etc.