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