Question BO2 Give All Build Parts code error

micromods

Known Member
Messages
15
Points
108
so in my menu i have this code:
Code:
giveAllBuildables()
{
        foreach(stub in level.buildable_stubs)
        {
            stub.built = 1;
        }
        if ( !isDefined( level.cheat_craftables ) )
        {
            level.cheat_craftables = [];
        }
        foreach( craftable in level.zombie_include_craftables)
        {
            _a112 = craftable.a_piecestubs;
            _k112 = getFirstArrayKey( _a112 );
            while ( isDefined( _k112 ) )
            {
                s_piece = _a112[ _k112 ];
                id_string = undefined;
                client_field_val = undefined;
                if ( isDefined( s_piece.client_field_id ) )
                {
                    id_string = s_piece.client_field_id;
                    client_field_val = id_string;
                }
                else if ( isDefined( s_piece.client_field_state ) )
                {
                    id_string = "gem";
                    client_field_val = s_piece.client_field_state;
                }
                tokens = strtok( id_string, "_" );
                display_string = "piece";
                _a134 = tokens;
                _k134 = getFirstArrayKey( _a134 );
                while ( isDefined( _k134 ) )
                {
                    token = _a134[ _k134 ];
                    if ( token != "piece" && token != "staff" && token != "zm" )
                    {
                        display_string = ( display_string + "_" ) + token;
                    }
                    _k134 = getNextArrayKey( _a134, _k134 );
                }
                level.cheat_craftables[ "" + client_field_val ] = s_piece;
                s_piece.waste = "waste";
                _k112 = getNextArrayKey( _a112, _k112 );
            }
        }
        foreach( key in getArrayKeys(level.cheat_craftables))
        {
            piece_spawn = level.cheat_craftables[ key ].piecespawn;
            if ( isDefined( piece_spawn ) )
            {
                self player_take_piece( piece_spawn );
            }
        }
}
but when i call the function it freezes my console, anyone know why?

i got this from serious's source
 

amand

Known Member
Messages
12
Points
118
Try with this code:

Code:
giveAllBuildables()
{
    foreach( stub in level.buildable_stubs )
    {
    stub.built = 1;
    }
}
 
Last edited:

Top