Deltarune (Chapter 2) 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
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ }
(obj_astream.songname);
12
    }
13
    
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ }
(string(battlemusicvolume));
14
    global.batmusic[1] = mus_loop_ext(global.batmusic[0], battlemusicvolume, 1);
15
}
16
victory = 0;
17
victoried = 0;
18
skipvictory = 0;
19
global.battleend = 0;
20
battlewriter = 19212912;
21
myface = 1913918291;
22
lbuffer = 0;
23
rbuffer = 0;
24
onebuffer = 0;
25
twobuffer = 0;
26
myfightreturntimer = 1;
27
messagepriority = -1;
28
attackpriority = -1;
29
hidemercy = 0;
30
cantspare[2] = 0;
31
global.darkzone = 1;
32
global.fighting = 1;
33
if (global.encounterno == 50)
34
{
35
    if (global.chapter == 2)
36
    {
37
        if (room == room_dw_city_postbaseball_1)
38
        {
39
            global.fc = 1;
40
            global.fe = 2;
41
            global.flag[62 nonnarrative_intro_text] = 1;
42
        }
43
    }
44
}
45
if (global.encounterno == 73)
46
{
47
    global.fc = 3;
48
    global.fe = 4;
49
    global.flag[62 nonnarrative_intro_text] = 1;
50
}
51
if (global.flag[62 nonnarrative_intro_text] == 0)
52
{
53
    global.fe = 0;
54
    global.fc = 0;
55
    global.typer = 4;
56
    global.battletyper = 4;
57
}
58
global.flag[62 nonnarrative_intro_text] = 0;
59
global.myfight = 0;
60
global.mnfight = 0;
61
global.bmenuno = 0;
62
global.attacking = 0;
63
global.acting = 0;
64
global.tension = 0;
65
global.spelldelay = 10;
66
global.turntimer = 120;
67
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; } } }
();
68
global.tensionselect = 0;
69
for (j = 0; j < 3; j += 1)
70
{
71
    global.temptension[j] = global.tension;
72
    for (i = 0; i < 13; i += 1)
73
        tempitem[i][j] = global.item[i];
74
}
75
for (i = 0; i < 3; i += 1)
76
{
77
    global.charcond[i] = 0;
78
    global.automiss[i] = 0;
79
    if (global.char[i] != 0)
80
    {
81
        global.charmove[i] = 1;
82
        global.charcantarget[i] = 1;
83
        global.chardead[i] = 0;
84
    }
85
    else
86
    {
87
        global.charmove[i] = 0;
88
        global.charcantarget[i] = 0;
89
    }
90
}
91
itempage = 0;
92
spellpage = 0;
93
global.flag[50 last_encounter_end] = 0;
94
global.flag[51 last_monster_end_0] = 0;
95
global.flag[52 last_monster_end_1] = 0;
96
global.flag[53 last_monster_end_2] = 0;
97
global.flag[63 violenced_last] = 0;
98
for (i = 0; i < 3; i += 1)
99
    
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);
100
for (i = 0; i < 3; i += 1)
101
{
102
    if (global.monstertype[i] > 0)
103
        
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);
104
}
105
global.monstergold[3] = 0;
106
global.monsterexp[3] = 0;
107
global.charturn = 0;
108
global.currentactingchar = 0;
109
for (i = 0; i < 3; i += 1)
110
{
111
    global.acting[i] = 0;
112
    global.actingsingle[i] = 0;
113
    global.actingsimul[i] = 0;
114
    global.actingtarget[i] = 0;
115
    global.actingchoice[i] = 0;
116
    global.charaction[i] = 0;
117
    global.charspecial[i] = 0;
118
    global.chartarget[i] = 0;
119
    global.faceaction[i] = 0;
120
    global.rembmenuno[i] = 0;
121
    global.targeted[i] = 0;
122
    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];
123
    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];
124
    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];
125
    global.battleactcount[i] = 0;
126
    global.monsterattackname[i] = " ";
127
    for (j = 0; j < 18; j++)
128
    {
129
        global.battlespell[i][j] = 0;
130
        global.battlespellname[i][j] = " ";
131
        global.battlespelldesc[i][j] = " ";
132
        global.battlespellcost[i][j] = 0;
133
        global.battlespelltarget[i][j] = 2;
134
        global.battlespellspecial[i][j] = 0;
135
    }
136
}
137
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) __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]; } } }
();
138
for (i = 0; i < 20; i += 1)
139
{
140
    for (j = 0; j < 20; j += 1)
141
        global.bmenucoord[i][j] = 0;
142
}
143
movenoise = 0;
144
selnoise = 0;
145
laznoise = 0;
146
damagenoise = 0;
147
grazenoise = 0;
148
bcolor = merge_color(c_purple, c_black, 0.7);
149
bcolor = merge_color(bcolor, c_dkgray, 0.5);
150
tp = 0;
151
tpy = 50;
152
bp = 0;
153
bpy = 152;
154
intro = 1;
155
chartotal = 0;
156
charpos[0] = -1;
157
charpos[1] = -1;
158
charpos[2] = -1;
159
charpos[3] = -1;
160
havechar[0] = 0;
161
havechar[1] = 0;
162
havechar[2] = 0;
163
havechar[3] = 0;
164
global.charinstance[0] = 12129292;
165
global.charinstance[1] = 12129292;
166
global.charinstance[2] = 12129292;
167
with (global.charinstance[0])
168
    myself = 0;
169
with (global.charinstance[1])
170
    myself = 1;
171
with (global.charinstance[2])
172
    myself = 2;
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
if (global.chapter == 2)
247
{
248
    gigaqueeny = 0;
249
    gigaqueentimer = 0;
250
    gigaqueencon = 0;
251
    if (instance_exists(obj_gigaqueen_enemy))
252
        gigaqueencon = 3;
253
}