Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_damage_enemy_ch1

(view raw script w/o annotations or w/e)
1
function scr_damage_enemy_ch1
scr_damage_enemy_ch1

function scr_damage_enemy_ch1(arg0, arg1) { dm = instance_create_ch1(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter_ch1); dm.type = global.char[caster] - 1; dm.damage = arg1; global.monsterhp[arg0] -= arg1; if (arg1 > 0) { with (global.monsterinstance[arg0]) { shakex = 9; state = 3; hurttimer = 30; } if (instance_exists(global.monsterinstance[arg0])) global.monsterinstance[arg0].hurtamt = arg1; } global.hittarget[arg0] += 1; if (arg1 == 0) { with (global.monsterinstance[arg0]) { hurtamt = 0; if (hurttimer <= 15 && candodge == 1) { dodgetimer = 0; state = 4; } } } if (global.monsterhp[arg0] <= 0) { with (global.monsterinstance[arg0]) scr_monsterdefeat_ch1(); } }
(arg0, arg1)
2
{
3
    dm = instance_create_ch1(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter_ch1);
4
    dm.type = global.char[caster] - 1;
5
    dm.damage = arg1;
6
    global.monsterhp[arg0] -= arg1;
7
    if (arg1 > 0)
8
    {
9
        with (global.monsterinstance[arg0])
10
        {
11
            shakex = 9;
12
            state = 3;
13
            hurttimer = 30;
14
        }
15
        if (instance_exists(global.monsterinstance[arg0]))
16
            global.monsterinstance[arg0].hurtamt = arg1;
17
    }
18
    global.hittarget[arg0] += 1;
19
    if (arg1 == 0)
20
    {
21
        with (global.monsterinstance[arg0])
22
        {
23
            hurtamt = 0;
24
            if (hurttimer <= 15 && candodge == 1)
25
            {
26
                dodgetimer = 0;
27
                state = 4;
28
            }
29
        }
30
    }
31
    if (global.monsterhp[arg0] <= 0)
32
    {
33
        with (global.monsterinstance[arg0])
34
            scr_monsterdefeat_ch1
scr_monsterdefeat_ch1

function scr_monsterdefeat_ch1() { 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 (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 (scr_monsterpop_ch1() == 0) { _amt_add = 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 (_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; } event_user(11); } }
();
35
    }
36
}