UGX-Mods

Call of Duty: Black Ops 3 => Help Desk => Scripting => Topic started by: Zrokz on October 03, 2016, 09:19:57 am

Title: Changing Weapon Cost?
Post by: Zrokz on October 03, 2016, 09:19:57 am
Is there a simplified way of doing this, changing the cost of any gun standard cost

the script in mymap.csv says >

function include_weapons()
{
   zm_weapons::load_weapon_spec_from_table("gamedata/weapons/zm/zm_levelcommon_weapons.csv", 1);
}

Call of Duty Black Ops III\share\raw\gamedata\weapons\zm\zm_levelcommon_weapons.csv

Ive changed the cost in there and nothing happens.
Title: Re: Changing Weapon Cost?
Post by: TheStuffDanDoes on October 03, 2016, 07:44:33 pm
Bump. I really need help doing this. Even @pcdev_assist won't help me hahaha
Title: Re: Changing Weapon Cost?
Post by: reckfullies on October 03, 2016, 08:51:57 pm
The thing about weapons in bo3 is, they are loaded from a table. Which makes it a lot harder to edit them, for example in order to change the weapons in the mystery box  you would need to make a new script your self to access the table.

This is where they add all the weapons in _zm_weapons.gsc

At line 3277:
Code Snippet
Plaintext
function load_weapon_spec_from_table( table, first_row )
{
gametype = GetDvarString( "ui_gametype" );
index = 1;
row = TableLookupRow( table, index );
while ( isdefined( row ) )
{
//Get this weapons data from the current tablerow
weapon_name = checkStringValid( row[ WEAPON_TABLE_COL_NAME ] );
upgrade_name = checkStringValid( row[ WEAPON_TABLE_COL_UPGRADE_NAME ] );
hint = checkStringValid( row[ WEAPON_TABLE_COL_HINT ] );
cost = int( row[ WEAPON_TABLE_COL_COST ] );
weaponVO = checkStringValid( row[ WEAPON_TABLE_COL_VO ] );
weaponVOresp = checkStringValid( row[ WEAPON_TABLE_COL_VO_RESPOND ] );

ammo_cost = undefined; // if unspecified, default to half the cost using undefined
if ( "" != row[WEAPON_TABLE_COL_AMMO_COST] )
{
ammo_cost = int( row[WEAPON_TABLE_COL_AMMO_COST] );
}

create_vox = checkStringValid( row[ WEAPON_TABLE_COL_CREATE_VOX ] );
is_zcleansed = ( ToLower( row[ WEAPON_TABLE_COL_IS_ZCLEANSED ] ) == "true" );
in_box = ( ToLower( row[ WEAPON_TABLE_COL_IN_BOX ] ) == "true" );
upgrade_in_box = ( ToLower( row[ WEAPON_TABLE_COL_UPGRADE_IN_BOX ] ) == "true" );
is_limited = ( ToLower( row[ WEAPON_TABLE_COL_IS_LIMITED ] ) == "true" );
is_aat_exempt = ( ToLower( row[ WEAPON_TABLE_COL_AAT_EXEMPT ] ) == "true" );
limit = int( row[ WEAPON_TABLE_COL_LIMIT ] );
upgrade_limit = int( row[ WEAPON_TABLE_COL_UPGRADE_LIMIT ] );
content_restrict = row[ WEAPON_TABLE_COL_CONTENT_RESTRICT ];
wallbuy_autospawn = ( ToLower( row[ WEAPON_TABLE_COL_AUTOSPAWN ] ) == "true" );
weapon_class = checkStringValid( row[ WEAPON_TABLE_COL_CLASS ] );
is_wonder_weapon = ( ToLower( row[ WEAPON_TABLE_COL_IS_WONDER_WEAPON ] ) == "true" );
force_attachments = ToLower( row[ WEAPON_TABLE_COL_FORCE_ATTACHMENTS ] );

//Now use this data to include the weapon
zm_utility::include_weapon( weapon_name, in_box );
if ( isdefined( upgrade_name ) )
{
zm_utility::include_weapon( upgrade_name, upgrade_in_box );
}

add_zombie_weapon( weapon_name, upgrade_name, hint, cost, weaponVO, weaponVOresp, ammo_cost, create_vox, is_wonder_weapon, force_attachments );
if ( is_limited )
{
if ( isdefined( limit ) )
{
add_limited_weapon( weapon_name, limit );
}
if ( isdefined( upgrade_limit ) && isdefined( upgrade_name ) )
{
add_limited_weapon( upgrade_name, upgrade_limit );
}
}

if ( is_aat_exempt && isdefined( upgrade_name ) )
{
aat::register_aat_exemption( GetWeapon( upgrade_name ) );
}


/* if ( IS_TRUE( content_restrict ) )
{
add_weapon_to_content( weapon_name, content_restrict );
}*/

/*weapon = GetWeapon( weapon_name );
if ( !isdefined( level.wallbuy_autofill_weapons ) )
{
level.wallbuy_autofill_weapons = [];
level.wallbuy_autofill_weapons["all"] = [];
}
level.wallbuy_autofill_weapons["all"][weapon] = wallbuy_autospawn;

if ( weapon_class != "" )
{
if ( !isdefined( level.wallbuy_autofill_weapons[weapon_class] ) )
{
level.wallbuy_autofill_weapons[weapon_class] = [];
}
level.wallbuy_autofill_weapons[weapon_class][weapon] = weapon;
}*/

index++;
row = TableLookupRow( table, index );
}
}

I don't have much experience with tables in C so I wouldn't know how to change them easily but someone else might.
Title: Re: Changing Weapon Cost?
Post by: Xylozi on October 04, 2016, 07:11:13 am
I've successfully changed the price of the Bowie Knife in my map.

First I created the gamedata/weapons/zm folder structure within my map's folder in the usermaps folder, and added an edited zm_levelcommon_weapons.csv with the price for the Bowie Knife set to 100.

Then in my map's zone file I have added the following:

Code Snippet
Plaintext
stringtable,gamedata/weapons/zm/zm_levelcommon_weapons.csv

Title: Re: Changing Weapon Cost?
Post by: Zrokz on October 04, 2016, 08:25:32 pm
I think we can consider this Solved, works perfect for changing any standard gun cost. Thank you so much! Now that dingo wall buy doesn't have to be $5000 anymore =].

For now I just made a copy & edited one of the wall buy pre fabs to dingo

Call of Duty Black Ops III\map_source\_prefabs\zm\zm_core\spawnable_weapon_smg_versatile - Copy

// entity 1
{
guid "{B479F444-882B-11E6-81F5-001BDC0FFAB5}"
"classname" "script_struct"
"angles" "0 360 0"
"origin" "0 0 56"
"target" "auto38"
"targetname" "weapon_upgrade"
"zombie_weapon_upgrade" "lmg_cqb"
"_color" "1 0 0"
}
// entity 2
{
guid "{B479F445-882B-11E6-81F5-001BDC0FFAB5}"
"classname" "script_struct"
"angles" "0 360 0"
"model" "wpn_t7_lmg_dingo_world"
"origin" "-2 0 54"
"targetname" "auto38"
"_color" "1 0 0"
}

works perfect, changed price to 2000, ammo buy is by auto half already = 1000 for ammo.
Title: Re: Changing Weapon Cost?
Post by: Zrokz on October 04, 2016, 08:37:24 pm
Please Note what i said about changing the prefab is unrelated to the question! Thank you Xylozi for solving this!