Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_bell_enemy_tuning_box_Step_0

(view raw script w/o annotations or w/e)
1
image_index = 0;
2
var automiss = false;
3
if (con != 1)
4
{
5
    if (image_alpha < 1)
6
        image_alpha += 0.1;
7
    if (bar_x > 324)
8
    {
9
        image_alpha3 -= 0.1;
10
        if (image_alpha3 <= 0)
11
            automiss = true;
12
        bar_x += 7;
13
    }
14
    else if (image_alpha2 >= 1)
15
    {
16
        if (image_alpha3 < 1)
17
            image_alpha3 += 0.1;
18
        bar_x += 7;
19
    }
20
}
21
if ((button1_p() || button2_p() || button3_p() || automiss == true) && bar_x >= 70 && con == 0 && image_alpha >= 0.6)
22
{
23
    image_index = 1;
24
    var maxmercy = 70;
25
    if (loudringing == 1)
26
        maxmercy = 60;
27
    if (bar_x < 86)
28
        maxmercy = 0;
29
    if (bar_x > 334)
30
        maxmercy = 0;
31
    var maximperfectmercy = max(maxmercy - 1, 0);
32
    if (bar_x >= 86 && bar_x < 196)
33
    {
34
        var ind = 
scr_progress
scr_progress

function
scr_progress(arg0, arg1, arg2, arg3, arg4)
{ return clamp(arg3 + (((arg0 - arg1) / (arg2 - arg1)) * (arg4 - arg3)), arg3, arg4); }
(bar_x, 86, 196, 0, 1);
35
        mercy = ceil(ease_out_cubic(ind, 0, maximperfectmercy, 1));
36
    }
37
    if (bar_x > 224)
38
    {
39
        var ind = 
scr_progress
scr_progress

function
scr_progress(arg0, arg1, arg2, arg3, arg4)
{ return clamp(arg3 + (((arg0 - arg1) / (arg2 - arg1)) * (arg4 - arg3)), arg3, arg4); }
(bar_x, 334, 224, 0, 1);
40
        mercy = ceil(ease_out_cubic(ind, 0, maximperfectmercy, 1));
41
    }
42
    if (bar_x >= 196 && bar_x <= 224)
43
    {
44
        mercy = maxmercy;
45
        printval("mercy");
46
        perfecthits++;
47
        parentid.tuningactsuccess = 1;
48
        with (obj_organ_enemy)
49
            wicabell_tuning = true;
50
        with (obj_bell_enemy_tuning_fork)
51
        {
52
            snd_play(snd_tuning_fork);
53
            
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
();
54
            snd_play(snd_laz_c);
55
            image_speed = 1;
56
        }
57
        with (parentid)
58
        {
59
            attack = instance_create(obj_bell_enemy_tuning_fork.x + 20, obj_bell_enemy_tuning_fork.y + 30, obj_basicattack);
60
            if (other.loudringing == 1)
61
            {
62
                attack.sprite_index = spr_attack_mash2;
63
                attack.image_speed = 0.5;
64
                attack.maxindex = 4;
65
                snd_play(snd_impact);
66
                instance_create(0, 0, obj_shake);
67
            }
68
            shakex = 9;
69
            state = 3;
70
            hurttimer = 30;
71
            
scr_mercyadd
scr_mercyadd

function
scr_mercyadd(arg0, arg1)
{ global.mercymod[arg0] += arg1; if (global.mercymod[arg0] < 0) global.mercymod[arg0] = 0; if (global.mercymod[arg0] >= 100) global.mercymod[arg0] = 100; var _playsound = 1; if (arg1 <= 0) _playsound = 0; with (obj_dmgwriter) { if (type == 5 && mercytimer < 8) _playsound = 0; } if (_playsound) { var _pitch = 0.8; if (arg1 < 99) _pitch = 1; if (arg1 <= 50) _pitch = 1.2; if (arg1 <= 25) _pitch = 1.4; snd_play_x(snd_mercyadd, 0.8, _pitch); } __mercydmgwriter = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter); __mercydmgwriter.damage = arg1; __mercydmgwriter.type = 5; global.hittarget[arg0]++; }
(myself, other.mercy);
72
            for (var i = 0; i < instance_number(obj_monsterparent); i += 1)
73
            {
74
                enemy[i] = instance_find(obj_monsterparent, i);
75
                if (global.mercymod[enemy[i].myself] < global.mercymax[enemy[i].myself] && enemy[i].myself != myself)
76
                {
77
                    if (enemy[i].myself == myself)
78
                    {
79
                    }
80
                    else
81
                    {
82
                        with (enemy[i])
83
                            
scr_mercyadd
scr_mercyadd

function
scr_mercyadd(arg0, arg1)
{ global.mercymod[arg0] += arg1; if (global.mercymod[arg0] < 0) global.mercymod[arg0] = 0; if (global.mercymod[arg0] >= 100) global.mercymod[arg0] = 100; var _playsound = 1; if (arg1 <= 0) _playsound = 0; with (obj_dmgwriter) { if (type == 5 && mercytimer < 8) _playsound = 0; } if (_playsound) { var _pitch = 0.8; if (arg1 < 99) _pitch = 1; if (arg1 <= 50) _pitch = 1.2; if (arg1 <= 25) _pitch = 1.4; snd_play_x(snd_mercyadd, 0.8, _pitch); } __mercydmgwriter = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter); __mercydmgwriter.damage = arg1; __mercydmgwriter.type = 5; global.hittarget[arg0]++; }
(myself, 20);
84
                    }
85
                }
86
            }
87
        }
88
    }
89
    else if (mercy < 10)
90
    {
91
        parentid.tuningactsuccess = 0;
92
        attack = instance_create(obj_bell_enemy_tuning_fork.x + 90, obj_bell_enemy_tuning_fork.y + 30, obj_basicattack);
93
        with (obj_battlecontroller)
94
            damagenoise = 0;
95
        dmgwriter = instance_create(obj_bell_enemy_tuning_fork.x + 90, obj_bell_enemy_tuning_fork.y + 30, obj_dmgwriter);
96
        dmgwriter.damage = 0;
97
        dmgwriter.depth = depth - 999;
98
    }
99
    else
100
    {
101
        parentid.tuningactsuccess = 2;
102
        with (obj_organ_enemy)
103
            wicabell_tuning = true;
104
        with (obj_bell_enemy_tuning_fork)
105
        {
106
            snd_play(snd_tuning_fork);
107
            
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
();
108
            snd_play(snd_laz_c);
109
            image_speed = 1;
110
        }
111
        with (parentid)
112
        {
113
            attack = instance_create(obj_bell_enemy_tuning_fork.x + 20, obj_bell_enemy_tuning_fork.y + 30, obj_basicattack);
114
            if (other.loudringing == 1)
115
            {
116
                attack.sprite_index = spr_attack_mash2;
117
                attack.image_speed = 0.5;
118
                attack.maxindex = 4;
119
                snd_play(snd_impact);
120
                instance_create(0, 0, obj_shake);
121
            }
122
            shakex = 9;
123
            state = 3;
124
            hurttimer = 30;
125
            show_debug_message_concat("other.mercy=", other.mercy);
126
            
scr_mercyadd
scr_mercyadd

function
scr_mercyadd(arg0, arg1)
{ global.mercymod[arg0] += arg1; if (global.mercymod[arg0] < 0) global.mercymod[arg0] = 0; if (global.mercymod[arg0] >= 100) global.mercymod[arg0] = 100; var _playsound = 1; if (arg1 <= 0) _playsound = 0; with (obj_dmgwriter) { if (type == 5 && mercytimer < 8) _playsound = 0; } if (_playsound) { var _pitch = 0.8; if (arg1 < 99) _pitch = 1; if (arg1 <= 50) _pitch = 1.2; if (arg1 <= 25) _pitch = 1.4; snd_play_x(snd_mercyadd, 0.8, _pitch); } __mercydmgwriter = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter); __mercydmgwriter.damage = arg1; __mercydmgwriter.type = 5; global.hittarget[arg0]++; }
(myself, other.mercy);
127
        }
128
    }
129
    with (obj_bell_enemy_tuning_fork)
130
    {
131
        if (other.loudringing == 0)
132
            
scr_battle_sprite_set
scr_battle_sprite_set

function
scr_battle_sprite_set(arg0, arg1, arg2, arg3)
{ _charactor = arg0; _charinstance = obj_herokris; if (_charactor == "noelle") { _charinstance = obj_heronoelle; _charnum = 4; } if (_charactor == "ralsei") { _charinstance = obj_heroralsei; _charnum = 3; } if (_charactor == "susie") { _charinstance = obj_herosusie; _charnum = 2; } if (_charactor == "kris") { _charinstance = obj_herokris; _charnum = 1; } if (instance_exists(_charinstance)) { with (_charinstance) { state = 8; hurt = 0; attacktimer = 0; sprite_index = arg1; image_speed = arg2; image_index = 0; if (arg3 == 0) maxframes = image_number; global.faceaction[myself] = 0; } } }
("kris", spr_krisb_attack, 0.5, false);
133
        if (other.loudringing == 1)
134
            
scr_battle_sprite_set
scr_battle_sprite_set

function
scr_battle_sprite_set(arg0, arg1, arg2, arg3)
{ _charactor = arg0; _charinstance = obj_herokris; if (_charactor == "noelle") { _charinstance = obj_heronoelle; _charnum = 4; } if (_charactor == "ralsei") { _charinstance = obj_heroralsei; _charnum = 3; } if (_charactor == "susie") { _charinstance = obj_herosusie; _charnum = 2; } if (_charactor == "kris") { _charinstance = obj_herokris; _charnum = 1; } if (instance_exists(_charinstance)) { with (_charinstance) { state = 8; hurt = 0; attacktimer = 0; sprite_index = arg1; image_speed = arg2; image_index = 0; if (arg3 == 0) maxframes = image_number; global.faceaction[myself] = 0; } } }
("susie", spr_susie_attack, 0.5, false);
135
        snd_play(snd_laz_c);
136
    }
137
    con = 1;
138
}
139
if (con == 0)
140
    siner++;
141
if (con == 1)
142
{
143
    timer++;
144
    if (timer == 1)
145
    {
146
    }
147
    if (timer > 12)
148
    {
149
        if (loudringing == 1)
150
        {
151
            bar_x = 0;
152
            image_alpha3 = 0;
153
            con = 0;
154
            loudringing = 0;
155
            exit;
156
        }
157
        image_alpha -= 0.1;
158
        image_alpha2 -= 0.1;
159
        with (obj_bell_enemy_tuning_fork)
160
            image_alpha -= 0.1;
161
        if (image_alpha < 0)
162
        {
163
            with (obj_writer)
164
                instance_destroy();
165
            instance_destroy();
166
            with (obj_bell_enemy_tuning_fork)
167
                instance_destroy();
168
        }
169
    }
170
}