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