Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_setnpclogic

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

function
scr_setnpclogic(arg0, arg1, arg2)
{ if (arg0 == -4) {
scr_debug_print("Failed to add NPC logic");
exit; } if (arg0.marker.sprite_index == spr_debug_40x40) arg0.marker.visible = 0; with (instance_create(0, 0, obj_npc_wrapper)) { if (variable_struct_exists(arg1, "animspeed")) animspeed = arg1.animspeed; if (variable_struct_exists(arg1, "typer")) typer = arg1.typer; if (variable_struct_exists(arg1, "alwaysanimate")) alwaysanimate = arg1.alwaysanimate; npc = arg0; if (!variable_instance_exists(npc.id, "dialogue_side")) npc.dialogue_side = -1; setdialogue = arg2; choices = []; for (var i = 3; i < argument_count; i++) array_push(choices, argument[i]); } }
(arg0, arg1, arg2)
2
{
3
    if (arg0 == -4)
4
    {
5
        
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
("Failed to add NPC logic");
6
        exit;
7
    }
8
    if (arg0.marker.sprite_index == spr_debug_40x40)
9
        arg0.marker.visible = 0;
10
    with (instance_create(0, 0, obj_npc_wrapper))
11
    {
12
        if (variable_struct_exists(arg1, "animspeed"))
13
            animspeed = arg1.animspeed;
14
        if (variable_struct_exists(arg1, "typer"))
15
            typer = arg1.typer;
16
        if (variable_struct_exists(arg1, "alwaysanimate"))
17
            alwaysanimate = arg1.alwaysanimate;
18
        npc = arg0;
19
        if (!variable_instance_exists(npc.id, "dialogue_side"))
20
            npc.dialogue_side = -1;
21
        setdialogue = arg2;
22
        choices = [];
23
        for (var i = 3; i < argument_count; i++)
24
            array_push(choices, argument[i]);
25
    }
26
}