Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_endturn_ch1

(view raw script w/o annotations or w/e)
1
function scr_endturn_ch1
scr_endturn_ch1

function scr_endturn_ch1() { for (i = 0; i < 12; i += 1) global.item[i] = tempitem[i][global.charturn]; for (i = 0; i < 12; i += 1) { for (j = 0; j < 3; j += 1) tempitem[i][j] = global.item[i]; } moveswapped = 0; with (obj_writer_ch1) instance_destroy(); with (obj_face_ch1) instance_destroy(); with (obj_smallface_ch1) instance_destroy(); global.attacking = 0; for (i = 0; i < 3; i += 1) { if (global.charauto[global.char[i]] == 1 && global.hp[global.char[i]] > 0) { if (global.monster[2] == 1) global.chartarget[i] = 2; if (global.monster[1] == 1) global.chartarget[i] = 1; if (global.monster[0] == 1) global.chartarget[i] = 0; } if (global.charaction[i] == 1) global.attacking = 1; } if (global.acting[0] == 0) { scr_attackphase_ch1(); } else { global.charturn = 3; global.myfight = 3; } }
()
2
{
3
    for (i = 0; i < 12; i += 1)
4
        global.item[i] = tempitem[i][global.charturn];
5
    for (i = 0; i < 12; i += 1)
6
    {
7
        for (j = 0; j < 3; j += 1)
8
            tempitem[i][j] = global.item[i];
9
    }
10
    moveswapped = 0;
11
    with (obj_writer_ch1)
12
        instance_destroy();
13
    with (obj_face_ch1)
14
        instance_destroy();
15
    with (obj_smallface_ch1)
16
        instance_destroy();
17
    global.attacking = 0;
18
    for (i = 0; i < 3; i += 1)
19
    {
20
        if (global.charauto[global.char[i]] == 1 && global.hp[global.char[i]] > 0)
21
        {
22
            if (global.monster[2] == 1)
23
                global.chartarget[i] = 2;
24
            if (global.monster[1] == 1)
25
                global.chartarget[i] = 1;
26
            if (global.monster[0] == 1)
27
                global.chartarget[i] = 0;
28
        }
29
        if (global.charaction[i] == 1)
30
            global.attacking = 1;
31
    }
32
    if (global.acting[0] == 0)
33
    {
34
        scr_attackphase_ch1
scr_attackphase_ch1

function scr_attackphase_ch1() { with (obj_battlecontroller_ch1) { techwon = 0; if (scr_monsterpop_ch1() == 0) techwon = 1; if (techwon == 0) { fightphase = 1; global.charturn = 3; if (global.charaction[0] == 4 || global.charaction[0] == 2) fightphase = 0; if (global.charaction[1] == 4 || global.charaction[1] == 2) fightphase = 0; if (global.charaction[2] == 4 || global.charaction[2] == 2) fightphase = 0; if (global.myfight == 4) fightphase = 1; if (fightphase == 1) { global.myfight = 1; instance_create_ch1(xx + 2, yy + 365, obj_attackpress_ch1); } else { global.myfight = 4; instance_create_ch1(0, 0, obj_spellphase_ch1); } } else { scr_wincombat_ch1(); } } }
();
35
    }
36
    else
37
    {
38
        global.charturn = 3;
39
        global.myfight = 3;
40
    }
41
}