Undertale script viewer

← back to main script listing

gml_Object_obj_doodlebug_Step_0

(view raw script w/o annotations or w/e)
1
if (global.mnfight == 3)
2
    attacked = 0;
3
if (alarm[5] > 0)
4
{
5
    if (global.monster[0] == 1)
6
    {
7
        if (global.monsterinstance[0].alarm[5] > alarm[5])
gml_Object_obj_doodlebug_Alarm_5.gml

talked = 0; global.mnfight = 2;
8
            alarm[5] = global.monsterinstance[0].alarm[5];
gml_Object_obj_doodlebug_Alarm_5.gml

talked = 0; global.mnfight = 2;
9
    }
10
    if (global.monster[1] == 1)
11
    {
12
        if (global.monsterinstance[1].alarm[5] > alarm[5])
gml_Object_obj_doodlebug_Alarm_5.gml

talked = 0; global.mnfight = 2;
13
            alarm[5] = global.monsterinstance[1].alarm[5];
gml_Object_obj_doodlebug_Alarm_5.gml

talked = 0; global.mnfight = 2;
14
    }
15
    if (global.monster[2] == 1)
16
    {
17
        if (global.monsterinstance[2].alarm[5] > alarm[5])
gml_Object_obj_doodlebug_Alarm_5.gml

talked = 0; global.mnfight = 2;
18
            alarm[5] = global.monsterinstance[2].alarm[5];
gml_Object_obj_doodlebug_Alarm_5.gml

talked = 0; global.mnfight = 2;
19
    }
20
}
21
if (global.mnfight == 1)
22
{
23
    if (talked == 0)
24
    {
25
        alarm[6] = 1;
gml_Object_obj_doodlebug_Alarm_6.gml

global.border = 17; obj_heart.x = round((global.idealborder[0] + global.idealborder[1]) / 2) - 8; obj_heart.y = round((global.idealborder[2] + global.idealborder[3]) / 2) - 8;
26
        talked = 1;
27
        global.heard = 0;
28
    }
29
}
30
if (global.hurtanim[myself] == 1)
31
{
32
    shudder = 8;
33
    alarm[3] = global.damagetimer;
gml_Object_obj_doodlebug_Alarm_3.gml

if (mypart1.pause != 1) { dmgwriter = instance_create((x + (sprite_width / 2)) - 48, y - 24, obj_dmgwriter); global.damage = 0; takedamage = 0; with (dmgwriter) dmg = global.damage; mypart1.pause = 1; snd_play(snd_damage); alarm[8] = 11; } if (sha == 0) sha = x; x = sha + shudder; if (shudder < 0) shudder = -(shudder + 1); else shudder = -shudder; if (shudder == 0) { sha = 0; global.hurtanim[myself] = 2; exit; } alarm[3] = 2;
34
    global.hurtanim[myself] = 3;
35
}
36
if (global.hurtanim[myself] == 2)
37
{
38
    global.monsterhp[myself] -= takedamage;
39
    with (dmgwriter)
40
alarm[2]
41
    if (global.monsterhp[myself] >= 1)
42
    {
43
        global.hurtanim[myself] = 0;
44
        mypart1.pause = 0;
45
        global.myfight = 0;
46
        global.mnfight = 1;
47
    }
48
    else
49
    {
50
        global.myfight = 0;
51
        global.mnfight = 1;
52
        killed = 1;
53
        instance_destroy();
54
    }
55
}
56
if (global.hurtanim[myself] == 5)
57
{
58
    global.damage = 0;
59
    instance_create((x + (sprite_width / 2)) - 48, y - 24, obj_dmgwriter);
60
    with (obj_dmgwriter)
61
alarm[2]
62
    global.myfight = 0;
63
    global.mnfight = 1;
64
    global.hurtanim[myself] = 0;
65
}
66
if (global.mnfight == 2)
67
{
68
    if (attacked == 0)
69
    {
70
        pop = scr_monstersum
scr_monstersum

return global.monster[0] + global.monster[1] + global.monster[2];
();
71
        global.turntimer = 180;
72
        with (mypart1)
73
        {
74
            fight = 1;
75
            f_timer = -1;
76
        }
77
        mycommand = random(100);
78
        attacked = 1;
79
    }
80
    if (mercymod == 999999)
81
    {
82
        global.turntimer = -1;
83
        global.mnfight = 3;
84
    }
85
    whatiheard = -1;
86
}
87
if (global.myfight == 2)
88
{
89
    if (whatiheard != -1)
90
    {
91
        if (global.heard == 0)
92
        {
93
            if (whatiheard == 0)
94
            {
95
                global.msc = 0;
96
                global.msg[0] = 
* DOODLEBOG - ? ATK ? DEF
* Art lets your wildest
fantasies come to life!Wait for input^
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_doodlebug_368")
;
97
                if (specialmessage == 1)
98
                    global.msg[0] = 
* DOODLEBOG C - ? ATK ? DEF
* The "C" stands for "seafaring."
* It likes to ride in a boat.Wait for input^
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_doodlebug_371")
;
99
                OBJ_WRITER.halt = 3;
100
                iii = instance_create(global.idealborder[0], global.idealborder[2], OBJ_WRITER);
101
                with (iii)
102
                    halt = 0;
103
                whatiheard = 9;
104
            }
105
            if (whatiheard == 3)
106
            {
107
                global.msc = 0;
108
                global.msg[0] = 
* You draw a boat.
* Away it goes.Wait for input^
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("obj_doodlebug_381")
;
109
                with (mypart1)
110
                    boat = 2;
111
                mercymod = 222222;
112
                OBJ_WRITER.halt = 3;
113
                iii = instance_create(global.idealborder[0], global.idealborder[2], OBJ_WRITER);
114
                with (iii)
115
                    halt = 0;
116
            }
117
            global.heard = 1;
118
        }
119
    }
120
}
121
if (global.myfight == 4)
122
{
123
    if (global.mercyuse == 0)
124
    {
125
        script_execute(scr_mercystandard);
126
        if (mercy < 0)
127
            instance_destroy();
128
    }
129
}
130
if (mercymod == 222222 && instance_exists(OBJ_WRITER) == 0)
131
    instance_destroy();