Deltarune (Chapter 4) 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 (global.chapter == 4)
5
        battlemusicvolume = 0.7;
6
    if (i_ex(obj_astream))
7
    {
8
        if (obj_astream.mystream == global.batmusic[0])
9
        {
10
            if (obj_astream.songname != "mus/battle.ogg")
11
                battlemusicvolume = 1;
12
        }
13
        
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { scr_debug_clear_persistent(); }
(obj_astream.songname);
14
    }
15
    
scr_debug_print
scr_debug_print

function
scr_debug_print(arg0)
{ } function print_message(arg0) { } function debug_print(arg0) { } function scr_debug_clear_all() { scr_debug_clear_persistent(); }
(string(battlemusicvolume));
16
    global.batmusic[1] = mus_loop_ext(global.batmusic[0], battlemusicvolume, 1);
17
    if (i_ex(obj_sound_of_justice_enemy) && obj_sound_of_justice_enemy.phase == 1)
18
        snd_volume(global.batmusic[1], 0 * global.flag[16 music_volume], 0);
19
}
20
victory = 0;
21
victoried = 0;
22
skipvictory = 0;
23
global.battleend = 0;
24
battlewriter = 19212912;
25
myface = 1913918291;
26
lbuffer = 0;
27
rbuffer = 0;
28
onebuffer = 0;
29
twobuffer = 0;
30
myfightreturntimer = 1;
31
messagepriority = -1;
32
attackpriority = -1;
33
hidemercy = 0;
34
cantspare[2] = 0;
35
questionmercy[2] = 0;
36
soundbattle = false;
37
if (global.encounterno == 176 || global.encounterno == 186)
38
    soundbattle = true;
39
hidestar = 0;
40
global.darkzone = 1;
41
global.fighting = 1;
42
if (global.encounterno == 73)
43
{
44
    global.fc = 3;
45
    global.fe = 4;
46
    global.flag[62 nonnarrative_intro_text] = 1;
47
}
48
if (global.flag[62 nonnarrative_intro_text] == 0)
49
{
50
    global.fe = 0;
51
    global.fc = 0;
52
    global.typer = 4;
53
    global.battletyper = 4;
54
}
55
global.flag[62 nonnarrative_intro_text] = 0;
56
if (global.chapter == 4 && (global.encounterno == 160 || global.encounterno == 176))
57
{
58
    global.char[0] = 2;
59
    global.char[1] = 0;
60
    global.char[2] = 0;
61
    questionmercy[0] = 1;
62
}
63
if (global.chapter == 4 && global.encounterno == 186)
64
{
65
    global.char[0] = 1;
66
    global.char[1] = 2;
67
    global.char[2] = 0;
68
    questionmercy[0] = 1;
69
}
70
global.myfight = 0;
71
global.mnfight = 0;
72
global.bmenuno = 0;
73
global.attacking = 0;
74
global.acting = 0;
75
global.tension = 0;
76
global.spelldelay = 10;
77
global.turntimer = 120;
78
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; } } }
();
79
global.tensionselect = 0;
80
for (j = 0; j < 3; j += 1)
81
{
82
    global.temptension[j] = global.tension;
83
    for (i = 0; i < 13; i += 1)
84
        tempitem[i][j] = global.item[i];
85
}
86
for (i = 0; i < 3; i += 1)
87
{
88
    global.charcond[i] = 0;
89
    global.automiss[i] = 0;
90
    if (global.char[i] != 0)
91
    {
92
        global.charmove[i] = 1;
93
        global.charcantarget[i] = 1;
94
        global.chardead[i] = 0;
95
    }
96
    else
97
    {
98
        global.charmove[i] = 0;
99
        global.charcantarget[i] = 0;
100
    }
101
}
102
itempage = 0;
103
spellpage = 0;
104
global.flag[50 last_encounter_end] = 0;
105
global.flag[51 last_monster_end_0] = 0;
106
global.flag[52 last_monster_end_1] = 0;
107
global.flag[53 last_monster_end_2] = 0;
108
global.flag[63 violenced_last] = 0;
109
for (i = 0; i < 3; i += 1)
110
    
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);
111
for (i = 0; i < 3; i += 1)
112
{
113
    if (global.monstertype[i] > 0)
114
        
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);
115
}
116
global.monstergold[3] = 0;
117
global.monsterexp[3] = 0;
118
global.charturn = 0;
119
global.currentactingchar = 0;
120
for (i = 0; i < 3; i += 1)
121
{
122
    global.acting[i] = 0;
123
    global.actingsingle[i] = 0;
124
    global.actingsimul[i] = 0;
125
    global.actingtarget[i] = 0;
126
    global.actingchoice[i] = 0;
127
    global.charaction[i] = 0;
128
    global.charspecial[i] = 0;
129
    global.chartarget[i] = 0;
130
    global.faceaction[i] = 0;
131
    global.rembmenuno[i] = 0;
132
    global.targeted[i] = 0;
133
    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];
134
    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];
135
    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];
136
    global.battleactcount[i] = 0;
137
    global.monsterattackname[i] = " ";
138
    for (j = 0; j < 18; j++)
139
    {
140
        global.battlespell[i][j] = 0;
141
        global.battlespellname[i][j] = " ";
142
        global.battlespelldesc[i][j] = " ";
143
        global.battlespellcost[i][j] = 0;
144
        global.battlespelltarget[i][j] = 2;
145
        global.battlespellspecial[i][j] = 0;
146
    }
147
}
148
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]; } } }
();
149
for (i = 0; i < 20; i += 1)
150
{
151
    for (j = 0; j < 20; j += 1)
152
        global.bmenucoord[i][j] = 0;
153
}
154
disablesusieattack = 0;
155
movenoise = 0;
156
selnoise = 0;
157
laznoise = 0;
158
damagenoise = 0;
159
grazenoise = 0;
160
bcolor = merge_color(c_purple, c_black, 0.7);
161
bcolor = merge_color(bcolor, c_dkgray, 0.5);
162
tp = 0;
163
tpy = 50;
164
bp = 0;
165
bpy = 152;
166
intro = 1;
167
chartotal = 0;
168
charpos[0] = -1;
169
charpos[1] = -1;
170
charpos[2] = -1;
171
charpos[3] = -1;
172
havechar[0] = 0;
173
havechar[1] = 0;
174
havechar[2] = 0;
175
havechar[3] = 0;
176
global.charinstance[0] = 12129292;
177
global.charinstance[1] = 12129292;
178
global.charinstance[2] = 12129292;
179
with (global.charinstance[0])
180
    myself = 0;
181
with (global.charinstance[1])
182
    myself = 1;
183
with (global.charinstance[2])
184
    myself = 2;
185
mmy[0] = 0;
186
mmy[1] = 0;
187
mmy[2] = 0;
188
mmy[3] = 0;
189
if (global.chapter == 4)
190
    rabbickvar = choose(0, 1, 2);
191
for (i = 0; i < 3; i += 1)
192
{
193
    if (global.char[i] != 0)
194
        chartotal += 1;
195
    if (global.char[i] == 1)
196
    {
197
        havechar[0] = 1;
198
        charpos[0] = i;
199
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_herokris);
200
        global.charinstance[i].myself = i;
201
        global.charinstance[i].char = 1;
202
        global.charinstance[i].depth = 200 - (i * 20);
203
    }
204
    if (global.char[i] == 2)
205
    {
206
        havechar[1] = 1;
207
        charpos[1] = i;
208
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_herosusie);
209
        global.charinstance[i].myself = i;
210
        global.charinstance[i].char = 2;
211
        global.charinstance[i].depth = 200 - (i * 20);
212
    }
213
    if (global.char[i] == 3)
214
    {
215
        havechar[2] = 1;
216
        charpos[2] = i;
217
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_heroralsei);
218
        global.charinstance[i].myself = i;
219
        global.charinstance[i].char = 3;
220
        global.charinstance[i].depth = 200 - (i * 20);
221
    }
222
    if (global.char[i] == 4)
223
    {
224
        havechar[3] = 1;
225
        charpos[3] = i;
226
        global.charinstance[i] = instance_create(global.heromakex[i], global.heromakey[i], obj_heronoelle);
227
        global.charinstance[i].myself = i;
228
        global.charinstance[i].char = 4;
229
        global.charinstance[i].depth = 200 - (i * 20);
230
    }
231
}
232
slmxx = 0;
233
slmyy = 0;
234
s_siner = 0;
235
t_siner = 0;
236
instance_create(0, 0, obj_tensionbar);
237
reset = 0;
238
timeron = 1;
239
noreturn = 0;
240
hpcolor[0] = c_aqua;
241
hpcolor[1] = c_fuchsia;
242
hpcolor[2] = c_lime;
243
hpcolor[3] = c_yellow;
244
for (i = 0; i < 4; i++)
245
    hpcolorsoft[i] = merge_color(hpcolor[i], c_white, 0.5);
246
global.flag[36 dojo_failure] = 0;
247
global.flag[39 dojo_abort?] = 0;
248
if (global.ambush == 1)
249
{
250
    
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; }
();
251
    global.ambush = 0;
252
}
253
if (global.ambush == 2)
254
{
255
    with (obj_monsterparent)
256
        firststrike = 1;
257
    global.tension = round(global.maxtension / 4);
258
    global.ambush = 0;
259
}
260
disableitembutton = false;
261
incenseturtlegersoncon = 0;
262
gueigersoncon = 0;
263
skipsusieturn = false;
264
skipmonsterselection = false;
265
facevar = 0;
266
dancing_jackolantern_con = 0;
267
dancing_jackolantern_alpha = 1;
268
dancing_jackolantern_index = 0;
269
dancing_jackolantern_timer = 0;
270
gersonend = false;
271
autoselect = false;