Question GSC Help random box...

BlackOpsModder

Veteran
Messages
80
Reaction score
20
Points
578
I need some help I need a toggle that like when i press a certain key on my keyboard ex: "M"
it makes the box to only give me a certain gun for example the thundergun, and when I press it again it deactivates it and the box go back normal that u can get all guns.
Can anyone make a GSC code for me?
Thx.
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,873
Reaction score
2,882
Points
1,053
I need some help I need a toggle that like when i press a certain key on my keyboard ex: "M"
it makes the box to only give me a certain gun for example the thundergun, and when I press it again it deactivates it and the box go back normal that u can get all guns.
Can anyone make a GSC code for me?
Thx.
This is possible but I never worked with magic boxes in Call of Duty: Black Ops 1. I'll take a look into it.
 

BlackOpsModder

Veteran
Messages
80
Reaction score
20
Points
578
I can maybe even make a donation if u got it working...
But I want no notifications when its on/off....
 

vampytwist

"Don't you trust me?"
Staff member
Messages
645
Reaction score
611
Points
758
I need some help I need a toggle that like when i press a certain key on my keyboard ex: "M"
it makes the box to only give me a certain gun for example the thundergun, and when I press it again it deactivates it and the box go back normal that u can get all guns.
Can anyone make a GSC code for me?
Thx.

This should work for black ops 1 not sure haven 't tested it, nor have I worked with black ops 1 so don't know much about built in functions or naming.

Code:
AllWeaponsInBox() {
    self IPrintLn("All Weapons added to box");
    level.modded_box = 1;
    if (isDefined(level.custom_magic_box_selection_logic))
        level.custom_magic_box_selection_logic = undefined;
    if (isDefined(level.special_weapon_magicbox_check))
        level.special_weapon_magicbox_check = undefined;
    if (isDefined(level.content_weapon))
        level.content_weapon = undefined;
    foreach(weapon in level.zombie_weapons)
    weapon.is_in_box = 1;
    level.limited_weapons = [];
    level.box_weapons = [];
    level.box_weapons = array_copy_if_array(level.zombie_weapons);
    level.customrandomweaponweights = ::MBOverride;
}

randomize_array(array) {
    for (i = 0; i < array.size; i++) {
        j = RandomInt(array.size);
        temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }
    return array;
}

array_copy_if_array(any_var) {
    return (IsArray(any_var) ? ArrayCopy(any_var) : any_var);
}

MBOverride(player) {
    level.box_weapons = randomize_array(level.box_weapons);
    return level.box_weapons;
}

NoBoxWeapons() {
    self IPrintLn("All Weapons removed from box");
    if (!isDefined(level.modded_box))
        AllWeaponsInBox();
    level.limited_weapons = [];
    level.box_weapons = [];
}

allweaponsaddtobox(value) {
    self IPrintLn("Added Weapon: " + value + " To the box");
    if (!isDefined(level.modded_box)) {
        AllWeaponsInBox();
    }
    level.zombie_weapons[value].is_in_box = 1;
    level.limited_weapons[value] = undefined;
    level.box_weapons = ArrayInsert(level.box_weapons, value, 0);
}

OneWeaponInBox(value) {
    self IPrintLn("Weapon: " + value + " Is now the only weapon in the box");
    if (!isDefined(level.modded_box)) {
        AllWeaponsInBox();
    }
    level.zombie_weapons[value].is_in_box = 1;
    level.limited_weapons[value] = undefined;
    level.box_weapons = [];
    level.box_weapons[0] = value;
}

What you would now need to do is make a
function
to bind the button:

Code:
    OneWeaponBoxToggle() {
        while (1) {
            if (self meleebuttonpressed() & addtobox = 0) {
                OneWeaponInBox(gunIDHere);
                addtobox = 1;
            } else if (self meleebuttonpressed() & addtobox = 1) {
                AllWeaponsInBox();
                addtobox = 0;
            }
        }
    }

then add a check OnPlayerSpawned:
Code:
        If(self isHost()) {
            self OneWeaponBoxToggle();
        }


P.S: I've just woke up, this was quickly put together like I said may or may not work but this is how you can try to go about it you may need to tweak/edit some things to get this working for black ops 1. If it doesn't later on during the day I'll download black ops 1 from steam and have a better look and get it fully working.
 
Last edited:

BlackOpsModder

Veteran
Messages
80
Reaction score
20
Points
578
do u mind adding this to the gsc for me?
the weapon that I want to the box pop is the tgun as ex can u make the button to be binded the "m" button?

I will send u the gsc file if u can put it for me it will be awesome!

You do not have permission to view link Log in or register now.
 

vampytwist

"Don't you trust me?"
Staff member
Messages
645
Reaction score
611
Points
758
do u mind adding this to the gsc for me?
the weapon that I want to the box pop is the tgun as ex can u make the button to be binded the "m" button?

I will send u the gsc file if u can put it for me it will be awesome!

You do not have permission to view link Log in or register now.

At the moment no, I have stuff to do but I'll get it done by the end of the day though.
 

vampytwist

"Don't you trust me?"
Staff member
Messages
645
Reaction score
611
Points
758
I wouldn't suggest copy and paste but more so use it as a guidline/template on how it's done. Haha I'd prefer if you tried to understand it and get it working yourself that way you learn something but if not I'll look into it later on today.
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,332
Reaction score
770
Points
973
This should work for black ops 1 not sure haven 't tested it, nor have I worked with black ops 1 so don't know much about built in functions or naming.

Code:
AllWeaponsInBox() {
    self IPrintLn("All Weapons added to box");
    level.modded_box = 1;
    if (isDefined(level.custom_magic_box_selection_logic))
        level.custom_magic_box_selection_logic = undefined;
    if (isDefined(level.special_weapon_magicbox_check))
        level.special_weapon_magicbox_check = undefined;
    if (isDefined(level.content_weapon))
        level.content_weapon = undefined;
    foreach(weapon in level.zombie_weapons)
    weapon.is_in_box = 1;
    level.limited_weapons = [];
    level.box_weapons = [];
    level.box_weapons = array_copy_if_array(level.zombie_weapons);
    level.customrandomweaponweights = ::MBOverride;
}

randomize_array(array) {
    for (i = 0; i < array.size; i++) {
        j = RandomInt(array.size);
        temp = array[i];
        array[i] = array[j];
        array[j] = temp;
    }
    return array;
}

array_copy_if_array(any_var) {
    return (IsArray(any_var) ? ArrayCopy(any_var) : any_var);
}

MBOverride(player) {
    level.box_weapons = randomize_array(level.box_weapons);
    return level.box_weapons;
}

NoBoxWeapons() {
    self IPrintLn("All Weapons removed from box");
    if (!isDefined(level.modded_box))
        AllWeaponsInBox();
    level.limited_weapons = [];
    level.box_weapons = [];
}

allweaponsaddtobox(value) {
    self IPrintLn("Added Weapon: " + value + " To the box");
    if (!isDefined(level.modded_box)) {
        AllWeaponsInBox();
    }
    level.zombie_weapons[value].is_in_box = 1;
    level.limited_weapons[value] = undefined;
    level.box_weapons = ArrayInsert(level.box_weapons, value, 0);
}

OneWeaponInBox(value) {
    self IPrintLn("Weapon: " + value + " Is now the only weapon in the box");
    if (!isDefined(level.modded_box)) {
        AllWeaponsInBox();
    }
    level.zombie_weapons[value].is_in_box = 1;
    level.limited_weapons[value] = undefined;
    level.box_weapons = [];
    level.box_weapons[0] = value;
}

What you would now need to do is make a
function
to bind the button:

Code:
    OneWeaponBoxToggle() {
        while (1) {
            if (self meleebuttonpressed() & addtobox = 0) {
                OneWeaponInBox(gunIDHere);
                addtobox = 1;
            } else if (self meleebuttonpressed() & addtobox = 1) {
                AllWeaponsInBox();
                addtobox = 0;
            }
        }
    }

then add a check OnPlayerSpawned:
Code:
        If(self isHost()) {
            self OneWeaponBoxToggle();
        }


P.S: I've just woke up, this was quickly put together like I said may or may not work but this is how you can try to go about it you may need to tweak/edit some things to get this working for black ops 1. If it doesn't later on during the day I'll download black ops 1 from steam and have a better look and get it fully working.
I gave him something similar, he just left the chat and made this.
 

BlackOpsModder

Veteran
Messages
80
Reaction score
20
Points
578
I wouldn't suggest copy and paste but more so use it as a guidline/template on how it's done. Haha I'd prefer if you tried to understand it and get it working yourself that way you learn something but if not I'll look into it later on today.
the problem is that i dont understand anything about coding...
the only thing i did was changing the gun name to "zm_thundergun"
 

BlackOpsModder

Veteran
Messages
80
Reaction score
20
Points
578
I gave him something similar, he just left the chat and made this.

Well im still on chat lol, I made this cuz the code u gave me doesnt solved my problems, I tried copy and pasting too cuz idk nothing about GSC...
 

candy

G59 Terrorist
Staff member
Donator
Messages
1,332
Reaction score
770
Points
973
Well im still on chat lol, I made this cuz the code u gave me doesnt solved my problems, I tried copy and pasting too cuz idk nothing about GSC...
I explained to you that the code wouldn't work as its for BO2, at least 3 times :tonguewink:.
 

BlackOpsModder

Veteran
Messages
80
Reaction score
20
Points
578
I will give a 5$ amazon gift card for whoever make it work first.
But I dont want notifications of activations.
 
Top