Deltarune (Chapter 3) script viewer

← back to main script listing

gml_GlobalScript_scr_recruits_to_array

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

function
scr_recruits_to_array()
{ var startnum = 0; var endnum = 80; var whichrecruit = "full"; if (argument_count >= 1) whichrecruit = argument[0]; if (argument_count >= 2) { if (argument[1] == 1) endnum = 25; if (argument[1] == 2) startnum = 30; if (argument[1] == 3) startnum = 54; } recruit[0] = 0; totalrecruits = 0; halfrecruits = 0; eitherrecruits = 0; for (var i = startnum; i < endnum; i++) { if (global.flag[i + 600] > 0) { if (whichrecruit == "either") recruit[eitherrecruits] = i; eitherrecruits++; if (global.flag[i + 600] == 1) { if (whichrecruit == "full") recruit[totalrecruits] = i; totalrecruits++; } else { if (whichrecruit == "half") recruit[halfrecruits] = i; halfrecruits++; } } } return totalrecruits; }
()
2
{
3
    var startnum = 0;
4
    var endnum = 80;
5
    var whichrecruit = "full";
6
    if (argument_count >= 1)
7
        whichrecruit = argument[0];
8
    if (argument_count >= 2)
9
    {
10
        if (argument[1] == 1)
11
            endnum = 25;
12
        if (argument[1] == 2)
13
            startnum = 30;
14
        if (argument[1] == 3)
15
            startnum = 54;
16
    }
17
    recruit[0] = 0;
18
    totalrecruits = 0;
19
    halfrecruits = 0;
20
    eitherrecruits = 0;
21
    for (var i = startnum; i < endnum; i++)
22
    {
23
        if (global.flag[i + 600] > 0)
24
        {
25
            if (whichrecruit == "either")
26
                recruit[eitherrecruits] = i;
27
            eitherrecruits++;
28
            if (global.flag[i + 600] == 1)
29
            {
30
                if (whichrecruit == "full")
31
                    recruit[totalrecruits] = i;
32
                totalrecruits++;
33
            }
34
            else
35
            {
36
                if (whichrecruit == "half")
37
                    recruit[halfrecruits] = i;
38
                halfrecruits++;
39
            }
40
        }
41
    }
42
    return totalrecruits;
43
}