Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_battlecontroller_Create_0

(view raw script w/o annotations or w/e)
1
if (global.flag[9 battle_music] == 1)
2
{
3
    var battlemusicvolume = 0.7;
4
    if (i_ex(obj_astream))
5
    {
6
        if (obj_astream.mystream == global.batmusic[0])
7
        {
8
            if (obj_astream.songname != "battle.ogg")
9
                battlemusicvolume = 1;
10
        }
11
    }
12
    
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
(string(battlemusicvolume));
13
    global.batmusic[1] = mus_loop_ext(global.batmusic[0], battlemusicvolume, 1);
14
}
15
victory = 0;
16
victoried = 0;
17
skipvictory = 0;
18
global.battleend = 0;
19
battlewriter = 19212912;
20
myface = 1913918291;
21
lbuffer = 0;
22
rbuffer = 0;
23
onebuffer = 0;
24
twobuffer = 0;
25
myfightreturntimer = 1;
26
messagepriority = -1;
27
attackpriority = -1;
28
hidemercy = 0;
29
cantspare[2] = 0;
30
shareitemcon = 0;
31
hidebattleui = 0;
32
global.darkzone = 1;
33
global.fighting = 1;
34
if (global.encounterno == 73)
35
{
36
    global.fc = 3;
37
    global.fe = 4;
38
    global.flag[62 nonnarrative_intro_text] = 1;
39
}
40
if (global.flag[62 nonnarrative_intro_text] == 0)
41
{
42
    global.fe = 0;
43
    global.fc = 0;
44
    global.typer = 4;
45
    global.battletyper = 4;
46
}
47
global.flag[62 nonnarrative_intro_text] = 0;
48
global.myfight = 0;
49
global.mnfight = 0;
50
global.bmenuno = 0;
51
global.attacking = 0;
52
global.acting = 0;
53
global.tension = 0;
54
global.spelldelay = 10;
55
global.turntimer = 120;
56
scr_spellinfo_all
scr_spellinfo_all

function
scr_spellinfo_all()
{ for (j = 0; j < 6; j += 1) { for (i = 0; i < 12; i += 1) { spellid = global.spell[j][i];
scr_spellinfo(spellid);
global.spellname[j][i] = spellname; global.spellnameb[j][i] = spellnameb; global.spelldescb[j][i] = spelldescb; global.spelldesc[j][i] = spelldesc; global.spellcost[j][i] = cost; global.spellusable[j][i] = spellusable; global.spelltarget[j][i] = spelltarget; } } }
();
57
global.tensionselect = 0;
58
for (j = 0; j < 3; j += 1)
59
{
60
    global.temptension[j] = global.tension;
61
    for (i = 0; i < 13; i += 1)
62
        tempitem[i][j] = global.item[i];
63
}
64
for (i = 0; i < 3; i += 1)
65
{
66
    global.charcond[i] = 0;
67
    global.automiss[i] = 0;
68
    if (global.char[i] != 0)
69
    {
70
        global.charmove[i] = 1;
71
        global.charcantarget[i] = 1;
72
        global.chardead[i] = 0;
73
    }
74
    else
75
    {
76
        global.charmove[i] = 0;
77
        global.charcantarget[i] = 0;
78
    }
79
}
80
itempage = 0;
81
spellpage = 0;
82
global.flag[50 last_encounter_end] = 0;
83
global.flag[51 last_monster_end_0] = 0;
84
global.flag[52 last_monster_end_1] = 0;
85
global.flag[53 last_monster_end_2] = 0;
86
global.flag[63 violenced_last] = 0;
87
for (i = 0; i < 3; i += 1)
88
    
scr_monster_statreset
scr_monster_statreset

function
scr_monster_statreset(arg0)
{ global.monster[arg0] = 0; global.monsterx[arg0] = 0; global.monstery[arg0] = 0; global.monstername[arg0] = stringsetloc(
" ", "scr_monster_statreset_slash_scr_monster_statreset_gml_5_0"
);
global.monsterat[arg0] = 0; global.monsterdf[arg0] = 0; global.monsterhp[arg0] = 0; global.monstermaxhp[arg0] = 0; global.monsterinstance[arg0] = 12913921839; global.monstergold[arg0] = 0; global.monsterexp[arg0] = 0; global.sparepoint[arg0] = 0; global.hittarget[arg0] = 0; global.mercymod[arg0] = 0; global.mercymax[arg0] = 0; global.monstercomment[arg0] = " "; global.monsterattackname[arg0] = " "; global.monsterstatus[arg0] = 0;
scr_monster_actreset(arg0);
}
(i);
89
for (i = 0; i < 3; i += 1)
90
{
91
    if (global.monstertype[i] > 0)
92
        
scr_monster_makeinstance
scr_monster_makeinstance

function
scr_monster_makeinstance(arg0)
{ global.monster[arg0] = 1; with (global.monsterinstance[arg0]) instance_destroy(); global.monsterinstance[arg0] = instance_create(global.monstermakex[arg0], global.monstermakey[arg0], global.monsterinstancetype[arg0]); global.monsterinstance[arg0].myself = arg0; with (global.monsterinstance[arg0]) event_user(12); with (global.monsterinstance[arg0]) event_user(15); }
(i);
93
}
94
global.monstergold[3] = 0;
95
global.monsterexp[3] = 0;
96
global.charturn = 0;
97
global.currentactingchar = 0;
98
for (i = 0; i < 3; i += 1)
99
{
100
    global.acting[i] = 0;
101
    global.actingsingle[i] = 0;
102
    global.actingsimul[i] = 0;
103
    global.actingtarget[i] = 0;
104
    global.actingchoice[i] = 0;
105
    global.charaction[i] = 0;
106
    global.charspecial[i] = 0;
107
    global.chartarget[i] = 0;
108
    global.faceaction[i] = 0;
109
    global.rembmenuno[i] = 0;
110
    global.targeted[i] = 0;
111
    var _at = 0;
112
    var _df = 0;
113
    var _mag = 0;
114
    if (i == 2 && global.charweapon[3] == 35)
115
    {
116
        _at = 12;
117
        _df = 3;
118
        _mag = 3;
119
    }
120
    global.battleat[i] = global.at[global.char[i]] + global.itemat[global.char[i]][0] + global.itemat[global.char[i]][1] + global.itemat[global.char[i]][2] + _at;
121
    global.battledf[i] = global.df[global.char[i]] + global.itemdf[global.char[i]][0] + global.itemdf[global.char[i]][1] + global.itemdf[global.char[i]][2] + _df;
122
    global.battlemag[i] = global.mag[global.char[i]] + global.itemmag[global.char[i]][0] + global.itemmag[global.char[i]][1] + global.itemmag[global.char[i]][2] + _mag;
123
    global.battleactcount[i] = 0;
124
    global.monsterattackname[i] = " ";
125
    for (j = 0; j < 18; j++)
126
    {
127
        global.battlespell[i][j] = 0;
128
        global.battlespellname[i][j] = " ";
129
        global.battlespelldesc[i][j] = " ";
130
        global.battlespellcost[i][j] = 0;
131
        global.battlespelltarget[i][j] = 2;
132
        global.battlespellspecial[i][j] = 0;
133
    }
134
}
135
scr_spellmenu_setup
scr_spellmenu_setup

function
scr_spellmenu_setup()
{ var __actnamecheck = 0; var __monstertype = global.monstertype[0]; for (__i = 1; __i < 3; __i++) { if (global.monster[__i] == 1 && global.monstertype[__i] != __monstertype) { if (global.encounterno != 222) __actnamecheck = 1; } } for (__i = 0; __i < 3; __i++) { for (__fj = 0; __fj < 6; __fj++) { global.battlespell[__i][__fj] = 0; if (global.char[__i] == 1) { if (global.canact[0][__fj] == 1) { global.battlespell[__i][__fj] = -1; if (global.battleactcount[__i] < (__fj + 1)) global.battleactcount[__i] = __fj + 1; global.battlespellcost[__i][__fj] = global.actcost[0][__fj]; global.battlespellname[__i][__fj] = global.actname[0][__fj]; global.battlespelldesc[__i][__fj] = global.actdesc[0][__fj]; global.battlespelltarget[__i][__fj] = 0; global.battlespellspecial[__i][__fj] = 1; } } if (global.char[__i] == 2) { if (global.canactsus[0][__fj] == 1) { global.battlespell[__i][__fj] = -1; if (global.battleactcount[__i] < (__fj + 1)) global.battleactcount[__i] = __fj + 1; global.battlespellcost[__i][__fj] = global.actcostsus[0][__fj]; global.battlespellname[__i][__fj] = global.actnamesus[0][__fj]; if (__actnamecheck) global.battlespellname[__i][__fj] = stringsetloc(
S-Action
"S-Action", "scr_monstersetup_slash_scr_monstersetup_gml_1053_0"
);
global.battlespelldesc[__i][__fj] = global.actdescsus[0][__fj]; global.battlespelltarget[__i][__fj] = 2; global.battlespellspecial[__i][__fj] = 2; } } if (global.char[__i] == 3) { if (global.canactral[0][__fj] == 1) { global.battlespell[__i][__fj] = -1; if (global.battleactcount[__i] < (__fj + 1)) global.battleactcount[__i] = __fj + 1; global.battlespellcost[__i][__fj] = global.actcostral[0][__fj]; global.battlespellname[__i][__fj] = global.actnameral[0][__fj]; if (__actnamecheck) global.battlespellname[__i][__fj] = stringsetloc(
R-Action
"R-Action", "scr_monstersetup_slash_scr_monstersetup_gml_1057_0"
);
global.battlespelldesc[__i][__fj] = global.actdescral[0][__fj]; global.battlespelltarget[__i][__fj] = 2; global.battlespellspecial[__i][__fj] = 3; } } if (global.char[__i] == 4) { if (global.canactnoe[0][__fj] == 1) { global.battlespell[__i][__fj] = -1; if (global.battleactcount[__i] < (__fj + 1)) global.battleactcount[__i] = __fj + 1; global.battlespellcost[__i][__fj] = global.actcostnoe[0][__fj]; global.battlespellname[__i][__fj] = global.actnamenoe[0][__fj]; if (__actnamecheck) global.battlespellname[__i][__fj] = stringsetloc(
N-Action
"N-Action", "scr_monstersetup_slash_scr_monstersetup_gml_1061_0"
);
global.battlespelldesc[__i][__fj] = global.actdescnoe[0][__fj]; global.battlespelltarget[__i][__fj] = 2; global.battlespellspecial[__i][__fj] = 4; } } } }
scr_spellinfo_all();
for (__i = 0; __i < 3; __i++) { for (__fj = 0; __fj < 12; __fj++) { __ib = global.battleactcount[__i] + __fj; global.battlespell[__i][__ib] = global.spell[global.char[__i]][__fj]; global.battlespellcost[__i][__ib] = global.spellcost[global.char[__i]][__fj]; global.battlespellname[__i][__ib] = global.spellnameb[global.char[__i]][__fj]; global.battlespelldesc[__i][__ib] = global.spelldescb[global.char[__i]][__fj]; global.battlespelltarget[__i][__ib] = global.spelltarget[global.char[__i]][__fj]; } } }
();
136
for (i = 0; i < 20; i += 1)
137
{
138
    for (j = 0; j < 20; j += 1)
139
        global.bmenucoord[i][j] = 0;
140
}
141
movenoise = 0;
142
selnoise = 0;
143
laznoise = 0;
144
damagenoise = 0;
145
grazenoise = 0;
146
bumpnoise = 0;
147
bcolor = merge_color(c_purple, c_black, 0.7);
148
bcolor = merge_color(bcolor, c_dkgray, 0.5);
149
tp = 0;
150
tpy = 50;
151
bp = 0;
152
bpy = 152;
153
intro = 1;
154
chartotal = 0;
155
charpos[0] = -1;
156
charpos[1] = -1;
157
charpos[2] = -1;
158
charpos[3] = -1;
159
havechar[0] = 0;
160
havechar[1] = 0;
161
havechar[2] = 0;
162
havechar[3] = 0;
163
global.charinstance[0] = 12129292;
164
global.charinstance[1] = 12129292;
165
global.charinstance[2] = 12129292;
166
with (global.charinstance[0])
167
    myself = 0;
168
with (global.charinstance[1])
169
    myself = 1;
170
with (global.charinstance[2])
171
    myself = 2;
172
global.ignoredefense = false;
173
mmy[0] = 0;
174
mmy[1] = 0;
175
mmy[2] = 0;
176
mmy[3] = 0;
177
for (i = 0; i < 3; i += 1)
178
{
179
    if (global.char[i] != 0)
180
        chartotal += 1;
181
    if (global.char[i] == 1)
182
    {
183
        havechar[0] = 1;
184
        charpos[0] = i;
185
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_herokris);
186
        global.charinstance[i].myself = i;
187
        global.charinstance[i].char = 1;
188
        global.charinstance[i].depth = 200 - (i * 20);
189
    }
190
    if (global.char[i] == 2)
191
    {
192
        havechar[1] = 1;
193
        charpos[1] = i;
194
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_herosusie);
195
        global.charinstance[i].myself = i;
196
        global.charinstance[i].char = 2;
197
        global.charinstance[i].depth = 200 - (i * 20);
198
    }
199
    if (global.char[i] == 3)
200
    {
201
        havechar[2] = 1;
202
        charpos[2] = i;
203
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_heroralsei);
204
        global.charinstance[i].myself = i;
205
        global.charinstance[i].char = 3;
206
        global.charinstance[i].depth = 200 - (i * 20);
207
    }
208
    if (global.char[i] == 4)
209
    {
210
        havechar[3] = 1;
211
        charpos[3] = i;
212
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_heronoelle);
213
        global.charinstance[i].myself = i;
214
        global.charinstance[i].char = 4;
215
        global.charinstance[i].depth = 200 - (i * 20);
216
    }
217
}
218
slmxx = 0;
219
slmyy = 0;
220
s_siner = 0;
221
t_siner = 0;
222
instance_create(0, 0, obj_tensionbar);
223
reset = 0;
224
timeron = 1;
225
noreturn = 0;
226
hpcolor[0] = c_aqua;
227
hpcolor[1] = c_fuchsia;
228
hpcolor[2] = c_lime;
229
hpcolor[3] = c_yellow;
230
for (i = 0; i < 4; i++)
231
    hpcolorsoft[i] = merge_color(hpcolor[i], c_white, 0.5);
232
global.flag[36 dojo_failure] = 0;
233
global.flag[39 dojo_abort?] = 0;
234
if (global.ambush == 1)
235
{
236
    
scr_ambush
scr_ambush

function
scr_ambush()
{ with (obj_writer) instance_destroy(); with (obj_face) instance_destroy(); global.charturn = 3; global.mnfight = 1; global.myfight = -1; with (obj_monsterparent) ambushed = 1; }
();
237
    global.ambush = 0;
238
}
239
if (global.ambush == 2)
240
{
241
    with (obj_monsterparent)
242
        firststrike = 1;
243
    global.tension = round(global.maxtension / 4);
244
    global.ambush = 0;
245
}
246
disablesusieralseiattack = false;
247
skipsusieturn = false;
248
skipralseiturn = false;