Deltarune (Chapter 4) 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()
{ if (!i_ex(obj_hammer_of_justice_enemy)) { 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) { global.monsterattackname[i] = " "; 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; } __noactors = 1; if (global.acting[0] == 1) __noactors = 0; for (__noactorsi = 0; __noactorsi < 3; __noactorsi++) { if (global.actingsingle[__noactorsi] == 1) __noactors = 0; } if (soundbattle) { if (i_ex(obj_sound_of_justice_enemy)) { if (global.charaction[0] == 1) obj_sound_of_justice_enemy.kris_phase2_try_attack_con = 1; if (global.charaction[1] == 4) { } else { if (global.charaction[1] == 1) obj_sound_of_justice_enemy.susie_phase2_try_attack_con = 1; global.charaction[1] = 0; global.faceaction[1] = 0; } } } if (__noactors == 1) {
scr_attackphase();
} else { global.charturn = 3; global.myfight = 3; global.currentactingchar = 0; if (global.acting[0] == 0)
scr_nextact();
if (global.acting[0] == 1 && global.actingsimul[0] == 1)
scr_act_simul();
} with (obj_battlecontroller) { messagepriority = -1; attackpriority = -1; } }
()
2
{
3
    if (!i_ex(obj_hammer_of_justice_enemy))
4
    {
5
        for (i = 0; i < 12; i += 1)
6
            global.item[i] = tempitem[i][global.charturn];
7
    }
8
    for (i = 0; i < 12; i += 1)
9
    {
10
        for (j = 0; j < 3; j += 1)
11
            tempitem[i][j] = global.item[i];
12
    }
13
    moveswapped = 0;
14
    with (obj_writer)
15
        instance_destroy();
16
    with (obj_face)
17
        instance_destroy();
18
    with (obj_smallface)
19
        instance_destroy();
20
    global.attacking = 0;
21
    for (i = 0; i < 3; i += 1)
22
    {
23
        global.monsterattackname[i] = " ";
24
        if (global.charauto[global.char[i]] == 1 && global.hp[global.char[i]] > 0)
25
        {
26
            if (global.monster[2] == 1)
27
                global.chartarget[i] = 2;
28
            if (global.monster[1] == 1)
29
                global.chartarget[i] = 1;
30
            if (global.monster[0] == 1)
31
                global.chartarget[i] = 0;
32
        }
33
        if (global.charaction[i] == 1)
34
            global.attacking = 1;
35
    }
36
    __noactors = 1;
37
    if (global.acting[0] == 1)
38
        __noactors = 0;
39
    for (__noactorsi = 0; __noactorsi < 3; __noactorsi++)
40
    {
41
        if (global.actingsingle[__noactorsi] == 1)
42
            __noactors = 0;
43
    }
44
    if (soundbattle)
45
    {
46
        if (i_ex(obj_sound_of_justice_enemy))
47
        {
48
            if (global.charaction[0] == 1)
49
                obj_sound_of_justice_enemy.kris_phase2_try_attack_con = 1;
50
            if (global.charaction[1] == 4)
51
            {
52
            }
53
            else
54
            {
55
                if (global.charaction[1] == 1)
56
                    obj_sound_of_justice_enemy.susie_phase2_try_attack_con = 1;
57
                global.charaction[1] = 0;
58
                global.faceaction[1] = 0;
59
            }
60
        }
61
    }
62
    if (__noactors == 1)
63
    {
64
        
scr_attackphase
scr_attackphase

function
scr_attackphase()
{ with (obj_battlecontroller) { techwon = 0; if (
scr_monsterpop() == 0)
techwon = 1; if (techwon == 1)
scr_wincombat();
if (techwon == 0) { for (__hiti = 0; __hiti < 3; __hiti++) global.hittarget[__hiti] = 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 (i_ex(obj_sound_of_justice_enemy) && obj_sound_of_justice_enemy.phase == 2) { if (global.charaction[0] == 1 && global.charaction[1] != 1) { if (obj_sound_of_justice_enemy.krisattackcount > 0) { global.myfight = -1; global.mnfight = 1; exit; } } if (global.charaction[0] == 1 && global.charaction[1] == 1) { if (obj_sound_of_justice_enemy.krisattackcount > 1) { global.myfight = -1; global.mnfight = 1; exit; } global.charaction[1] = 0; } if (global.charaction[0] != 1 && global.charaction[1] == 1) { global.myfight = -1; global.mnfight = 1; exit; } } if (fightphase == 1) { global.myfight = 1; instance_create(xx + 2, yy + 365, obj_attackpress); } else { global.myfight = 4; instance_create(0, 0, obj_spellphase); } } } }
();
65
    }
66
    else
67
    {
68
        global.charturn = 3;
69
        global.myfight = 3;
70
        global.currentactingchar = 0;
71
        if (global.acting[0] == 0)
72
            
scr_nextact
scr_nextact

function
scr_nextact()
{ global.acting[0] = 0; global.acting[1] = 0; global.acting[2] = 0; global.actingsingle[global.currentactingchar] = 0; __minstance = global.monsterinstance[global.actingtarget[global.currentactingchar]]; with (__minstance) { acting = 0; actcon = 0; actconsus = 0; actconral = 0; actconnoe = 0; } var singleactcomplete = 0; while (global.currentactingchar < 3) { global.currentactingchar++; if (global.currentactingchar < 3) { if (global.actingsingle[global.currentactingchar] == 1) { __minstance = global.monsterinstance[global.actingtarget[global.currentactingchar]]; if (global.char[global.currentactingchar] == 2) { with (__minstance) actconsus = 1; if (global.actingsimul[global.currentactingchar] == 0) singleactcomplete = 1; break; } if (global.char[global.currentactingchar] == 3) { with (__minstance) actconral = 1; if (global.actingsimul[global.currentactingchar] == 0) singleactcomplete = 1; break; } if (global.char[global.currentactingchar] == 4) { with (__minstance) actconnoe = 1; if (global.actingsimul[global.currentactingchar] == 0) singleactcomplete = 1; break; } } } } if (i_ex(obj_sound_of_justice_enemy) && obj_sound_of_justice_enemy.phase == 1) { global.charturn = 3; global.myfight = 3; global.currentactingchar = 0; if (global.acting[0] == 0)
scr_nextact();
if (global.acting[0] == 1 && global.actingsimul[0] == 1)
scr_act_simul();
exit; } if (global.currentactingchar >= 3) { with (obj_monsterparent) { acting = 0; actingsus = 0; actingral = 0; actingnoe = 0; } global.currentactingchar = 0;
scr_attackphase();
} else if (!singleactcomplete) {
scr_act_simul();
} }
();
73
        if (global.acting[0] == 1 && global.actingsimul[0] == 1)
74
            
scr_act_simul
scr_act_simul

function
scr_act_simul()
{ __simulcount = 0; for (__ii = global.currentactingchar; __ii < 3; __ii++) { __foundsimul = 0; if (global.actingsingle[__ii] == 1 && instance_exists(obj_monsterparent)) { if (global.char[__ii] == 1 && global.actsimul[global.actingtarget[__ii]][global.actingchoice[__ii]] == 1) { obj_monsterparent.simulorderkri = __simulcount; with (global.monsterinstance[global.actingtarget[__ii]]) actcon = 0; __foundsimul = 1; } if (global.char[__ii] == 2 && global.actsimulsus[global.actingtarget[__ii]][global.actingchoice[__ii]] == 1) { obj_monsterparent.simulordersus = __simulcount; with (global.monsterinstance[global.actingtarget[__ii]]) actconsus = 1; __foundsimul = 1; } if (global.char[__ii] == 3 && global.actsimulral[global.actingtarget[__ii]][global.actingchoice[__ii]] == 1) { obj_monsterparent.simulorderral = __simulcount; with (global.monsterinstance[global.actingtarget[__ii]]) actconral = 1; __foundsimul = 1; } if (global.char[__ii] == 4 && global.actsimulnoe[global.actingtarget[__ii]][global.actingchoice[__ii]] == 1) { obj_monsterparent.simulordernoe = __simulcount; with (global.monsterinstance[global.actingtarget[__ii]]) actconnoe = 1; __foundsimul = 1; } if (__foundsimul) { global.actingsingle[__ii] = 0; __simulcount++; } obj_monsterparent.simultotal = __simulcount; } } }
();
75
    }
76
    with (obj_battlecontroller)
77
    {
78
        messagepriority = -1;
79
        attackpriority = -1;
80
    }
81
}