Deltarune script viewer

← back to main script listing

gml_Object_obj_spell_mist_Draw_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    if (myself >= 0)
4
    {
5
        if (global.monster[myself] == 1)
6
        {
7
            if (global.monsterstatus[myself] == 1)
8
                success = 1;
9
        }
10
    }
11
}
12
if (initdelay == 0)
13
{
14
    audio_play_sound(snd_ghostappear, 50, 0);
15
    if (success == 1)
16
        audio_play_sound(snd_spell_pacify, 50, 0);
17
}
18
initdelay--;
19
if (initdelay <= 0)
20
{
21
    siner++;
22
    image_alpha = (sin(siner / 9) - 0.3) + (success * 0.3);
23
    amp = sin(siner / 9) * 30;
24
    draw_sprite_ext(sprite_index, image_index, x + (sin(siner / 6) * amp), y + ((cos(siner / 6) * amp) / 2), image_xscale, image_yscale, image_angle, image_blend, image_alpha * 0.8);
25
    draw_sprite_ext(sprite_index, image_index, x - (sin(siner / 6) * amp), y - ((cos(siner / 6) * amp) / 2), image_xscale, image_yscale, image_angle, image_blend, image_alpha * 0.8);
26
    stimer++;
27
    if (siner == 12)
28
    {
29
        if (success == 1)
30
        {
31
            with (target)
32
            {
33
                global.flag[51 + myself] = 3;
34
                event_user(10);
35
                scr_monsterdefeat
scr_monsterdefeat

function scr_monsterdefeat() { if (global.monster[myself] == 1) { global.monstergold[3] += global.monstergold[myself]; global.monsterexp[3] += global.monsterexp[myself]; global.monster[myself] = 0; if (global.flag[51 + myself] == 0) { global.flag[51 + myself] = 2; if (global.monsterhp[myself] <= 0) global.flag[51 + myself] = 1; } if (global.flag[51 + myself] == 1) { global.flag[40 violences] += 1; if (fatal == 1) global.flag[44 kills]++; } if (global.flag[51 + myself] == 2) global.flag[41 spares] += 1; if (global.flag[51 + myself] == 3) global.flag[42 pacifies] += 1; if (global.flag[51 + myself] == 5) global.flag[43 autosusie_violences] += 1; if (global.flag[51 + myself] == 6) { global.flag[45 freezes] += 1; global.monstergold[3] += 24; } if (scr_monsterpop() == 0) { _amt_add = 0; _frozened = 0; _violenced = 0; _spared = 0; _pacified = 0; for (d_i = 0; d_i < 3; d_i += 1) { if (global.flag[51 + d_i] != 0) _amt_add += 1; if (global.flag[51 + d_i] == 1) _violenced += 1; if (global.flag[51 + d_i] == 2) _spared += 1; if (global.flag[51 + d_i] == 3) _pacified += 1; if (global.flag[51 + d_i] == 6) _frozened += 1; } if (_frozened > 0) global.flag[50 last_encounter_end] = 6; if (_pacified > 0) global.flag[50 last_encounter_end] = 3; if (_spared > 0) global.flag[50 last_encounter_end] = 2; if (_violenced > 0) global.flag[50 last_encounter_end] = 1; if (_frozened > 0) { if (_pacified > 0 || _violenced > 0 || _spared > 0) global.flag[50 last_encounter_end] = 1; } if (global.flag[50 last_encounter_end] == 6) global.flag[926 iceshocked_encounters]++; if (global.flag[54 encounter_pointer] != 0) { global.flag[global.flag[54 encounter_pointer]] = global.flag[50 last_encounter_end]; global.flag[54 encounter_pointer] = 0; } } event_user(11); } }
();
36
            }
37
        }
38
    }
39
    if (stimer >= 3 && siner <= 24)
40
    {
41
        stimer = 0;
42
        if (success == 1)
43
        {
44
            hex = instance_create((x - (sprite_width / 2)) + random(sprite_width), (y - (sprite_height / 2)) + random(sprite_height), obj_icespell_hexagon);
45
            hex.image_xscale = 0.5;
46
            hex.image_yscale = 0.5;
47
            hex.con = 1;
48
            hex.rotspeed = random(5);
49
            hex.sprite_index = spr_icespell_snowflake;
50
        }
51
    }
52
    if (siner >= 40)
53
        instance_destroy();
54
}