Deltarune (Chapter 2) script viewer

← back to main script listing

gml_GlobalScript_scr_wincombat

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

function scr_wincombat() { if (global.flag[60 dojo_next_encounter] == 0 || global.flag[36 dojo_failure] == 1) { global.myfight = 7; global.mnfight = -1; with (obj_battlecontroller) victory = 1; for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i]) scr_monsterdefeat(); } } } else { for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i]) scr_monsterdefeat(); } } global.encounterno = global.flag[60 dojo_next_encounter]; scr_encountersetup(global.encounterno); global.flag[60 dojo_next_encounter] = 0; for (__j = 0; __j < 3; __j++) { if (global.monstertype[__j] != 0(None)) { _newmonster = scr_monster_add(global.monstertype[__j], global.monsterinstancetype[__j]); global.monsterinstance[_newmonster].x = camerax() + 800; global.monsterinstance[_newmonster].y = global.monstermakey[__j]; with (global.monsterinstance[_newmonster]) scr_move_to_point_over_time(global.monstermakex[myself], global.monstermakey[myself], 10); } } global.myfight = 5; myfightreturntimer = 15; global.mnfight = -1; } }
()
2
{
3
    if (global.flag[60 dojo_next_encounter] == 0 || global.flag[36 dojo_failure] == 1)
4
    {
5
        global.myfight = 7;
6
        global.mnfight = -1;
7
        with (obj_battlecontroller)
8
            victory = 1;
9
        for (i = 0; i < 3; i += 1)
10
        {
11
            if (global.monster[i] == 1 && i_ex(global.monsterinstance[i]))
12
            {
13
                with (global.monsterinstance[i])
14
                    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); } }
();
15
            }
16
        }
17
    }
18
    else
19
    {
20
        for (i = 0; i < 3; i += 1)
21
        {
22
            if (global.monster[i] == 1 && i_ex(global.monsterinstance[i]))
23
            {
24
                with (global.monsterinstance[i])
25
                    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); } }
();
26
            }
27
        }
28
        global.encounterno = global.flag[60 dojo_next_encounter];
29
        scr_encountersetup
scr_encountersetup

function scr_encountersetup(arg0) { xx = __view_get(e__VW.XView, 0); yy = __view_get(e__VW.YView, 0); for (i = 0; i < 3; i += 1) { global.heromakex[i] = xx + 80; global.heromakey[i] = yy + 50 + (80 * i); global.monsterinstancetype[i] = obj_baseenemy; global.monstertype[i] = 1Enemy (placeholder/G-BODY); global.monstermakex[i] = xx + 500 + (20 * i); global.monstermakey[i] = yy + 40 + (90 * i); } global.monstertype[1] = 0(None); global.monstertype[2] = 0(None); if (global.char[0] != 0 && global.char[1] == 0 && global.char[2] == 0) global.heromakey[0] = yy + 140; if (global.char[0] != 0 && global.char[1] != 0 && global.char[2] == 0) { global.heromakey[0] = yy + 100; global.heromakey[1] = yy + 180; } global.battlemsg[0] = stringsetloc(
* It is known.
"* It is known.", "scr_encountersetup_slash_scr_encountersetup_gml_34_0"
); switch (arg0) { case 0: break; case 1: global.monsterinstancetype[0] = obj_baseenemy; global.monstertype[0] = 1Enemy (placeholder/G-BODY); global.monstermakex[0] = xx + 480; global.monstermakey[0] = yy + 110; global.monsterinstancetype[1] = obj_baseenemy; global.monstertype[1] = 1Enemy (placeholder/G-BODY); global.monstermakex[1] = xx + 500; global.monstermakey[1] = yy + 200; global.monstertype[2] = 0(None); global.battlemsg[0] = stringsetloc(
* Test enemies showed up.
"* Test enemies showed up.", "scr_encountersetup_slash_scr_encountersetup_gml_60_0"
); break; case 2: global.monsterinstancetype[0] = obj_lancerboss; global.monstertype[0] = 2Lancer; global.monstermakex[0] = xx + 540; global.monstermakey[0] = yy + 200; global.monstertype[1] = 0(None); global.monstertype[2] = 0(None); break; case 3: global.monsterinstancetype[0] = obj_dummyenemy; global.monstertype[0] = 3Dummy; global.monstermakex[0] = xx + 500; global.monstermakey[0] = yy + 160; if (instance_exists(obj_npc_room)) { global.monstermakex[0] = obj_npc_room.xstart; global.monstermakey[0] = obj_npc_room.ystart; } global.monstertype[1] = 0(None); global.monstertype[2] = 0(None); break; case 4: global.monsterinstancetype[0] = obj_diamondenemy; global.monstertype[0] = 5Rudinn; global.monstermakex[0] = xx + 480; global.monstermakey[0] = yy + 140; global.monstertype[1] = 0(None); global.monstertype[2] = 0(None); global.battlemsg[0] = stringsetloc(
* Rudinn drew near!
"* Rudinn drew near!", "scr_encountersetup_slash_scr_encountersetup_gml_98_0"
); if (global.flag[500 times_rudinn_fought] >= 1) global.battlemsg[0] = stringsetloc(
* A different Rudinn from last time drew near!
"* A different Rudinn from last time drew near!", "scr_encountersetup_slash_scr_encountersetup_gml_99_0"
); if (global.flag[500 times_rudinn_fought] == 2) global.battlemsg[0] = stringsetloc(
* Assumedly another different Rudinn appeared!
"* Assumedly another different Rudinn appeared!", "scr_encountersetup_slash_scr_encountersetup_gml_100_0"
); break; case 5: global.monsterinstancetype[0] = obj_diamondenemy; global.monstertype[0] = 5Rudinn; global.monstermakex[0] = xx + 480; global.monstermakey[0] = yy + 110; global.monsterinstancetype[1] = obj_diamondenemy; global.monstertype[1] = 5Rudinn; global.monstermakex[1] = xx + 500; global.monstermakey[1] = yy + 200; global.monstertype[2] = 0(None); global.battlemsg[0] = stringsetloc(
* A necklace of Rudinns blocks your path.
"* A necklace of Rudinns blocks your path.", "scr_encountersetup_slash_scr_encountersetup_gml_116_0"
); break; case 6: global.monsterinstancetype[0] = obj_diamondenemy; global.monstertype[0] = 5Rudinn; global.monstermakex[0] = xx + 480; global.monstermakey[0] = yy + 110; global.monsterinstancetype[1] = obj_heartenemy; global.monstertype[1] = 6Hathy; global.monstermakex[1] = xx + 500; global.monstermakey[1] = yy + 200; global.monstertype[2] = 0(None); global.battlemsg[0] = stringsetloc(
* Rudinn and Hathy blocked the way!
"* Rudinn and Hathy blocked the way!", "scr_encountersetup_slash_scr_encountersetup_gml_132_0"
); break; case 7: global.monsterinstancetype[0] = obj_smallcheckers_enemy; global.monstertype[0] = 9C.Round; global.monstermakex[0] = xx + 440; ...
(global.encounterno);
30
        global.flag[60 dojo_next_encounter] = 0;
31
        for (__j = 0; __j < 3; __j++)
32
        {
33
            if (global.monstertype[__j] != 0(None))
34
            {
35
                _newmonster = scr_monster_add
scr_monster_add

function scr_monster_add(arg0, arg1) { __returnid = -1; for (__mopenslot = 0; __mopenslot < 3; __mopenslot++) { if (global.monster[__mopenslot] == 0) { global.monstertype[__mopenslot] = arg0; global.monsterinstancetype[__mopenslot] = arg1; scr_monster_statreset(__mopenslot); scr_monster_makeinstance(__mopenslot); __returnid = __mopenslot; break; } } return __returnid; }
(global.monstertype[__j], global.monsterinstancetype[__j]);
36
                global.monsterinstance[_newmonster].x = camerax() + 800;
37
                global.monsterinstance[_newmonster].y = global.monstermakey[__j];
38
                with (global.monsterinstance[_newmonster])
39
                    scr_move_to_point_over_time
scr_move_to_point_over_time

function scr_move_to_point_over_time(arg0, arg1, arg2) { _mmm = instance_create(x, y, obj_move_to_point); _mmm.target = id; _mmm.movex = arg0; _mmm.movey = arg1; _mmm.movemax = arg2; return _mmm; }
(global.monstermakex[myself], global.monstermakey[myself], 10);
40
            }
41
        }
42
        global.myfight = 5;
43
        myfightreturntimer = 15;
44
        global.mnfight = -1;
45
    }
46
}