Deltarune (Chapter 3) script viewer

← back to main script listing

gml_GlobalScript_scr_mnendturn

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

function
scr_mnendturn()
{ if (global.char[0] == 2) sus = 0; if (global.char[1] == 2) sus = 1; if (global.char[2] == 2) sus = 2; techwon = 0; if (
scr_monsterpop() == 0)
techwon = 1; if (global.flag[39 dojo_abort?] == 1) techwon = 1; if (techwon == 1)
scr_wincombat();
if (techwon == 0) { with (obj_battlecontroller) { messagepriority = -1; attackpriority = -1; }
scr_battlecursor_memory_reset();
if (global.chapter == 3 && i_ex(obj_rouxls_ch3_enemy)) { global.bmenucoord[0][0] = 2; global.bmenucoord[0][1] = 2; global.bmenucoord[0][2] = 2; if (obj_battlecontroller.rouxlsgridenabled == true) obj_battlecontroller.rouxlsbuttoncount_y = 4; } if (global.chapter == 3) { with (obj_gameshow_battlemanager) turns++; } global.mnfight = 0; global.myfight = 0; global.bmenuno = 0; global.charturn = 0; skip = 0; for (i = 0; i < 3; i += 1) { global.hittarget[i] = 0; with (global.charinstance[i]) tu = 0; hptarget = global.char[i]; if (global.char[i] != 0 && global.hp[hptarget] <= 0) { if (global.chapter == 3 && i_ex(obj_knight_enemy)) { } else { healamt = ceil(global.maxhp[hptarget] / 8); dmgwr = instance_create(global.charinstance[i].x, (global.charinstance[i].y + global.charinstance[i].myheight) - 24, obj_dmgwriter); with (dmgwr) { delay = 1; type = 3; } dmgwr.damage =
scr_heal(i, healamt);
if (global.hp[hptarget] >= 1) { with (dmgwr) specialmessage = 4; } } } } if (global.charmove[0] == 0 || global.charauto[global.char[0]] == 1) global.charturn = 1; if (global.charturn == 1) { if (global.charmove[1] == 0 || global.charauto[global.char[1]] == 1) global.charturn = 2; } if (global.charturn == 2) { if (global.charmove[2] == 0 || global.charauto[global.char[2]] == 1) skip = 1; } for (i = 0; i < 3; i += 1) { global.acting[i] = 0; global.actingsingle[i] = 0; global.actingsimul[i] = 0; global.actingtarget[i] = 0; global.temptension[i] = global.tension; global.charspecial[i] = 0; global.targeted[i] = 0; global.charaction[i] = 0; global.faceaction[i] = 0; global.monsterattackname[i] = " "; } global.currentactingchar = 0; with (obj_monsterparent) { attacked = 0; talked = 0; acting = 0; ...
()
2
{
3
    if (global.char[0] == 2)
4
        sus = 0;
5
    if (global.char[1] == 2)
6
        sus = 1;
7
    if (global.char[2] == 2)
8
        sus = 2;
9
    techwon = 0;
10
    if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
11
        techwon = 1;
12
    if (global.flag[39 dojo_abort?] == 1)
13
        techwon = 1;
14
    if (techwon == 1)
15
        
scr_wincombat
scr_wincombat

function
scr_wincombat()
{ if (global.flag[60 dojo_next_encounter] == 0 || global.flag[36 dojo_failure] == 1) { global.myfight = 7; global.mnfight = -1; with (obj_battlecontroller) victory = 1; for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } } else { for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } global.encounterno = global.flag[60 dojo_next_encounter];
scr_encountersetup(global.encounterno);
global.flag[60 dojo_next_encounter] = 0; for (__j = 0; __j < 3; __j++) { if (global.monstertype[__j] != 0(None)) { _newmonster =
scr_monster_add(global.monstertype[__j], global.monsterinstancetype[__j]);
global.monsterinstance[_newmonster].x = camerax() + 800; global.monsterinstance[_newmonster].y = global.monstermakey[__j]; with (global.monsterinstance[_newmonster])
scr_move_to_point_over_time(global.monstermakex[myself], global.monstermakey[myself], 10);
} } global.myfight = 5; myfightreturntimer = 15; global.mnfight = -1; } }
();
16
    if (techwon == 0)
17
    {
18
        with (obj_battlecontroller)
19
        {
20
            messagepriority = -1;
21
            attackpriority = -1;
22
        }
23
        
scr_battlecursor_memory_reset
scr_battlecursor_memory_reset

function
scr_battlecursor_memory_reset()
{ if (global.flag[14 remember_battle_menu] == 0) { for (i = 0; i < 20; i += 1) { for (j = 0; j < 20; j += 1) global.bmenucoord[i][j] = 0; } } }
();
24
        if (global.chapter == 3 && i_ex(obj_rouxls_ch3_enemy))
25
        {
26
            global.bmenucoord[0][0] = 2;
27
            global.bmenucoord[0][1] = 2;
28
            global.bmenucoord[0][2] = 2;
29
            if (obj_battlecontroller.rouxlsgridenabled == true)
30
                obj_battlecontroller.rouxlsbuttoncount_y = 4;
31
        }
32
        if (global.chapter == 3)
33
        {
34
            with (obj_gameshow_battlemanager)
35
                turns++;
36
        }
37
        global.mnfight = 0;
38
        global.myfight = 0;
39
        global.bmenuno = 0;
40
        global.charturn = 0;
41
        skip = 0;
42
        for (i = 0; i < 3; i += 1)
43
        {
44
            global.hittarget[i] = 0;
45
            with (global.charinstance[i])
46
                tu = 0;
47
            hptarget = global.char[i];
48
            if (global.char[i] != 0 && global.hp[hptarget] <= 0)
49
            {
50
                if (global.chapter == 3 && i_ex(obj_knight_enemy))
51
                {
52
                }
53
                else
54
                {
55
                    healamt = ceil(global.maxhp[hptarget] / 8);
56
                    dmgwr = instance_create(global.charinstance[i].x, (global.charinstance[i].y + global.charinstance[i].myheight) - 24, obj_dmgwriter);
57
                    with (dmgwr)
58
                    {
59
                        delay = 1;
60
                        type = 3;
61
                    }
62
                    dmgwr.damage = 
scr_heal
scr_heal

function
scr_heal(arg0, arg1)
{ abovemaxhp = 0; belowzero = 0; hltarget = global.char[arg0]; _curhp = global.hp[hltarget]; if (global.hp[hltarget] <= 0) belowzero = 1; if (global.hp[hltarget] > global.maxhp[hltarget]) abovemaxhp = 1; if (abovemaxhp == 0) { global.hp[hltarget] += arg1; if (global.hp[hltarget] > global.maxhp[hltarget]) global.hp[hltarget] = global.maxhp[hltarget]; } if (belowzero == 1 && global.hp[hltarget] >= 0) { if (global.hp[hltarget] < ceil(global.maxhp[hltarget] / 6)) global.hp[hltarget] = ceil(global.maxhp[hltarget] / 6);
scr_revive(arg0);
} snd_stop(snd_power); snd_play(snd_power); return global.hp[hltarget] - _curhp; }
(i, healamt);
63
                    if (global.hp[hptarget] >= 1)
64
                    {
65
                        with (dmgwr)
66
                            specialmessage = 4;
67
                    }
68
                }
69
            }
70
        }
71
        if (global.charmove[0] == 0 || global.charauto[global.char[0]] == 1)
72
            global.charturn = 1;
73
        if (global.charturn == 1)
74
        {
75
            if (global.charmove[1] == 0 || global.charauto[global.char[1]] == 1)
76
                global.charturn = 2;
77
        }
78
        if (global.charturn == 2)
79
        {
80
            if (global.charmove[2] == 0 || global.charauto[global.char[2]] == 1)
81
                skip = 1;
82
        }
83
        for (i = 0; i < 3; i += 1)
84
        {
85
            global.acting[i] = 0;
86
            global.actingsingle[i] = 0;
87
            global.actingsimul[i] = 0;
88
            global.actingtarget[i] = 0;
89
            global.temptension[i] = global.tension;
90
            global.charspecial[i] = 0;
91
            global.targeted[i] = 0;
92
            global.charaction[i] = 0;
93
            global.faceaction[i] = 0;
94
            global.monsterattackname[i] = " ";
95
        }
96
        global.currentactingchar = 0;
97
        with (obj_monsterparent)
98
        {
99
            attacked = 0;
100
            talked = 0;
101
            acting = 0;
102
            actingsus = 0;
103
            actingral = 0;
104
            actingnoe = 0;
105
        }
106
        if (skip == 1)
107
        {
108
            if (global.char[0] == 2 && global.charauto[2] == 1)
109
            {
110
                global.acting[0] = 1;
111
                global.myfight = 3;
112
            }
113
            
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(); if (global.chapter == 3 && i_ex(obj_tennabattleconvo_controller) && (obj_tennabattleconvo_controller.chattedduringbulletphase == true || obj_tennabattleconvo_controller.introcon < 3)) { } else { with (obj_face) instance_destroy(); } with (obj_smallface) instance_destroy(); if (global.chapter == 3) idefendedthisturn = 0; 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 (__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; } }
();
114
        }
115
        for (i = 0; i < 12; i += 1)
116
        {
117
            for (j = 0; j < 3; j += 1)
118
                tempitem[i][j] = global.item[i];
119
        }
120
    }
121
}