Answered How do I display the weapon strings in a mod menu? Black Ops 3 GSC Script

TotalModzHD

Veteran
Messages
3
Reaction score
3
Points
553
So I have been trying (and failing) to get this menu I'm making to list the weapons automatically via an array. Problem is, the weapon name is blank in the menu but if I click the option it will still give the weapon. Below is what my script looks like right now.

Code:
standard = GetArrayKeys(level.zombie_weapons);
for(i = 0; i < standard.size; i++)
{
    self addOpt("standard", standard[i], &zm_weapons::weapon_give, standard[i]);
}

It's based on CabCon's menu base so the first parameter of addOpt is the menu to add the option to, the second is the string (which is where the problem is), the third is the function to call and the fourth is the arguments to pass to the function.
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,998
Reaction score
2,918
Points
1,053
So I have been trying (and failing) to get this menu I'm making to list the weapons automatically via an array. Problem is, the weapon name is blank in the menu but if I click the option it will still give the weapon. Below is what my script looks like right now.

Code:
standard = GetArrayKeys(level.zombie_weapons);
for(i = 0; i < standard.size; i++)
{
    self addOpt("standard", standard[i], &zm_weapons::weapon_give, standard[i]);
}

It's based on CabCon's menu base so the first parameter of addOpt is the menu to add the option to, the second is the string (which is where the problem is), the third is the function to call and the fourth is the arguments to pass to the function.
Yes, this is actually correct because Black Ops 3 treats weapons as entities instead of just strings. You can't display an entity as a string. In order to do this, you have to use fields of the weapon entitiy. Field for weapon name: .name

Corrected script:
Code:
standard = GetArrayKeys(level.zombie_weapons);
for(i = 0; i < standard.size; i++)
{
    self addOpt("standard", standard[i].name, &zm_weapons::weapon_give, standard[i]);
}

Question answered.
 

JayCoder

Veteran
Staff member
Messages
369
Reaction score
152
Points
903
Yes, this is actually correct because Black Ops 3 treats weapons as entities instead of just strings. You can't display an entity as a string. In order to do this, you have to use fields of the weapon entitiy. Field for weapon name: .name

Corrected script:
Code:
standard = GetArrayKeys(level.zombie_weapons);
for(i = 0; i < standard.size; i++)
{
    self addOpt("standard", standard[i].name, &zm_weapons::weapon_give, standard[i]);
}

Question answered.
Its so beautiful
 

TotalModzHD

Veteran
Messages
3
Reaction score
3
Points
553
I tried standard.name but it's still the same problem unfortunately. Is there anything else that should be added anywhere?
 

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,998
Reaction score
2,918
Points
1,053
I tried standard.name but it's still the same problem unfortunately. Is there anything else that should be added anywhere?
This should work:
Code:
standard = GetArrayKeys(level.zombie_weapons);
for(i = 0; i < standard.size; i++)
{
    self addOpt("standard", standard[i].name, &zm_weapons::weapon_give, standard[i]);
}

The issue could be the string length. Are you using one string to display your menu options?
 
Top