Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_onion_event_Step_0

(view raw script w/o annotations or w/e)
1
if (global.chapter == 2 && global.flag[424 talked_onion_ch2] > 0)
2
{
3
    if (instance_exists(obj_ch2_room_beach))
4
    {
5
        with (obj_ch2_room_beach)
6
            canrest = true;
7
        instance_destroy();
8
    }
9
}
10
if (onioncount > 0)
11
    onioncount -= 1;
12
if (global.flag[258 onionsan_ch1] == 0)
13
{
14
    if (onioncount >= 200 && con == 0 && global.flag[258 onionsan_ch1] == 0)
15
    {
16
        if (global.chapter == 1)
17
        {
18
            global.flag[258 onionsan_ch1] = 1;
19
            onioncount = 1;
20
            global.facing = 1;
21
            con = 1;
22
            alarm[4] = 10;
23
            global.interact = 1;
24
        }
25
    }
26
    if (global.chapter == 2)
27
    {
28
        if (instance_exists(obj_ch2_room_beach))
29
        {
30
            with (obj_ch2_room_beach)
31
                canrest = true;
32
            instance_destroy();
33
        }
34
    }
35
}
36
else if (global.flag[258 onionsan_ch1] == 1 || global.flag[258 onionsan_ch1] == 2)
37
{
38
    if (obj_mainchara.x > x)
39
    {
40
        if (con == -1)
41
        {
42
            con = 2;
43
            global.facing = 1;
44
            global.interact = 1;
45
        }
46
        if (con == 2)
47
        {
48
            with (onion)
49
                on = 1;
50
            con = 3;
51
            alarm[4] = 50;
52
        }
53
        if (con == 4)
54
        {
55
            global.facing = 1;
56
            with (onion)
57
                on = 2;
58
            con = (global.chapter == 2 && scr_havechar
scr_havechar

function scr_havechar(arg0) { var checker = arg0; if (checker == "susie" || checker == "su" || checker == "s") checker = 2; if (checker == "ralsei" || checker == "ra" || checker == "r") checker = 3; if (checker == "noelle" || checker == "no" || checker == "n") checker = 4; _rreturn = 0; if (global.char[0] == checker) _rreturn = 1; if (global.char[1] == checker) _rreturn = 1; if (global.char[2] == checker) _rreturn = 1; return _rreturn; }
(2)) ? 19 : 5;
59
            if (global.chapter == 2 && scr_havechar
scr_havechar

function scr_havechar(arg0) { var checker = arg0; if (checker == "susie" || checker == "su" || checker == "s") checker = 2; if (checker == "ralsei" || checker == "ra" || checker == "r") checker = 3; if (checker == "noelle" || checker == "no" || checker == "n") checker = 4; _rreturn = 0; if (global.char[0] == checker) _rreturn = 1; if (global.char[1] == checker) _rreturn = 1; if (global.char[2] == checker) _rreturn = 1; return _rreturn; }
(2))
60
            {
61
                with (obj_caterpillarchara)
62
                    visible = 0;
63
                cutscene_master = scr_cutscene_make
scr_cutscene_make

function scr_cutscene_make() { _cutscene_master = instance_create(0, 0, obj_cutscene_master); _cutscene_master.master_object = id; return _cutscene_master; }
();
64
                scr_maincharacters_actors
scr_maincharacters_actors

function scr_maincharacters_actors() { actor_count = 0; kr = 0; kr_actor = instance_create(obj_mainchara.x, obj_mainchara.y, obj_actor); scr_actor_setup(kr, kr_actor, "kris"); kr_actor.sprite_index = obj_mainchara.sprite_index; kr_actor.depth = obj_mainchara.depth; with (obj_mainchara) visible = 0; for (__jj = 0; __jj < array_length_1d(global.cinstance); __jj++) { if (i_ex(global.cinstance[__jj])) { if (global.cinstance[__jj].name == "susie") { actor_count++; su = __jj + 1; su_actor = instance_create(global.cinstance[__jj].x, global.cinstance[__jj].y, obj_actor); scr_actor_setup(su, su_actor, "susie"); su_actor.sprite_index = global.cinstance[__jj].sprite_index; su_actor.depth = global.cinstance[__jj].depth; with (global.cinstance[__jj]) visible = 0; } if (global.cinstance[__jj].name == "ralsei") { actor_count++; ra = __jj + 1; ra_actor = instance_create(global.cinstance[__jj].x, global.cinstance[__jj].y, obj_actor); scr_actor_setup(ra, ra_actor, "ralsei"); ra_actor.sprite_index = global.cinstance[__jj].sprite_index; ra_actor.depth = global.cinstance[__jj].depth; with (global.cinstance[__jj]) visible = 0; } if (global.cinstance[__jj].name == "noelle") { actor_count++; no = __jj + 1; no_actor = instance_create(global.cinstance[__jj].x, global.cinstance[__jj].y, obj_actor); scr_actor_setup(no, no_actor, "noelle"); no_actor.sprite_index = global.cinstance[__jj].sprite_index; no_actor.depth = global.cinstance[__jj].depth; with (global.cinstance[__jj]) visible = 0; } } } }
();
65
                c_sel
c_sel

function c_sel(arg0) { c_cmd("select", arg0, 0, 0, 0); }
(su);
66
                c_facing
c_facing

function c_facing(arg0) { c_cmd("facing", arg0, 0, 0, 0); }
("r");
67
                c_emote
c_emote

function c_emote() { if (argument_count == 0) c_cmd("emote", "!", 30, 0, 0); else if (argument_count == 1) c_cmd("emote", argument[0], 30, 0, 0); else if (argument_count == 2) c_cmd("emote", argument[0], argument[1], 0, 0); else if (argument_count == 3) c_cmd("emote", argument[0], argument[1], argument[2], 0); }
("!", 30);
68
                c_waitcustom
c_waitcustom

function c_waitcustom() { c_cmd("waitcustom", 0, 0, 0, 0); }
();
69
            }
70
            alarm[4] = 150;
71
        }
72
        if (con == 6)
73
        {
74
            global.fc = 0;
75
            global.typer = 5;
76
            global.msc = (global.chapter == 1) ? 195 : 1030;
77
            scr_text
scr_text

function scr_text(arg0) { switch (arg0) { case 0: break; case 10: global.choicemsg[0] = stringsetloc(
#Yes
"#Yes", "scr_text_slash_scr_text_gml_8_0"
); global.choicemsg[1] = stringsetloc(
#No
"#No", "scr_text_slash_scr_text_gml_9_0"
); global.choicemsg[2] = stringsetloc(
" ", "scr_text_slash_scr_text_gml_12_0_b"
); global.choicemsg[3] = stringsetloc(
" ", "scr_text_slash_scr_text_gml_13_0_b"
); global.msg[0] = stringsetloc(
* You really didn't want to throw it away.Wait for input
"* You really didn't want to throw it away./", "scr_text_slash_scr_text_gml_12_0"
); global.msg[1] = stringsetloc(
* Throw it away anyway?Wait for input
"* Throw it away anyway?/", "scr_text_slash_scr_text_gml_13_0"
); global.msg[2] = stringsetloc(
Choice type 2
"\\C2 ", "scr_text_slash_scr_text_gml_14_0"
); if (global.chapter >= 2) msgsetloc(0,
* You took it from your pocket.Delay 11
* You have a very,Delay 11 very,Delay 11 bad feeling about throwing it away.Wait for input
"* You took it from your pocket^1.&* You have a \\cYvery^1, very^1, bad feeling\\c0 about throwing it away./", "scr_text_slash_scr_text_gml_19_0"
); break; case 11: if (global.choice == 0) { global.flag[466 junkball_dropped] = 1; snd_play(snd_bageldefeat); global.msg[0] = stringsetloc(
* Hand shaking,Delay 11 you dropped the ball of junk on the ground.Wait for input
"* Hand shaking^1, you dropped the ball of junk on the ground./", "scr_text_slash_scr_text_gml_20_0"
); global.msg[1] = stringsetloc(
* It broke into pieces.Wait for input
"* It broke into pieces./", "scr_text_slash_scr_text_gml_21_0"
); global.msg[2] = stringsetloc(
* You felt bitter.Wait for inputClose Message
"* You felt bitter./%", "scr_text_slash_scr_text_gml_22_0"
); script_execute(scr_litemshift, global.menucoord[1], 0); for (i = 0; i < 12; i += 1) global.item[i] = 0; for (i = 0; i < 48; i += 1) { global.armor[i] = 0; global.weapon[i] = 0; } } else { global.msg[0] = stringsetloc(
* You felt a feeling of relief.Wait for inputClose Message
"* You felt a feeling of relief./%", "scr_text_slash_scr_text_gml_34_0"
); } break; case 100: global.msg[0] = stringsetloc(
* Hey, Kris!Delay 11 What's up?Delay 11
* Didja lose your pencil again?Wait for input
"* Hey, Kris^1! What's up^1?&* Didja lose your pencil again?/", "scr_text_slash_scr_text_gml_39_0"
); global.msg[1] = stringsetloc(
Face 4* Here,Delay 11 you want the candy-cane one or the one with lights on it?Wait for input
"\\E4* Here^1, you want the candy-cane one or the one with lights on it?/", "scr_text_slash_scr_text_gml_40_0"
); global.msg[2] = stringsetloc(
Face 1* Huh?Delay 11
* You want to be partners?Wait for input
"\\E1* Huh^1?&* You want to be partners?/", "scr_text_slash_scr_text_gml_41_0"
); global.msg[3] = stringsetloc(
Face 4* Ummm...Delay 11 Sorry...Delay 11
* Berdly already asked me...Wait for input
"\\E4* Ummm..^1. Sorry..^1.&* Berdly already asked me.../", "scr_text_slash_scr_text_gml_42_0"
); global.msg[4] = stringsetloc(
Face 0* But I could ask Ms. Alphys if we could make a group of 3!Wait for input
"\\E0* But I could ask Ms. Alphys if we could make a group of 3!/", "scr_text_slash_scr_text_gml_43_0"
); global.msg[5] = stringsetloc(
Face 4* I'll ask if you're sure!

Not yet Yes. Ask.Choice type 1
"\\E4* I'll ask if you're sure!& &Not yet Yes. Ask.\\C1 ", "scr_text_slash_scr_text_gml_44_0"
); global.msg[6] = stringsetloc(
" ", "scr_text_slash_scr_text_gml_47_0"
); break; case 101: if (global.choice == 1) { global.msg[0] = stringsetloc(
Face 0* OK,Delay 11 I'll ask!Wait for input
"\\E0* OK^1, I'll ask!/", "scr_text_slash_scr_text_gml_51_0"
); global.msg[1] = stringsetloc(
* Miss Alphys!Delay 11
* Umm,Delay 11 is it OK if we have a group of 3?Wait for inputClose Message
"* Miss Alphys^1!&* Umm^1, is it OK if we have a group of 3?/%", "scr_text_slash_scr_text_gml_52_0"
); with (obj_classscene) con = 20; } if (global.choice == 0) global.msg[0] = stringsetloc(
Face 4* Yeah,Delay 11 I'm sure there's someone else you can ask!Wait for inputClose Message
"\\E4* Yeah^1, I'm sure there's someone else you can ask!/%", "scr_text_slash_scr_text_gml_57_0"
); break; case 102: global.msg[0] = stringsetloc(
Face 0* Do you wanna be partners?
Not yet YesChoice type 1
"\\E0* Do you wanna be partners?&Not yet Yes\\C1 ", "scr_text_slash_scr_text_gml_62_0"
); global.msg[1] = stringsetloc(
" ", "scr_text_slash_scr_text_gml_65_0"
); break; case 103: if (global.choice == 1) { global.msg[0] = stringsetloc(
Face 0* OK,Delay 11 I'll ask!Wait for input
"\\E0* OK^1, I'll ask!/", "scr_text_slash_scr_text_gml_69_0"
); global.msg[1] = stringsetloc(
* Miss Alphys!Delay 11
* Umm,Delay 11 is it OK if we have a group of 3?Wait for inputClose Message
"* Miss Alphys^1!&* Umm^1, is it OK if we have a group of 3?/%", "scr_text_slash_scr_text_gml_70_0"
); with (obj_classscene) con = 20; } if (global.choice == 0) global.msg[0] = stringsetloc(
Face 4* Umm,Delay 11 OK.Delay 11
* You just keep doing your thing,Delay 11 Kris.Wait for inputClose Message
"\\E4* Umm^1, OK^1.&* You just keep doing your thing^1, Kris./%", "scr_text_slash_scr_text_gml_75_0"
); break; case 104: global.msg[0] = stringsetloc(
Face 0* Alright.Delay 11
* Let's get this over with.Wait for input
"\\E0* Alright^1.&* Let's get this over with./", "scr_text_slash_scr_text_gml_80_0"
); global.msg[1] = stringsetloc(
* We'll get more chalk.Delay 11
* Mosey back to class.Delay 11
* And then,Delay 11 Kris...Wait for input
"* We'll get more chalk^1.&* Mosey back to class^1.&* And then^1, Kris.../", "scr_text_slash_scr_text_gml_81_0"
); global.msg[2] = stringsetloc(
Face 2* YOU'LL do our project.Wait for input
"\\E2* YOU'LL do our project./", "scr_text_slash_scr_text_gml_82_0"
); global.msg[3] = stringsetloc(
* How's that sound?

Good BadChoice type 1
"* How's that sound?& &Good Bad\\C1 ", "scr_text_slash_scr_text_gml_83_0"
); global.msg[4] = stringsetloc(
" ", "scr_text_slash_scr_text_gml_86_0"
); break; case 105: global.msg[0] = stringsetloc(
Close MessageClose Message
" %%", "scr_text_slash_scr_text_gml_90_0"
); break; case 110: global.choicemsg[0] = stringsetloc(
#Yes
"#Yes", "scr_text_slash_scr_text_gml_92_0"
); global.choicemsg[1] = stringsetloc(
#No
"#No", "scr_text_slash_scr_text_gml_93_0"
); global.choicemsg[2] = stringsetloc(
" ", "scr_text_slash_scr_text_gml_96_0"
); global.choicemsg[3] = stringsetloc(
" ", "scr_text_slash_scr_text_gml_97_0"
); if (global.flag[100 got_glowshard] == 0) { global.msg[0] = stringsetloc(
* (There's something glowing inside.)Wait for input
"* (There's something glowing inside.)/", "scr_text_slash_scr_text_gml_98_0"
); global.msg[1] = stringsetloc(
* (Take it?)Wait for input
"* (Take it?)/ ", "scr_text_slash_scr_text_gml_99_0"
); global.msg[2] = stringsetloc(
Choice type 2
" \\C2", "scr_text_slash_scr_text_gml_100_0"
); } else { global.msg[0] = stringsetloc(
* (It's dark inside.)Wait for inputClose Message
"* (It's dark inside.)/%", "scr_text_slash_scr_text_gml_104_0"
); } break; case 111: ...
(global.msc);
78
            instance_create(0, 0, obj_dialoguer);
79
            con = 7;
80
        }
81
        if (con == 7 && !d_ex())
82
        {
83
            global.interact = 1;
84
            onion.on = 4;
85
            con = (global.chapter == 2 && scr_havechar
scr_havechar

function scr_havechar(arg0) { var checker = arg0; if (checker == "susie" || checker == "su" || checker == "s") checker = 2; if (checker == "ralsei" || checker == "ra" || checker == "r") checker = 3; if (checker == "noelle" || checker == "no" || checker == "n") checker = 4; _rreturn = 0; if (global.char[0] == checker) _rreturn = 1; if (global.char[1] == checker) _rreturn = 1; if (global.char[2] == checker) _rreturn = 1; return _rreturn; }
(2)) ? 29 : 8;
86
            alarm[4] = 150;
87
        }
88
        if (con == 9)
89
        {
90
            con = 10;
91
            global.flag[424 talked_onion_ch2] = 1;
92
            with (onion)
93
                instance_destroy();
94
            global.interact = 0;
95
            global.facing = 0;
96
            if (instance_exists(obj_ch2_room_beach))
97
            {
98
                with (obj_ch2_room_beach)
99
                    canrest = true;
100
            }
101
            instance_destroy();
102
        }
103
        if (con == 20 && customcon == 1)
104
        {
105
            con = 21;
106
            customcon = 0;
107
            c_waitcustom_end
c_waitcustom_end

function c_waitcustom_end() { with (obj_cutscene_master) { cs_wait_custom = 0; waiting = 0; } }
();
108
        }
109
        if (con == 21)
110
        {
111
            con = 22;
112
            c_speaker
c_speaker

function c_speaker(arg0) { c_cmd("speaker", arg0, 0, 0, 0); }
("no_name");
113
            c_msgsetloc
c_msgsetloc

function c_msgsetloc(arg0, arg1, arg2) { var msg_index = arg0; var english = arg1; var localized_string_id = arg2; var str = english; if (!is_english()) str = scr_84_get_lang_string(localized_string_id); c_msgset(msg_index, str); }
(0,
Face 3* Hey.....Delay 11 thought I told you...Delay 11 to come alone...Wait for input
"\\M3* Hey....^1. thought I told you..^1. to come alone.../", "obj_onion_event_slash_Step_0_gml_110_0"
);
114
            c_facenext
c_facenext

function c_facenext(arg0, arg1) { c_cmd("msgfacenext", arg0, arg1, 0, 0); }
("susie", 0);
115
            c_msgnextloc
c_msgnextloc

function c_msgnextloc(arg0, arg1) { var str = arg0; var localized_string_id = arg1; if (!is_english()) str = scr_84_get_lang_string(localized_string_id); c_msgnext(str); }
(
* ...Delay 11 you know what,Delay 11 hell if I'm getting involved in this.Wait for inputClose Message
"* ..^1. you know what^1, hell if I'm getting involved in this./%", "obj_onion_event_slash_Step_0_gml_112_0"
);
116
            c_talk_wait();
117
            c_walk_wait
c_walk_wait

function c_walk_wait(arg0, arg1, arg2) { c_walk(arg0, arg1, arg2); c_wait(arg2); }
("l", 4, 40);
118
            c_waitcustom
c_waitcustom

function c_waitcustom() { c_cmd("waitcustom", 0, 0, 0, 0); }
();
119
        }
120
        if (con == 22 && customcon == 1)
121
        {
122
            customcon = 0;
123
            con = 6;
124
        }
125
        if (con == 30)
126
        {
127
            con = 33;
128
            customcon = 0;
129
            c_waitcustom_end
c_waitcustom_end

function c_waitcustom_end() { with (obj_cutscene_master) { cs_wait_custom = 0; waiting = 0; } }
();
130
            c_sel
c_sel

function c_sel(arg0) { c_cmd("select", arg0, 0, 0, 0); }
(su);
131
            c_actormoveparty
c_actormoveparty

function c_actormoveparty(arg0) { __mcactor = scr_findactor("kris"); if (__mcactor >= 0) { c_sel(__mcactor); c_walkdirect(obj_mainchara.x, obj_mainchara.y, arg0); } for (__jj = 0; __jj < 2; __jj++) { if (i_ex(global.cinstance[__jj])) { __mcactor = scr_findactor(global.cinstance[__jj].name); if (__mcactor >= 0) { c_sel(__mcactor); c_cmd("walkdirect", global.cinstance[__jj].x, global.cinstance[__jj].y, arg0, 0); } } } }
(30);
132
            c_wait
c_wait

function c_wait(arg0) { c_cmd("wait", arg0, 0, 0, 0); }
(45);
133
            c_speaker
c_speaker

function c_speaker(arg0) { c_cmd("speaker", arg0, 0, 0, 0); }
("susie");
134
            c_msgsetloc
c_msgsetloc

function c_msgsetloc(arg0, arg1, arg2) { var msg_index = arg0; var english = arg1; var localized_string_id = arg2; var str = english; if (!is_english()) str = scr_84_get_lang_string(localized_string_id); c_msgset(msg_index, str); }
(0,
* Hey Kris. So,Delay 11 uh...Wait for input
"* Hey Kris. So^1, uh.../", "obj_onion_event_slash_Step_0_gml_139_0"
);
135
            c_msgnextloc
c_msgnextloc

function c_msgnextloc(arg0, arg1) { var str = arg0; var localized_string_id = arg1; if (!is_english()) str = scr_84_get_lang_string(localized_string_id); c_msgnext(str); }
(
Face K* Do you do weird stuff like this every day after school?Wait for inputClose Message
"\\EK* Do you do weird stuff like this every day after school?/%", "obj_onion_event_slash_Step_0_gml_140_0"
);
136
            c_talk_wait();
137
            c_actortokris
c_actortokris

function c_actortokris() { c_cmd("actortokris", 0, 0, 0, 0); }
();
138
            c_actortocaterpillar
c_actortocaterpillar

function c_actortocaterpillar() { c_cmd("actortocaterpillar", 0, 0, 0, 0); }
();
139
            c_terminatekillactors
c_terminatekillactors

function c_terminatekillactors() { c_cmd("terminatekillactors", 0, 0, 0, 0); }
();
140
        }
141
        if (con == 33 && !i_ex(obj_cutscene_master))
142
            con = 9;
143
    }
144
}
145
else if (global.flag[258 onionsan_ch1] == 3)
146
{
147
    if (instance_exists(obj_ch2_room_beach))
148
    {
149
        with (obj_ch2_room_beach)
150
            canrest = true;
151
        instance_destroy();
152
    }
153
}