WVWMK 121 Report post Posted December 30, 2017 На самом деле не случайное перемещение, но идея тут есть. Оптимизация кода очень даже требуется, лучше заносить все в массивы и не губить себя, но я был глуп и писал это ручками. Идеи по оптимизации: 1. Нарезать каждую карту на квадраты и рандомить X и Y из квадрата 2. Просто загнать все точки в массивы и в функции рандомить. --Cвиток перемещения function ItemUse_peremech(role, Item ) local Cha_Boat = GetCtrlBoat ( role ) if Cha_Boat ~= nil then SystemNotice( role , "Не может быть использовано, когда Вы в море!" ) UseItemFailed ( role ) return end local i = CheckBagItem(role,8618) local k = ChaIsBoat(role) local map_name_role = GetChaMapName ( role ) local hp = Hp(role) local mxhp = Mxhp(role) local sp = Sp(role) local mxsp = Mxsp(role) local x, y = GetChaPos( role ) if k == 0 then if i > 0 then local j = DelBagItem(role,ID,1) -- ВАШ ID if j == 1 then --ОБ if map_name_role =="lonetower" then if a == 1 then GoTo( role, 273,269, "lonetower") return end if a == 2 then GoTo( role, 357,271,"lonetower") return end if a == 3 then GoTo( role, 362,316,"lonetower") return end if a == 4 then GoTo( role, 306,351, "lonetower") return end if a == 5 then GoTo( role, 279,344,"lonetower") return end if a == 6 then GoTo( role, 269,319, "lonetower") return end if a == 7 then GoTo( role, 318,358,"lonetower") return end if a == 8 then GoTo( role, 294,318, "lonetower") return end if a == 9 then GoTo( role, 375,311, "lonetower") return end if a == 10 then GoTo( role, 260,282,"lonetower") return end if a == 11 then GoTo( role, 42,133, "lonetower") return end if a == 12 then GoTo( role, 119,67, "lonetower") return end if a == 13 then GoTo( role, 169,32,"lonetower") return end if a == 14 then GoTo( role, 37,60,"lonetower") return end if a == 15 then GoTo( role, 28,157,"lonetower") return end if a == 16 then GoTo( role, 97,174,"lonetower") return end if a == 17 then GoTo( role, 116,78,"lonetower") return end if a == 18 then GoTo( role, 39,18,"lonetower") return end if a == 19 then GoTo( role, 29,172,"lonetower") return end if a == 20 then GoTo( role, 75,132,"lonetower") return end if a == 21 then GoTo( role, 166,278,"lonetower") return end if a == 22 then GoTo( role, 40,269 ,"lonetower") return end if a == 23 then GoTo( role, 38,349 ,"lonetower") return end if a == 24 then GoTo( role, 84,395 ,"lonetower") return end if a == 25 then GoTo( role, 169,405,"lonetower") return end if a == 26 then GoTo( role, 101,260,"lonetower") return end if a == 27 then GoTo( role, 29,305,"lonetower") return end if a == 28 then GoTo( role, 119,314,"lonetower") return end if a == 29 then GoTo( role, 165,380,"lonetower") return end if a == 30 then GoTo( role, 74,312,"lonetower") return end if a == 31 then GoTo( role, 242,114,"lonetower") return end if a == 32 then GoTo( role, 282,169,"lonetower") return end if a == 33 then GoTo( role, 361,180,"lonetower") return end if a == 34 then GoTo( role, 325,82,"lonetower") return end if a == 35 then GoTo( role, 341,21,"lonetower") return end if a == 36 then GoTo( role, 239,25,"lonetower") return end if a == 37 then GoTo( role, 238,74,"lonetower") return end if a == 38 then GoTo( role, 294,84,"lonetower") return end if a == 39 then GoTo( role, 280,60,"lonetower") return end if a == 40 then GoTo( role, 373,39,"lonetower") return end if a == 41 then GoTo( role, 550,54,"lonetower") return end if a == 42 then GoTo( role, 628,74,"lonetower") return end if a == 43 then GoTo( role, 508,126,"lonetower") return end if a == 44 then GoTo( role, 597,147,"lonetower") return end if a == 45 then GoTo( role, 484,38,"lonetower") return end if a == 46 then GoTo( role, 588,25,"lonetower") return end if a == 47 then GoTo( role, 512,157,"lonetower") return end if a == 48 then GoTo( role, 526,72,"lonetower") return end if a == 49 then GoTo( role, 631,100,"lonetower") return end if a == 50 then GoTo( role, 568,87,"lonetower") return end if a == 51 then GoTo( role, 545,278,"lonetower") return end if a == 52 then GoTo( role, 517,307,"lonetower") return end if a == 53 then GoTo( role, 516,273,"lonetower") return end if a == 54 then GoTo( role, 471,298,"lonetower") return end if a == 55 then GoTo( role, 496,323,"lonetower") return end if a == 56 then GoTo( role, 548,318,"lonetower") return end if a == 57 then GoTo( role, 542,274,"lonetower") return end if a == 58 then GoTo( role, 493,302,"lonetower") return end if a == 59 then GoTo( role, 533,304,"lonetower") return end if a == 60 then GoTo( role, 508,323,"lonetower") return end end --Залив сокровищ if map_name_role == "jialebi" then local a = math.random ( 1, 10 ) if a == 1 then GoTo( role, 683, 999, "jialebi") return end if a == 2 then GoTo( role, 526, 965, "jialebi") return end if a == 3 then GoTo( role, 454, 1031, "jialebi") return end if a == 4 then GoTo( role, 531, 915, "jialebi") return end if a == 5 then GoTo( role, 584, 918,"jialebi") return end if a == 6 then GoTo( role, 664, 935, "jialebi") return end if a == 7 then GoTo( role, 434, 1006,"jialebi") return end if a == 8 then GoTo( role, 688, 1051,"jialebi") return end if a == 9 then GoTo( role, 451, 958,"jialebi") return end end --Логово БД if map_name_role == "heilong" then local a = math.random ( 1, 10 ) if a == 1 then GoTo( role, 724, 289, "heilong") return end if a == 2 then GoTo( role, 728, 480, "heilong") return end if a == 3 then GoTo( role, 872, 362, "heilong") return end if a == 4 then GoTo( role, 812, 425, "heilong") return end if a == 5 then GoTo( role, 690, 400, "heilong") return end if a == 6 then GoTo( role, 685, 253, "heilong") return end if a == 7 then GoTo( role, 834, 442, "heilong") return end if a == 8 then GoTo( role, 890, 520, "heilong") return end if a == 9 then GoTo( role, 882, 391, "heilong") return end if a == 10 then GoTo( role, 683, 354,"heilong") return end end --Аргент if map_name_role == "garner" then local a = math.random ( 1, 37 ) if a == 1 then GoTo( role, x, y, "garner") return end if a == 2 then GoTo( role, 1579, 3027, "garner") return end if a == 3 then GoTo( role, 1905, 2818, "garner") return end if a == 4 then GoTo( role, 1479, 2805, "garner") return end if a == 5 then GoTo( role, 1879, 2530, "garner") return end if a == 6 then GoTo( role, 2114, 2649, "garner") return end if a == 7 then GoTo( role, 2005, 2777, "garner") return end if a == 8 then GoTo( role, 1795, 2968, "garner") return end if a == 9 then GoTo( role, 1488, 3206, "garner") return end if a == 10 then GoTo( role, 1314, 3109, "garner") return end if a == 11 then GoTo( role, 1242, 2749, "garner") return end if a == 12 then GoTo( role, 980, 2777, "garner") return end if a == 13 then GoTo( role, 973, 2965, "garner") return end if a == 14 then GoTo( role, 842, 3012, "garner") return end if a == 15 then GoTo( role, 883, 2883, "garner") return end if a == 16 then GoTo( role, 814, 2777, "garner") return end if a == 17 then GoTo( role, 876, 2639, "garner") return end if a == 18 then GoTo( role, 1083, 2574, "garner") return end if a == 19 then GoTo( role, 438, 2602, "garner") return end if a == 20 then GoTo( role, 610, 2505, "garner") return end if a == 21 then GoTo( role, 876, 2452, "garner") return end if a == 22 then GoTo( role, 369, 2461, "garner") return end if a == 23 then GoTo( role, 585, 2317, "garner") return end if a == 24 then GoTo( role, 463, 2127, "garner") return end if a == 25 then GoTo( role, 810, 1961, "garner") return end if a == 26 then GoTo( role, 717, 1860, "garner") return end if a == 27 then GoTo( role, 518, 1766, "garner") return end if a == 28 then GoTo( role, 896, 1697, "garner") return end if a == 29 then GoTo( role, 452, 1641, "garner") return end if a == 30 then GoTo( role, 394, 1387, "garner") return end if a == 30 then GoTo( role, 808, 1258, "garner") return end if a == 31 then GoTo( role, 948, 1291, "garner") return end if a == 32 then GoTo( role, 360, 1327, "garner") return end if a == 33 then GoTo( role, 735, 1289, "garner") return end if a == 34 then GoTo( role, 2267, 1126, "garner") return end if a == 35 then GoTo( role, 3587, 767, "garner") return end if a == 36 then GoTo( role, 3315, 3250, "garner") return end if a == 37 then GoTo( role, 600, 1874, "garner") return end end --Ледынь if map_name_role == "darkblue" then local a = math.random ( 1, 30 ) if a == 1 then GoTo( role, x, y, "darkblue") return end if a == 2 then GoTo( role, 1549, 588, "darkblue") return end if a == 3 then GoTo( role, 1455, 300, "darkblue") return end if a == 5 then GoTo( role, 1184, 416, "darkblue") return end if a == 6 then GoTo( role, 1219, 558, "darkblue") return end if a == 7 then GoTo( role, 908, 902, "darkblue") return end if a == 8 then GoTo( role, 958, 634, "darkblue") return end if a == 9 then GoTo( role, 795, 348, "darkblue") return end if a == 10 then GoTo( role, 630, 311, "darkblue") return end if a == 11 then GoTo( role, 1000, 380, "darkblue") return end if a == 12 then GoTo( role, 1090, 627, "darkblue") return end if a == 13 then GoTo( role, 1039, 815, "darkblue") return end if a == 14 then GoTo( role, 2022, 539, "darkblue") return end if a == 15 then GoTo( role, 2251, 484, "darkblue") return end if a == 16 then GoTo( role, 2283, 629, "darkblue") return end if a == 17 then GoTo( role, 2596, 416, "darkblue") return end if a == 18 then GoTo( role, 2661, 581, "darkblue") return end if a == 19 then GoTo( role, 2606, 858, "darkblue") return end if a == 20 then GoTo( role, 2800, 664, "darkblue") return end if a == 21 then GoTo( role, 2980, 522, "darkblue") return end if a == 22 then GoTo( role, 3084, 555, "darkblue") return end if a == 23 then GoTo( role, 3132, 661, "darkblue") return end if a == 24 then GoTo( role, 2868, 700, "darkblue") return end if a == 25 then GoTo( role, 2745, 490, "darkblue") return end if a == 26 then GoTo( role, 1606, 1973, "darkblue") return end if a == 27 then GoTo( role, 3375, 2527, "darkblue") return end if a == 28 then GoTo( role, 3597, 3015, "darkblue") return end if a == 29 then GoTo( role, 3398, 3502, "darkblue") return end if a == 30 then GoTo( role, 2640, 3118, "darkblue") return end end --Шайтан if map_name_role == "magicsea" then local a = math.random ( 1, 18 ) if a == 1 then GoTo( role, x, y, "magicsea") return end if a == 2 then GoTo( role, 1259, 3355, "magicsea") return end if a == 3 then GoTo( role, 1155, 3122, "magicsea") return end if a == 4 then GoTo( role, 1428, 2971, "magicsea") return end if a == 5 then GoTo( role, 1033, 3203, "magicsea") return end if a == 6 then GoTo( role, 1195, 3533, "magicsea") return end if a == 7 then GoTo( role, 697, 3304, "magicsea") return end if a == 8 then GoTo( role, 953, 3385, "magicsea") return end if a == 9 then GoTo( role, 1007, 3493, "magicsea") return end if a == 10 then GoTo( role, 808, 3004, "magicsea") return end if a == 11 then GoTo( role, 583, 2947, "magicsea") return end if a == 12 then GoTo( role, 778, 3153, "magicsea") return end if a == 13 then GoTo( role, 957, 3554, "magicsea") return end if a == 14 then GoTo( role, 855, 3385, "magicsea") return end if a == 15 then GoTo( role, 2516, 2474, "magicsea") return end if a == 16 then GoTo( role, 2601, 2407, "magicsea") return end if a == 17 then GoTo( role, 1687, 3762, "magicsea") return end if a == 18 then GoTo( role, 2368, 611, "magicsea") return end end --ХС if map_name_role == "garner2" then local a = math.random ( 1, 18 ) if a == 1 then GoTo( role, x, y, "garner2") return end if a == 2 then GoTo( role, 247, 178, "garner2") return end if a == 3 then GoTo( role, 203, 175, "garner2") return end if a == 4 then GoTo( role, 191, 108, "garner2") return end if a == 5 then GoTo( role, 187, 63, "garner2") return end if a == 6 then GoTo( role, 135, 241, "garner2") return end if a == 7 then GoTo( role, 134, 196, "garner2") return end if a == 8 then GoTo( role, 122, 129, "garner2") return end if a == 9 then GoTo( role, 150, 79, "garner2") return end if a == 10 then GoTo( role, 148, 35, "garner2") return end if a == 11 then GoTo( role, 63, 56, "garner2") return end if a == 12 then GoTo( role, 203, 34, "garner2") return end if a == 13 then GoTo( role, 97, 137, "garner2") return end end --ДВ if map_name_role == "puzzleworld" then local a = math.random ( 1, 18 ) if a == 1 then GoTo( role, x, y, "puzzleworld") return end if a == 2 then GoTo( role, 492, 507, "puzzleworld") return end if a == 3 then GoTo( role, 46, 504, "puzzleworld") return end if a == 4 then GoTo( role, 47, 47, "puzzleworld") return end if a == 5 then GoTo( role, 492, 44, "puzzleworld") return end if a == 6 then GoTo( role, 207, 71, "puzzleworld") return end if a == 7 then GoTo( role, 442, 275, "puzzleworld") return end if a == 8 then GoTo( role, 91, 275, "puzzleworld") return end if a == 9 then GoTo( role, 101, 107, "puzzleworld") return end if a == 10 then GoTo( role, 431, 106, "puzzleworld") return end if a == 11 then GoTo( role, 435, 448, "puzzleworld") return end if a == 12 then GoTo( role, 263, 450, "puzzleworld") return end if a == 13 then GoTo( role, 271, 104, "puzzleworld") return end if a == 14 then GoTo( role, 111, 272, "puzzleworld") return end if a == 15 then GoTo( role, 425, 197, "puzzleworld") return end if a == 16 then GoTo( role, 110, 350, "puzzleworld") return end if a == 17 then GoTo( role, 278, 526, "puzzleworld") return end if a == 18 then GoTo( role, 294, 245, "puzzleworld") return end if a == 19 then GoTo( role, 247, 314, "puzzleworld") return end if a == 20 then GoTo( role, 394, 354, "puzzleworld") return end if a == 21 then GoTo( role, 395, 388, "puzzleworld") return end if a == 22 then GoTo( role, 512, 288, "puzzleworld") return end end --ДВ2 if map_name_role == "puzzleworld2" then local a = math.random ( 1, 18 ) if a == 1 then GoTo( role, x, y, "puzzleworld2") return end if a == 2 then GoTo( role, 492, 507, "puzzleworld2") return end if a == 3 then GoTo( role, 46, 504, "puzzleworld2") return end if a == 4 then GoTo( role, 47, 47, "puzzleworld2") return end if a == 5 then GoTo( role, 492, 44, "puzzleworld2") return end if a == 6 then GoTo( role, 207, 71, "puzzleworld2") return end if a == 7 then GoTo( role, 442, 275, "puzzleworld2") return end if a == 8 then GoTo( role, 91, 275, "puzzleworld2") return end if a == 9 then GoTo( role, 101, 107, "puzzleworld2") return end if a == 10 then GoTo( role, 431, 106, "puzzleworld2") return end if a == 11 then GoTo( role, 435, 448, "puzzleworld2") return end if a == 12 then GoTo( role, 263, 450, "puzzleworld2") return end if a == 13 then GoTo( role, 271, 104, "puzzleworld2") return end if a == 14 then GoTo( role, 111, 272, "puzzleworld2") return end if a == 15 then GoTo( role, 425, 197, "puzzleworld2") return end if a == 16 then GoTo( role, 110, 350, "puzzleworld2") return end if a == 17 then GoTo( role, 278, 526, "puzzleworld2") return end if a == 18 then GoTo( role, 294, 245, "puzzleworld2") return end if a == 19 then GoTo( role, 247, 314, "puzzleworld2") return end if a == 20 then GoTo( role, 394, 354, "puzzleworld2") return end if a == 21 then GoTo( role, 395, 388, "puzzleworld2") return end if a == 22 then GoTo( role, 512, 288, "puzzleworld2") return end end --СНВ if map_name_role == "07xmas2" then local a = math.random ( 1, 6 ) if a == 1 then GoTo( role, x, y, "07xmas2") return end if a == 2 then GoTo( role, 46, 62, "07xmas2") return end if a == 3 then GoTo( role, 223, 81, "07xmas2") return end if a == 4 then GoTo( role, 247, 233, "07xmas2") return end if a == 5 then GoTo( role, 144, 160, "07xmas2") return end if a == 6 then GoTo( role, 36, 212, "07xmas2") return end end --ФС if map_name_role == "abandonedcity" then local a = math.random ( 1, 5 ) if a == 1 then GoTo( role, 163, 202, "abandonedcity") return end if a==2 then GoTo( role, 214, 298, "abandonedcity") return end if a==3 then GoTo( role, 78, 252, "abandonedcity") return end if a==4 then GoTo( role, 131, 126, "abandonedcity") return end if a==5 then GoTo( role, 280, 148, "abandonedcity") return end end --ФС2 if map_name_role == "abandonedcity2" then local a = math.random ( 1, 37 ) if a == 1 then GoTo( role, 282, 270, "abandonedcity2") return end if a==2 then GoTo( role, 363, 400, "abandonedcity2") return end if a==3 then GoTo( role, 255, 145, "abandonedcity2") return end if a==4 then GoTo( role, 73, 281, "abandonedcity2") return end if a==5 then GoTo( role, 21, 440, "abandonedcity2") return end if a==6 then GoTo( role, 379, 63, "abandonedcity2") return end end --ФС3 if map_name_role == "abandonedcity3" then local a = math.random ( 1, 6 ) if a == 1 then GoTo( role, 282, 270, "abandonedcity3") return end if a==2 then GoTo( role, 363, 400, "abandonedcity3") return end if a==3 then GoTo( role, 255, 145, "abandonedcity3") return end if a==4 then GoTo( role, 73, 281, "abandonedcity3") return end if a==5 then GoTo( role, 21, 440, "abandonedcity3") return end if a==6 then GoTo( role, 379, 63, "abandonedcity3") return end end --ДС if map_name_role == "darkswamp" then local a = math.random ( 1, 6 ) if a == 1 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 2 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 3 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 4 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 5 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 6 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 7 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 8 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 9 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 10 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 11 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 12 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 13 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 14 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 15 then GoTo( role, 2816, 3255, "darkswamp") return end if a == 16 then GoTo( role, 2816, 3255, "darkswamp") return end end if map_name_role == "eastgoaf" or map_name_role == "jialebi" then UseItemFailed ( role ) end end end else UseItemFailed ( role ) end end Quote Делай добро и бросай его в воду Share this post Link to post Share on other sites