Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_green_cat_Create_0

(view raw script w/o annotations or w/e)
1
if (!instance_exists(obj_heart))
2
    instance_destroy();
3
type = 0;
4
myscore = [20, 50, 100, 250, 500, 1500, 5000, 20000, 100000];
5
chance = 1;
6
alarm[0]
 = 1;
gml_Object_obj_green_cat_Alarm_0.gml

randomize(); var _probabilities = [80, 14, 4.5, 1.25, 0.24, 0.01, 0.0001, 0]; var _new_type = type; var _repeat = clamp(power(1.7, (chance * 0.7) + 0.3), 1, 99999999); var _rr = random(100); _rr *= (1 / _repeat); if (_rr <= 100) _new_type = 0; if (_rr <= 20) _new_type = 1; if (_rr <= 6) _new_type = 2; if (_rr <= 1.5) _new_type = 3; if (_rr <= 0.25) _new_type = 4; if (_rr <= 0.01) _new_type = 5; if (_rr <= 0.0003) _new_type = 6; if (_rr <= 0.000005) _new_type = 7; if (_new_type == 7 && chance >= 40) { var _rr2 = random(100); if (_rr2 <= (1 * (chance - 40))) _new_type = 8; } type = _new_type;
7
8
collect = function()
9
{
10
    with (obj_mike_minigame_controller)
11
    {
12
        var fuelamount = 25;
13
        if (fuel >= 1)
14
            fuelamount = 20;
15
        if (fuel >= 20)
16
            fuelamount = 15;
17
        if (fuel >= 35)
18
            fuelamount = 10;
19
        if (other.myscore[other.type] == 50)
20
            fuelamount += 5;
21
        if (other.myscore[other.type] == 100)
22
            fuelamount += 15;
23
        if (other.myscore[other.type] == 250)
24
            fuelamount += 40;
25
        if (other.myscore[other.type] == 500)
26
            fuelamount += 80;
27
        if (other.myscore[other.type] == 100000)
28
            fuelamount = 0;
29
        fuel = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(fuel, 100, fuelamount);
30
        if (other.myscore[other.type] == 1500)
31
            fuel = 130;
32
        if (other.myscore[other.type] == 5000)
33
            fuel = 200;
34
        if (other.myscore[other.type] == 20000)
35
            fuel = 250;
36
        if (other.myscore[other.type] != 100000)
37
        {
38
            myscore += other.myscore[other.type];
39
        }
40
        else
41
        {
42
            myscore += round(random_range(-50000, 300000));
43
            if (fuel > 20)
44
                fuel = 20;
45
            else
46
                fuel = 1;
47
        }
48
    }
49
    if (myscore[type] != 100000)
50
    {
51
        scr_sparkle_colour(8, 65280);
52
        var _a = instance_create(x, y, obj_gravity_text);
53
        _a.image_blend = c_lime;
54
        _a.str = string(myscore[type]);
55
        if (myscore[type] == 20)
56
            snd_play(snd_magicsprinkle, 0.8, 1);
57
        if (myscore[type] == 50)
58
            snd_play(snd_magicsprinkle, 0.9, 0.95);
59
        if (myscore[type] == 100)
60
            snd_play(snd_magicsprinkle, 1, 0.9);
61
        if (myscore[type] == 250)
62
            snd_play(snd_magicsprinkle, 1, 0.8);
63
        if (myscore[type] == 500)
64
            snd_play(snd_cd_bagel_susie, 0.8, 1.3 + random(0.1));
65
        if (myscore[type] == 1500)
66
        {
67
            snd_play(snd_magicsprinkle, 1, 0.5);
68
            snd_play(snd_cd_bagel_ralsei, 1, 1);
69
        }
70
        if (myscore[type] == 5000)
71
        {
72
            snd_play(snd_magicsprinkle, 1, 0.25);
73
            snd_play(snd_cd_bagel_ralsei, 1, 0.8);
74
            snd_play(snd_cd_bagel_ralsei, 1, 0.81);
75
        }
76
        if (myscore[type] == 20000)
77
        {
78
            snd_play(snd_magicsprinkle, 1, 0.1);
79
            snd_play(snd_cd_bagel_ralsei, 1, 0.6);
80
            snd_play(snd_cd_bagel_ralsei, 1, 0.62);
81
        }
82
    }
83
    else
84
    {
85
        scr_sparkle_colour(ceil(random(24)), random(999999));
86
        snd_play(snd_hurt1, 1, 0.5);
87
        snd_play(snd_knight_laugh, 0.9, random_range(0.5, 3));
88
        snd_play(snd_knight_laugh, 0.9, random_range(0.5, 3));
89
    }
90
    with (obj_mike_controller)
91
    {
92
        if (hand_target == -1)
93
            hand_type = 0;
94
    }
95
    instance_destroy();
96
};
97
98
buffer = 0;
99
for (var i = 0; i < 5; i++)
100
{
101
    last_x[i] = 0;
102
    last_y[i] = 0;
103
}
104
last_x[0] = x;
105
last_y[0] = y - 4;
106
thrown = 1;
107
throw_timer = 0;
108
throwing = 0;
109
score_buffer = 3;
110
wall_destroy = 0;
111
grab_snd = -1;
112
wait = 0;
113
wait_max = 30;
114
xx = x;
115
yy = y;
116
action = 0;
117
xscale = 1;
118
can_score = 1;
119
image_xscale = 1;
120
image_yscale = image_xscale;
121
sprite_mask = sprite_index;
122
sprite_index = spr_mike_cat_dance;
123
image_blend = c_lime;
124
level = 0;
125
fever_timer = -1;