Deltarune (Chapter 1) script viewer

← back to main script listing

gml_GlobalScript_scr_endturn

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

function
scr_endturn()
{ 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) instance_destroy(); with (obj_face) instance_destroy(); with (obj_smallface) 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();
} 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)
12
        instance_destroy();
13
    with (obj_face)
14
        instance_destroy();
15
    with (obj_smallface)
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
scr_attackphase

function
scr_attackphase()
{ with (obj_battlecontroller) { techwon = 0; if (
scr_monsterpop() == 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(xx + 2, yy + 365, obj_attackpress); } else { global.myfight = 4; instance_create(0, 0, obj_spellphase); } } else {
scr_wincombat();
} } }
();
35
    }
36
    else
37
    {
38
        global.charturn = 3;
39
        global.myfight = 3;
40
    }
41
}