All pastes #901246 Raw Edit

Something

public text v1 · immutable
·published 2008-02-12 15:12 UTC
rendered paste body
#define CHANGE_RECRUITED_TYPE
{VARIABLE recruit_found no}
{VARIABLE current_recruit $unit.type}
{REPEAT 3 (
        [if]
            [variable]
            name=recruit_found
            equals=no
            [/variable]
            [then]
            {FOREACH recruit_types[$REPEAT_i].array recruit_types_i}
            [if]
                [variable]
                name=current_recruit
                equals=$recruit_types[$REPEAT_i].array[$recruit_types_i].type
            [/variable]
            [then]
                [set_variable]
                    name=$recruit_types[$REPEAT_i].current
                    rand=0..$recruits_types[REPEAT_i].size
                [/set_variable]
            {VARIABLE recruit_found yes}
            [/then]
            [/if]
            {NEXT recruit_types_i}
            [/then]
        [/if]
)}
{CLEAR_VARIABLE recruit_found}
{CLEAR_VARIABLE current_recruit}
#enddef