Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_monster1_Step_0

(view raw script w/o annotations or w/e)
1
if (global.monster[myself] == 1)
2
{
3
    if (global.mnfight == 1 && talked == 0)
4
    {
5
        abletotarget = 1;
6
        if (global.charcantarget[0] == 0 && global.charcantarget[1] == 0 && global.charcantarget[2] == 0)
7
            abletotarget = 0;
8
        mytarget = choose(0, 1, 2);
9
        if (abletotarget == 1)
10
        {
11
            while (global.charcantarget[mytarget] == 0)
12
                mytarget = choose(0, 1, 2);
13
        }
14
        else
15
        {
16
            target = 3;
17
        }
18
        global.targeted[mytarget] = 1;
19
        instance_create(0, 0, obj_darkener);
20
        global.typer = 7;
21
        global.msg[0] = "";
22
        if (global.mercymod[myself] >= global.mercymax[myself])
23
            global.msg[0] = "";
24
        mywriter = instance_create(x - 60, y - 30, obj_writer);
25
        talked = 1;
26
        talktimer = 0;
27
    }
28
    if (talked == 1 && global.mnfight == 1)
29
    {
30
        if (button1_p() && talktimer > 15)
31
            talktimer = talkmax;
32
        talktimer += 1;
33
        if (talktimer >= talkmax)
34
        {
35
            with (obj_writer)
36
                instance_destroy();
37
            global.mnfight = 2;
38
        }
39
    }
40
    if (global.mnfight == 2 && attacked == 0)
41
    {
42
        simp = instance_create(0, 0, obj_simplecontroller);
43
        simp.damage = global.monsterat[myself] * 5;
44
        simp.target = mytarget;
45
        attacked = 1;
46
        rr = floor(random(4));
47
    }
48
}
49
if (global.myfight == 3)
50
{
51
    xx = __view_get(e__VW.XView, 0);
52
    yy = __view_get(e__VW.YView, 0);
53
    if (acting == 1 && actcon == 0)
54
    {
55
        actcon = 1;
56
        global.msg[0] = "";
57
        global.typer = global.battletyper;
58
        battlewriter = instance_create(xx + 30, yy + 376, obj_writer);
59
        if (global.fc != 0)
60
            myface = instance_create(xx + 26, yy + 380, obj_face);
61
        if (acting == 1)
62
            global.mercymod[myself] += 120;
63
        if (global.mercymod[myself] >= global.mercymax[myself])
64
            global.msg[0] = "";
65
    }
66
    if (acting == 2)
67
    {
68
        if (acttimer == 0)
69
        {
70
            global.msg[0] = "";
71
            global.typer = global.battletyper;
72
            battlewriter = instance_create(xx + 130, yy + 376, obj_writer);
73
            if (global.fc != 0)
74
                myface = instance_create(xx + 26, yy + 380, obj_face);
75
        }
76
        if (acttimer == 20)
77
        {
78
            global.chartarget[0] = myself;
79
            global.chartarget[1] = myself;
80
            global.charspecial[0] = 1;
81
            global.charspecial[1] = 1;
82
            with (global.charinstance[0])
83
                state = 2;
84
            with (global.charinstance[1])
85
                state = 2;
86
        }
87
        if (acttimer == 40)
88
            actcon = 1;
89
        acttimer += 1;
90
    }
91
    if (actcon == 1 && !instance_exists(obj_writer))
92
    {
93
        actcon = 0;
94
        scr_attackphase
scr_attackphase

function scr_attackphase() { with (obj_battlecontroller) { techwon = 0; if (scr_monsterpop() == 0) techwon = 1; if (global.chapter == 2 && i_ex(obj_berdlyb_enemy) && obj_berdlyb_enemy.endcon == 1) techwon = 1; else if (techwon == 1) scr_wincombat(); if (techwon == 0) { for (__hiti = 0; __hiti < 3; __hiti++) global.hittarget[__hiti] = 0; fightphase = 1; global.charturn = 3; if (global.charaction[0] == 4 || global.charaction[0] == 2) fightphase = 0; if (global.charaction[1] == 4 || global.charaction[1] == 2) fightphase = 0; if (global.charaction[2] == 4 || global.charaction[2] == 2) fightphase = 0; if (global.myfight == 4) fightphase = 1; if (fightphase == 1) { global.myfight = 1; instance_create(xx + 2, yy + 365, obj_attackpress); } else { global.myfight = 4; instance_create(0, 0, obj_spellphase); } } } }
();
95
    }
96
}
97
if (x > (__view_get(e__VW.XView, 0) + 800) && global.myfight != 3)
98
    instance_destroy();
99
100
enum e__VW
101
{
102
    XView,
103
    YView,
104
    WView,
105
    HView,
106
    Angle,
107
    HBorder,
108
    VBorder,
109
    HSpeed,
110
    VSpeed,
111
    Object,
112
    Visible,
113
    XPort,
114
    YPort,
115
    WPort,
116
    HPort,
117
    Camera,
118
    SurfaceID
119
}