Deltarune (Chapter 2) 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 = 50; 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; } 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 = 50;
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
    }
15
    recruit[0] = 0;
16
    totalrecruits = 0;
17
    halfrecruits = 0;
18
    eitherrecruits = 0;
19
    for (var i = startnum; i < endnum; i++)
20
    {
21
        if (global.flag[i + 600] > 0)
22
        {
23
            if (whichrecruit == "either")
24
                recruit[eitherrecruits] = i;
25
            eitherrecruits++;
26
            if (global.flag[i + 600] == 1)
27
            {
28
                if (whichrecruit == "full")
29
                    recruit[totalrecruits] = i;
30
                totalrecruits++;
31
            }
32
            else
33
            {
34
                if (whichrecruit == "half")
35
                    recruit[halfrecruits] = i;
36
                halfrecruits++;
37
            }
38
        }
39
    }
40
    return totalrecruits;
41
}