#1 30-04-2009 18:22

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

GTA SA: New algorithm of railway traffic [REL]

Представляю вашему вниманию свой скрипт, который будет интересен любителям ж/д транспорта.
Скрипт отключает стандартный алгоритм движения поездов и активизирует новый.
Благодаря этому теперь:
-движение осуществляется по обоим путям, причем по каждому пути только в одну сторону
-поезда появляются намного чаще, они не возникают внезапно и вблизи игрока
-на карте составы обозначены маркерами
-есть возможность покататься на 19-вагонном поезде
Если вы установили (например, с помощью программы SATL 3) для какого-то типа поезда (кроме 7,13,15) количество вагонов равное 15, то при генерации поезда данного типа к нему будут подцеплены еще 4 вагона, той же модели, что и 15-й.
В комплект мода также входят файлы маршрутов поездов (tracks), являющиеся более точными, чем стандартные.

Примечание: остановка поезда на ст.Депо убрана, т.к. там небольшое расстояние между станциями.

Last edited by Den_spb (30-04-2009 20:50)

Offline

#2 30-04-2009 19:40

Seemann
Registered: 07-08-2006
Posts: 2,155

Re: GTA SA: New algorithm of railway traffic [REL]

Почему бы не выложить скрипт прямо тут (хотя бы в аттаче или запостить весь)?

Offline

#3 30-04-2009 20:52

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTA SA: New algorithm of railway traffic [REL]

Модификация выложена в аттаче (см. выше). А вот код скрипта:

{свободные переменные:   15@   26@   27@   28@   29@}
{$CLEO .cs}       //------------------------------------------начало скрипта-------------------------------------------------
    wait 0
    var
        20@ : Integer
        22@ : Integer
        23@ : Integer
        24@ : Integer
        25@ : Integer
    end
    18@ = 0
    19@ = 0
    16@ = 0
    17@ = 0
    30@ = 0
    31@ = 0
    {06D7: enable_train_traffic 0}
    wait 1000
:_0              // flag1 = 0
    wait 0
    {06D7: enable_train_traffic 0 }
    if
        18@ <> 0
    then
        jump @_1
    end
    18@ = 1
    0209: 16@ = random_int_in_ranges 15 46
    wait 0
    16@ *= 1000
    32@ = 0
:_1              // flag4 = 0
    wait 0
    if
        19@ <> 0
    then
        jump @_2
    end
    19@ = 1
    0209: 17@ = random_int_in_ranges 15 46
    wait 0
    17@ *= 1000
    33@ = 0
:_2              // flag 1 = 1
    wait 0
    if and
        18@ == 1
        001D:   32@ > 16@ // (int) 
    then
        18@ = 2
    end 
:_3              // flag 4 = 1
    wait 0
    if and
        19@ == 1
        001D:   33@ > 17@ // (int) 
    then
        19@ = 2
    end 
:_4               //flag1 = 2
    wait 0
    if
        18@ == 2
    jf @_5
    actor.StorePos($PLAYER_ACTOR,3@,4@,6@)
    if and
        3@ > 956.0
        4@ > 1281.0
        19@ > 2
    then
        jump @_5
    end
    21@ = 0    // flag kvadranta
    if
        3@ < 0.0
    then
        jump @Pol_34_1
    end
    if
        4@ >= 0.0
    then
        21@ = 1
    else
        21@ = 2
    end
    jump @Pol_1_det
    :Pol_34_1
        wait 0
            if
                4@ >= 0.0
            then
                21@ = 4
            else
                21@ = 3
            end
    :Pol_1_det
        wait 0
             // tracks ----------------------------------------------------------------
            if
                21@ == 1
            then
                jump @kvad_1t1
            end
            if
                21@ == 2
            then
                jump @kvad_2t1
            end
            if
                21@ == 3
            then
                jump @kvad_3t1
            end
            if
                21@ == 4
            then
                jump @kvad_4t1
            end
:kvad_1t1 //----------------------------------------------------------------------1----------------------------------------
wait 0
0@ = -598.09
1@ = 1188.22
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -325.94
1@ = 1248.88
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -35.79
1@ = 1293.15
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 241.37
1@ = 1229.34
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 536.14
1@ = 1247.17
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 739.12
1@ = 1461.33
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 742.99
1@ = 1697.59
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 742.51
1@ = 1787.34
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 740.75
1@ = 2026.49
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 726.84
1@ = 2321.07
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 801.16
1@ = 2609.48
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 1072.24
1@ = 2722.62
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 1236.12
1@ = 2632.27
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 1481.99
1@ = 2632.34
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 1774.87
1@ = 2675.03
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2021.92
1@ = 2694.18
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2229.69
1@ = 2690.17
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2519.59
1@ = 2639.43
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2552.81
1@ = 2344.89
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2735.05
1@ = 2111.73
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2781.06
1@ = 1816.16
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2856.25
1@ = 1531.03
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2864.77
1@ = 1239.22
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2764.76
1@ = 983.25
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2764.79
1@ = 743.27
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
    if
        21@ == 4
    then
        jump @_5
    end
:kvad_2t1  //------------------------------------------------2-----------------------------------------------------------------------
wait 0
0@ = 2765.28
1@ = 528.72
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2781.32
1@ = 239.50
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2827.61
1@ = 36.33
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2763.10
1@ = -250.25
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2467.57
1@ = -275.00
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2192.47                                                // point 1
1@ = -357.99
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2122.11                                                // point 2 
1@ = -647.61
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2284.98
1@ = -897.82
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2284.99
1@ = -1186.05
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2273.19
1@ = -1484.06
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 2198.65
1@ = -1760.34
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 1989.68
1@ = -1953.75
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 1696.98
1@ = -1953.73
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 1398.43
1@ = -1948.14
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 1197.64
1@ = -1779.76
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 1002.70
1@ = -1556.24
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 815.00
1@ = -1366.51
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 778.25
1@ = -1333.63
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
    if
        21@ == 1
    then
        jump @_5
    end
:kvad_3t1    //------------------------------------------------3--------------------------------------------------
wait 0
0@ = 589.52
1@ = -1187.75
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 335.44
1@ = -1061.40
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = 49.59
1@ = -1018.00
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -237.89
1@ = -1069.90
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -470.71
1@ = -1253.47
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -742.62
1@ = -1133.88
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -847.02
1@ = -1404.64
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1113.11
1@ = -1514.30
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1392.21
1@ = -1509.24
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1676.36
1@ = -1465.42
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1876.64
1@ = -1258.10
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1976.75
1@ = -995.47
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1978.81
1@ = -717.47
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
    if
        21@ == 2
    then
        jump @_5
    end
:kvad_4t1 //-------------------------------------------------------------4--------------------------------------------------------------------
wait 0
0@ = -1980.12
1@ = -592.06
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1960.09
1@ = -296.04
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1944.42
1@ = -11.95
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1942.72
1@ = 171.88
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1756.16
1@ = 399.26
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1523.12
1@ = 568.50
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1290.21
1@ = 737.81
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -1082.96
1@ = 888.28
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -992.44
1@ = 954.08
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
0@ = -760.64
1@ = 1122.39
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if
2@ > 600.0
jf @create1
    if
        21@ == 3
    then
        jump @_5
    end
jump @kvad_1t1

    :create1
        wait 0
        21@ = 0
        :rand_1
        wait 0
        0209: 21@ = random_int_in_ranges 0 16
        if and
        21@ <> 8
        21@ <> 9
        21@ <> 14
        jf @rand_1
        wait 0
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16
    11@ = 6.643 
        while &0(7@,1i) <> 0
            wait 0
            Model.Load(&0(7@,1i))
            11@ += 6.357
            7@ += 1 
        end
        038B: load_requested_models
    0087: 12@ = 11@ // (float) 
    12@ += 20.0
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16 
    :m1_1
        wait 0
        if &0(7@,1i) <> 0
        jf @m3_1
    :m2_1
        wait 0
        if
            Model.Available(&0(7@,1i))
        jf @m2_1
        7@ += 1
        jump @m1_1 
    :m3_1
        wait 0
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16
        7@ += 14
        if or
            &0(7@,1i) == 0
            21@ == 7
            21@ == 13
            21@ == 15
        then
            jump @m4_1
        end
        22@ = &0(7@,1i)   // 14 model
        7@ += 1
        &0(7@,1i) = 22@   // 15 changed to 14
        7@ += 1
        23@ = &0(7@,1i)   // 16 (1) model
        &0(7@,1i) = 22@
        7@ += 1
        20@ = &0(7@,1i)   // 17 model
        &0(7@,1i) = 22@
        7@ += 1
        24@ = &0(7@,1i)   // 18 model
        &0(7@,1i) = 22@
        7@ += 1
        25@ = &0(7@,1i)   // 19
        &0(7@,1i) = 0
    :m4_1
        wait 0
        if and  // point 1
        0@ == 2192.47                                                // point 1
        1@ == -357.99
        jf @point_2
        06D8: 8@ = create_train_at 0@ 1@ 60.0 type 21@ direction 1
        jump @train1_def
        :point_2
        wait 0
        if and  // point 2
        0@ == 2122.11                                                //  point 2 
        1@ == -647.61
        then
        06D8: 8@ = create_train_at 0@ 1@ 70.0 type 21@ direction 1
        else
        06D8: 8@ = create_train_at 0@ 1@ 0.0 type 21@ direction 1
        end
        :train1_def
        wait 0
        18@ = 3
        30@ = 1
        06DC: set_train 8@ acc 16.67
        06DD: set_train 8@ speed 16.67 
        5@ = Marker.CreateAboveCar(8@) 
        Marker.SetColor(5@, 0)
        018B: set_marker 5@ radar_mode 2
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16
        7@ += 14
        if and
            &0(7@,1i) <> 0
            21@ <> 7
            21@ <> 13
            21@ <> 15
        then
            7@ += 1                // 15
            &0(7@,1i) = 0
            7@ += 1                // 16
            &0(7@,1i) = 23@
            7@ += 1                // 17
            &0(7@,1i) = 20@
            7@ += 1                // 18
            &0(7@,1i) = 24@
            7@ += 1                // 19
            &0(7@,1i) = 25@
        end
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16
        while &0(7@,1i) <> 0
            wait 0
            Model.Destroy(&0(7@,1i))
            7@ += 1 
        end
:_5               //flag4 = 2
    wait 0
    if
        19@ == 2
    jf @_6
    actor.StorePos($PLAYER_ACTOR,3@,4@,6@)
    if and
        3@ > 956.0
        4@ > 1281.0
    then
        jump @_6
    end
    21@ = 0    // flag kvadranta
    if
        3@ < 0.0
    then
        jump @Pol_34_4
    end
    if
        4@ >= 0.0
    then
        21@ = 1
    else
        21@ = 2
    end
    jump @Pol_4_det
    :Pol_34_4
        wait 0
            if
                4@ >= 0.0
            then
                21@ = 4
            else
                21@ = 3
            end
    :Pol_4_det
        wait 0
             // tracks ----------------------------------------------------------------
            if
                21@ == 1
            then
                jump @kvad_1t4
            end
            if
                21@ == 2
            then
                jump @kvad_2t4
            end
            if
                21@ == 3
            then
                jump @kvad_3t4
            end
            if
                21@ == 4
            then
                jump @kvad_4t4
            end
:kvad_4t4    //-----------------------------------------------------4---------------------------------------------------
wait 0
0@ = 515.98
1@ = 1240.23
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 226.84
1@ = 1238.51
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -53.40
1@ = 1296.12
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -347.38
1@ = 1247.21
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -631.83
1@ = 1185.07
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -880.27
1@ = 1040.72
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1030.44
1@ = 931.37
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1240.99
1@ = 778.43
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1342.19
1@ = 704.87
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
    if
        21@ == 1
    then
        jump @_6
    end
:kvad_3t4    //-----------------------------------------------------3---------------------------------------------------
wait 0
0@ = -1498.99
1@ = 590.90
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1601.06
1@ = 516.83
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1837.42
1@ = 347.58
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1948.42
1@ = 100.00
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1950.42
1@ = -190.28
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1982.39
1@ = -488.08
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1982.55
1@ = -768.10
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1971.89
1@ = -1059.67
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1846.91
1@ = -1309.37
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1629.08
1@ = -1486.73
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1347.52
1@ = -1513.87
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -1053.53
1@ = -1508.42
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -835.57
1@ = -1370.31
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -718.41
1@ = -1128.25
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
    if
        21@ == 4
    then
        jump @_6
    end
:kvad_2t4    //-----------------------------------------------------2---------------------------------------------------
wait 0
0@ = -596.65
1@ = -1164.91
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -349.44
1@ = -1223.16
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = -137.48
1@ = -1027.47
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 151.78
1@ = -1026.41
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 438.87
1@ = -1107.08
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 690.56
1@ = -1266.07
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 910.87
1@ = -1464.63
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 1097.41
1@ = -1669.80
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 1293.72
1@ = -1894.03
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 1573.67
1@ = -1957.68
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 1857.49
1@ = -1957.93
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2152.76
1@ = -1957.85
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2205.95
1@ = -1686.16
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2288.74
1@ = -1407.02
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2288.95
1@ = -1110.09
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2281.21
1@ = -816.01
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2078.88
1@ = -607.04
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
    if
        21@ == 3
    then
        jump @_6
    end
:kvad_1t4    //-----------------------------------------------------1---------------------------------------------------
wait 0
0@ = 2062.91
1@ = -593.55
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2087.84
1@ = -365.31
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2367.59
1@ = -284.31
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2661.26
1@ = -298.92
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2832.24
1@ = -92.44
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2805.30
1@ = 182.18
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2769.17
1@ = 442.68
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2768.74
1@ = 701.56
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2768.72
1@ = 983.27
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2868.74
1@ = 1239.21
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2860.00
1@ = 1532.27
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2785.01
1@ = 1782.76
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2765.17
1@ = 2066.97
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2563.53
1@ = 2264.64
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2551.77
1@ = 2560.03
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2342.07
1@ = 2694.16
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 2092.40
1@ = 2694.22
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 1797.40
1@ = 2682.39
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 1510.13
1@ = 2636.25
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 1212.03
1@ = 2637.34
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 957.59
1@ = 2762.66
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 768.57
1@ = 2550.89
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 725.39
1@ = 2288.51
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 736.95
1@ = 2009.09
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 738.76
1@ = 1746.69
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 735.12
1@ = 1461.95
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
0@ = 616.45
1@ = 1297.93
0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@
if 2@ > 600.0
jf @create4
    if
        21@ == 2
    then
        jump @_6
    end
jump @kvad_4t4

    :create4
        wait 0
        21@ = 0
        :rand_4
        wait 0
        0209: 21@ = random_int_in_ranges 0 16
        if and
        21@ <> 8
        21@ <> 9
        21@ <> 14
        jf @rand_4
        wait 0
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16
    13@ = 6.643 
        while &0(7@,1i) <> 0
            wait 0
            Model.Load(&0(7@,1i))
            13@ += 6.357
            7@ += 1 
        end
        038B: load_requested_models
    0087: 14@ = 13@ // (float) 
    14@ += 20.0
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16 
    :m1_4
        wait 0
        if &0(7@,1i) <> 0
        jf @m3_4
    :m2_4
        wait 0
        if
            Model.Available(&0(7@,1i))
        jf @m2_4
        7@ += 1
        jump @m1_4 
    :m3_4
        wait 0
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16
        7@ += 14
        if or
            &0(7@,1i) == 0
            21@ == 7
            21@ == 13
            21@ == 15
        then
            jump @m4_4
        end
        22@ = &0(7@,1i)   // 14 model
        7@ += 1
        &0(7@,1i) = 22@   // 15 changed to 14
        7@ += 1
        23@ = &0(7@,1i)   // 16 (1) model
        &0(7@,1i) = 22@
        7@ += 1
        20@ = &0(7@,1i)   // 17 model
        &0(7@,1i) = 22@
        7@ += 1
        24@ = &0(7@,1i)   // 18 model
        &0(7@,1i) = 22@
        7@ += 1
        25@ = &0(7@,1i)   // 19
        &0(7@,1i) = 0
    :m4_4
        wait 0
        06D8: 9@ = create_train_at 0@ 1@ 0.0 type 21@ direction 1
        19@ = 3
        31@ = 1
        06DC: set_train 9@ acc 16.67
        06DD: set_train 9@ speed 16.67 
        10@ = Marker.CreateAboveCar(9@) 
        Marker.SetColor(10@, 1)
        018B: set_marker 10@ radar_mode 2
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16
        7@ += 14
        if and
            &0(7@,1i) <> 0
            21@ <> 7
            21@ <> 13
            21@ <> 15
        then
            7@ += 1                // 15
            &0(7@,1i) = 0
            7@ += 1                // 16
            &0(7@,1i) = 23@
            7@ += 1                // 17
            &0(7@,1i) = 20@
            7@ += 1                // 18
            &0(7@,1i) = 24@
            7@ += 1                // 19
            &0(7@,1i) = 25@
        end
        7@ = -382234
        21@ *= 16
        005A: 7@ += 21@ // (int) 
        0016: 21@ /= 16
        while &0(7@,1i) <> 0
            wait 0
            Model.Destroy(&0(7@,1i))
            7@ += 1 
        end
:_6    //-----------------------------------------train 1-----------------------------------------------------
    wait 0
    if and
        18@ == 3
        30@ == 1
    jf @_7
    car.StorePos(8@,3@,4@,6@)
        0509: 2@ = distance_between_XY 1474.9031 2634.6375 and_XY 3@ 4@     // rewrite
    if and
        0025:   12@ > 2@ // (float) 
        0025:   2@ > 11@ // (float)
        3@ < 1474.9031                                          // rewrite
    then
        06DD: set_train 8@ speed 0.0
        18@ = 4
        jump @_7
    end 
    0509: 2@ = distance_between_XY 2866.8667 1246.4919 and_XY 3@ 4@     // rewrite
    if and
        0025:   12@ > 2@ // (float) 
        0025:   2@ > 11@ // (float)
        4@ > 1246.4919                                          // rewrite
    then
        06DD: set_train 8@ speed 0.0
        18@ = 4
        jump @_7
    end 
    0509: 2@ = distance_between_XY 1696.873 -1955.7689 and_XY 3@ 4@     // rewrite
    if and
        0025:   12@ > 2@ // (float) 
        0025:   2@ > 11@ // (float)
        3@ > 1696.873                                          // rewrite
    then
        06DD: set_train 8@ speed 0.0
        18@ = 4
        jump @_7
    end 
    0509: 2@ = distance_between_XY 784.326 -1341.736 and_XY 3@ 4@     // rewrite
    if and
        0025:   12@ > 2@ // (float) 
        0025:   2@ > 11@ // (float)
        3@ > 784.326                                          // rewrite
    then
        06DD: set_train 8@ speed 0.0
        18@ = 4
        jump @_7
    end 
    0509: 2@ = distance_between_XY -1943.7788 183.2991 and_XY 3@ 4@     // rewrite
    if and
        0025:   12@ > 2@ // (float) 
        0025:   2@ > 11@ // (float)
        4@ < 183.2991                                          // rewrite
    then
        06DD: set_train 8@ speed 0.0
        18@ = 4
    end
:_7   //-------------------------------------------------------train 4--------------------------------------------
    wait 0
    if and
        19@ == 3
        31@ == 1
    jf @_8
    car.StorePos(9@,3@,4@,6@)
        0509: 2@ = distance_between_XY 1392.7462 2634.2546 and_XY 3@ 4@     // rewrite
    if and
        0025:   14@ > 2@ // (float) 
        0025:   2@ > 13@ // (float)
        3@ > 1392.7462                                         // rewrite
    then
        06DD: set_train 9@ speed 0.0
        19@ = 4
        jump @_8
    end 
    0509: 2@ = distance_between_XY 2867.2666 1330.1616 and_XY 3@ 4@     // rewrite
    if and
        0025:   14@ > 2@ // (float) 
        0025:   2@ > 13@ // (float)
        4@ < 1330.1616                                          // rewrite
    then
        06DD: set_train 9@ speed 0.0
        19@ = 4
        jump @_8
    end 
    0509: 2@ = distance_between_XY 1778.1157 -1955.7063 and_XY 3@ 4@     // rewrite
    if and
        0025:   14@ > 2@ // (float) 
        0025:   2@ > 13@ // (float)
        3@ < 1778.1157                                          // rewrite
    then
        06DD: set_train 9@ speed 0.0
        19@ = 4
        jump @_8
    end 
    0509: 2@ = distance_between_XY 841.0762 -1393.855 and_XY 3@ 4@     // rewrite
    if and
        0025:   14@ > 2@ // (float) 
        0025:   2@ > 13@ // (float)
        3@ < 841.0762                                          // rewrite
    then
        06DD: set_train 9@ speed 0.0
        19@ = 4
        jump @_8
    end 
    0509: 2@ = distance_between_XY -1946.4993 81.0843 and_XY 3@ 4@     // rewrite
    if and
        0025:   14@ > 2@ // (float) 
        0025:   2@ > 13@ // (float)
        4@ > 81.0843                                          // rewrite
    then
        06DD: set_train 9@ speed 0.0
        19@ = 4
    end
:_8
    wait 0
    if
        18@ == 4
    jf @_9                              
    if and
        30@ == 1
        01C1:   car 8@ stopped 
    jf @_9
    18@ = 5
    0209: 16@ = random_int_in_ranges 15 21
    wait 0
    16@ *= 1000
    32@ = 0
:_9
    wait 0
    if
        19@ == 4
    jf @_10
    if and
        31@ == 1
        01C1:   car 9@ stopped 
    jf @_10
    19@ = 5
    0209: 17@ = random_int_in_ranges 15 21
    wait 0
    17@ *= 1000
    33@ = 0
:_10
    wait 0
    if
        18@ == 5
    jf @_11
    if and
        30@ == 1     
        001D:   32@ > 16@ // (int) 
    jf @_11
    18@ = 3
    06DD: set_train 8@ speed 16.67    
:_11
    wait 0
    if
            19@ == 5
    jf @destroy1                        
    if and
        31@ == 1    
        001D:   33@ > 17@ // (int) 
    jf @destroy1
    19@ = 3
    06DD: set_train 9@ speed 16.67  
:destroy1
    wait 0
    if
        18@ > 2
    jf @destroy4
    actor.StorePos($PLAYER_ACTOR,0@,1@,6@)
    car.StorePos(8@,3@,4@,6@)
    0509: 2@ = distance_between_XY 0@ 1@ and_XY 3@ 4@
    if
        2@ > 600.0
    jf @destroy4
    Marker.Disable(5@)
    07BD: destroy_train 8@
    07BE: remove_references_to_train 8@
    30@ = 0 
    18@ = 0
:destroy4
    wait 0
    if
        19@ > 2
    jf @enter1
    actor.StorePos($PLAYER_ACTOR,0@,1@,6@)
    car.StorePos(9@,3@,4@,6@)
    0509: 2@ = distance_between_XY 0@ 1@ and_XY 3@ 4@
    if
        2@ > 600.0
    jf @enter1
    Marker.Disable(10@)
    07BD: destroy_train 9@
    07BE: remove_references_to_train 9@
    31@ = 0 
    19@ = 0
:enter1
    wait 0
    if
        18@ > 2
    jf @enter4
    if and
        not actor.InCar($PLAYER_ACTOR,8@)
        0203:   actor $PLAYER_ACTOR near_car 8@ radius 8.0 8.0 flag 0 on_foot 
        00E1:   player 0 pressed_key 15
    then
        05CB: AS_actor $PLAYER_ACTOR enter_car 8@ as_driver 1 ms
    end
:enter4
    wait 0
    if
        19@ > 2
    jf @PUAV_OFF1
    if and
        not actor.InCar($PLAYER_ACTOR,9@)
        0203:   actor $PLAYER_ACTOR near_car 9@ radius 8.0 8.0 flag 0 on_foot 
        00E1:   player 0 pressed_key 15
    then
        05CB: AS_actor $PLAYER_ACTOR enter_car 9@ as_driver 1 ms
    end
:PUAV_OFF1
    wait 0
    if and
        18@ > 2
        30@ == 1
    jf @PUAV_OFF4
    if and
        actor.InCar($PLAYER_ACTOR,8@)
        09AE:   actor $PLAYER_ACTOR driving_train
    then
        30@ = 0
        06DD: set_train 8@ speed 0.0
    end 
:PUAV_OFF4
    wait 0
    if and
        19@ > 2
        31@ == 1
    jf @_0
    if and
        actor.InCar($PLAYER_ACTOR,9@)
        09AE:   actor $PLAYER_ACTOR driving_train
    then
        31@ = 0
        06DD: set_train 9@ speed 0.0
    end    
jump @_0

Last edited by Den_spb (30-04-2009 21:11)

Offline

#4 03-05-2009 09:15

mfisto
From: Russia Perm
Registered: 01-02-2008
Posts: 558
Website

Re: GTA SA: New algorithm of railway traffic [REL]

to Den_spb

Ты крут ман, for shure, for reeeeeaaal...


I know everything and nothing...

Offline

#5 03-05-2009 12:54

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTA SA: New algorithm of railway traffic [REL]

Благодарю. Это мой самый сложный скрипт.

Offline

#6 03-05-2009 15:40

Alien
Registered: 12-10-2008
Posts: 564

Re: GTA SA: New algorithm of railway traffic [REL]

фигасе сколько циферок:wow:. Код стал практически нечитабельным. Не проще было сделать какой-нибудь считыватель координат из текстового файла, чем писать данные прямо в код? Вроде здесь же на форуме Seemann находил и выкладывал  где-то внутреигровую функцию считывания координат из файла. Там еще 2 формата поддерживалось. И было написано "часть дебаггера". Кажется как-то так. Щас искать лень...

Offline

#7 03-05-2009 16:45

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTA SA: New algorithm of railway traffic [REL]

Да, согласен, код получился громоздким, но его написание особых сложностей у меня не вызвало. Те 2 больших куска кода, содержащие команды "0509: 2@ = distance_between_XY 3@ 4@ and_XY 0@ 1@" были написаны в автоматическом режиме с помощью Паскаль-программы.

Offline

#8 26-05-2009 08:45

BullDogHEMI427
From: Рязань
Registered: 02-04-2009
Posts: 54

Re: GTA SA: New algorithm of railway traffic [REL]

Кульный мод но конфликтует с Alexander'овским train-mod'ом: по обоим путям ездят старые двухвагонные составы


Also known as HemiG
It's cool to Hate. It's cool to be a bloody guitarist.
284487-39e63-35897154-h200.jpg

Offline

#9 26-05-2009 14:10

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: GTA SA: New algorithm of railway traffic [REL]

Количество вагонов в поездах и их модели можно менять с помощью программы SA Train Limiter или отдельного клео-скрипта.

Offline

Board footer

Powered by FluxBB