Skip to content
  • 0 Unread 0
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Grabbing A Weapon's Camo...

Grabbing A Weapon's Camo...

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
1 Posts 1 Posters 887 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Deicideundefined Offline
    Deicideundefined Offline
    Deicide
    wrote on last edited by
    #1

    The title says it all. Any ideas? I tried looking in _weapons.gsc and _class.gsc and didn't get too far.

    I want to be able to build a function or use a built in function to return a camo value (like 17 for diamond).

    I.E:

    CamoGrab()
    { return self GiveWeapon(weapon, 0, self calcweaponoptions( CAMO_INDEX, lens_index, reticle_index, reticle_color_index )); }
    

    Something like this, except only the camo. This function here was grabbed from the Bo2 zombie's gsc maps\mp\zombies\_zm_weapons

    get_pack_a_punch_weapon_options( weapon )
    {
        if ( !isDefined( self.pack_a_punch_weapon_options ) )
        {
            self.pack_a_punch_weapon_options = [];
        }
        if ( !is_weapon_upgraded( weapon ) )
        {
            return self calcweaponoptions( 0, 0, 0, 0, 0 );
        }
        if ( isDefined( self.pack_a_punch_weapon_options[ weapon ] ) )
        {
            return self.pack_a_punch_weapon_options[ weapon ];
        }
        smiley_face_reticle_index = 1;
        base = get_base_name( weapon );
        camo_index = 39;
        lens_index = randomintrange( 0, 6 );
        reticle_index = randomintrange( 0, 16 );
        reticle_color_index = randomintrange( 0, 6 );
        plain_reticle_index = 16;
        r = randomint( 10 );
        use_plain = r < 3;
        if ( base == "saritch_upgraded_zm" )
        {
            reticle_index = smiley_face_reticle_index;
        }
        else
        {
            if ( use_plain )
            {
                reticle_index = plain_reticle_index;
            }
        }
    /#
        if ( getDvarInt( #"471F9AB9" ) >= 0 )
        {
            reticle_index = getDvarInt( #"471F9AB9" );
    #/
        }
        scary_eyes_reticle_index = 8;
        purple_reticle_color_index = 3;
        if ( reticle_index == scary_eyes_reticle_index )
        {
            reticle_color_index = purple_reticle_color_index;
        }
        letter_a_reticle_index = 2;
        pink_reticle_color_index = 6;
        if ( reticle_index == letter_a_reticle_index )
        {
            reticle_color_index = pink_reticle_color_index;
        }
        letter_e_reticle_index = 7;
        green_reticle_color_index = 1;
        if ( reticle_index == letter_e_reticle_index )
        {
            reticle_color_index = green_reticle_color_index;
        }
        self.pack_a_punch_weapon_options[ weapon ] = self calcweaponoptions( camo_index, lens_index, reticle_index, reticle_color_index );
        return self.pack_a_punch_weapon_options[ weapon ];
    }
    

    Not too much beyond this seems to yield any results unfortunately. Looking in _class.gsc, this is the closest i can find to anything camo related here.

    giveloadout( team, class ) //checked partially changed to match cerberus output did not use continue in for loop see github for more info
    {
    	pixbeginevent( "giveLoadout" );
    	self takeallweapons();
    	primaryindex = 0;
    	self.specialty = [];
    	self.killstreak = [];
    	primaryweapon = undefined;
    	self notify( "give_map" );
    	class_num_for_killstreaks = 0;
    	primaryweaponoptions = 0;
    	secondaryweaponoptions = 0;
    	playerrenderoptions = 0;
    	primarygrenadecount = 0;
    	iscustomclass = 0;
    	if ( issubstr( class, "CLASS_CUSTOM" ) )
    	{
    		pixbeginevent( "custom class" );
    		class_num = int( class[ class.size - 1 ] ) - 1;
    		if ( class_num == -1 )
    		{
    			class_num = 9;
    		}
    		self.class_num = class_num;
    		self reset_specialty_slots( class_num );
    		playerrenderoptions = self calcplayeroptions( class_num );
    		class_num_for_killstreaks = class_num;
    		iscustomclass = 1;
    		pixendevent();
    	}
    	else
    	{
    		pixbeginevent( "default class" );
    		/*
    /#
    		assert( isDefined( self.pers[ "class" ] ), "Player during spawn and loadout got no class!" );
    #/
    		*/
    		class_num = level.classtoclassnum[ class ];
    		self.class_num = class_num;
    		pixendevent();
    	}
    	knifeweaponoptions = self calcweaponoptions( class_num, 2 );
    	self giveweapon( "knife_mp", 0, knifeweaponoptions );
    	self.specialty = self getloadoutperks( class_num );
    	if ( level.leaguematch )
    	{
    		for ( i = 0; i < self.specialty.size; i++ )
    		{
    			if ( isleagueitemrestricted( self.specialty[ i ] ) )
    			{
    				arrayremoveindex( self.specialty, i );
    				i--;
    
    			}
    		}
    	}
    	self register_perks();
    	self setactionslot( 3, "altMode" );
    	self setactionslot( 4, "" );
    	givekillstreaks( class_num_for_killstreaks );
    	spawnweapon = "";
    	initialweaponcount = 0;
    	if ( isDefined( self.pers[ "weapon" ] ) && self.pers[ "weapon" ] != "none" && !maps/mp/killstreaks/_killstreaks::iskillstreakweapon( self.pers[ "weapon" ] ) )
    	{
    		weapon = self.pers[ "weapon" ];
    	}
    	else
    	{
    		weapon = self getloadoutweapon( class_num, "primary" );
    		weapon = removeduplicateattachments( weapon );
    		if ( maps/mp/killstreaks/_killstreaks::iskillstreakweapon( weapon ) )
    		{
    			weapon = "weapon_null_mp";
    		}
    	}
    	sidearm = self getloadoutweapon( class_num, "secondary" );
    	sidearm = removeduplicateattachments( sidearm );
    	if ( maps/mp/killstreaks/_killstreaks::iskillstreakweapon( sidearm ) )
    	{
    		sidearm = "weapon_null_mp";
    	}
    	self.primaryweaponkill = 0;
    	self.secondaryweaponkill = 0;
    	if ( self isbonuscardactive( 2, self.class_num ) )
    	{
    		self.primaryloadoutweapon = weapon;
    		self.primaryloadoutaltweapon = weaponaltweaponname( weapon );
    		self.secondaryloadoutweapon = sidearm;
    		self.secondaryloadoutaltweapon = weaponaltweaponname( sidearm );
    	}
    	else if ( self isbonuscardactive( 0, self.class_num ) )
    	{
    		self.primaryloadoutweapon = weapon;
    	}
    	if ( self isbonuscardactive( 1, self.class_num ) )
    	{
    		self.secondaryloadoutweapon = sidearm;
    	}
    	if ( sidearm != "weapon_null_mp" )
    	{
    		secondaryweaponoptions = self calcweaponoptions( class_num, 1 );
    	}
    	primaryweapon = weapon;
    	if ( primaryweapon != "weapon_null_mp" )
    	{
    		primaryweaponoptions = self calcweaponoptions( class_num, 0 );
    	}
    	if ( sidearm != "" && sidearm != "weapon_null_mp" && sidearm != "weapon_null" )
    	{
    		self giveweapon( sidearm, 0, secondaryweaponoptions );
    		if ( self hasperk( "specialty_extraammo" ) )
    		{
    			self givemaxammo( sidearm );
    		}
    		spawnweapon = sidearm;
    		initialweaponcount++;
    	}
    	primaryweapon = weapon;
    	primarytokens = strtok( primaryweapon, "_" );
    	self.pers[ "primaryWeapon" ] = primarytokens[ 0 ];
    	/*
    /#
    	println( "^5GiveWeapon( " + weapon + " ) -- weapon" );
    #/
    	*/
    	if ( primaryweapon != "" && primaryweapon != "weapon_null_mp" && primaryweapon != "weapon_null" )
    	{
    		if ( self hasperk( "specialty_extraammo" ) )
    		{
    			self givemaxammo( primaryweapon );
    		}
    		self giveweapon( primaryweapon, 0, primaryweaponoptions );
    		spawnweapon = primaryweapon;
    		initialweaponcount++;
    	}
    	if ( initialweaponcount < 2 )
    	{
    		self giveweapon( "knife_held_mp", 0, knifeweaponoptions );
    		if ( initialweaponcount == 0 )
    		{
    			spawnweapon = "knife_held_mp";
    		}
    	}
    	if ( !isDefined( self.spawnweapon ) && isDefined( self.pers[ "spawnWeapon" ] ) )
    	{
    		self.spawnweapon = self.pers[ "spawnWeapon" ];
    	}
    	if ( isDefined( self.spawnweapon ) && doesweaponreplacespawnweapon( self.spawnweapon, spawnweapon ) && !self.pers[ "changed_class" ] )
    	{
    		spawnweapon = self.spawnweapon;
    	}
    	self.pers[ "changed_class" ] = 0;
    	/*
    /#
    	assert( spawnweapon != "" );
    #/
    	*/
    	self.spawnweapon = spawnweapon;
    	self.pers[ "spawnWeapon" ] = self.spawnweapon;
    	self setspawnweapon( spawnweapon );
    	grenadetypeprimary = self getloadoutitemref( class_num, "primarygrenade" );
    	if ( isleagueitemrestricted( grenadetypeprimary ) )
    	{
    		grenadetypeprimary = "";
    	}
    	if ( maps/mp/killstreaks/_killstreaks::iskillstreakweapon( grenadetypeprimary + "_mp" ) )
    	{
    		grenadetypeprimary = "";
    	}
    	grenadetypesecondary = self getloadoutitemref( class_num, "specialgrenade" );
    	if ( isleagueitemrestricted( grenadetypesecondary ) )
    	{
    		grenadetypesecondary = "";
    	}
    	if ( maps/mp/killstreaks/_killstreaks::iskillstreakweapon( grenadetypesecondary + "_mp" ) )
    	{
    		grenadetypesecondary = "";
    	}
    	if ( grenadetypeprimary != "" && grenadetypeprimary != "weapon_null_mp" && isequipmentallowed( grenadetypeprimary ) )
    	{
    		grenadetypeprimary += "_mp";
    		primarygrenadecount = self getloadoutitem( class_num, "primarygrenadecount" );
    	}
    	if ( grenadetypesecondary != "" && grenadetypesecondary != "weapon_null_mp" && isequipmentallowed( grenadetypesecondary ) )
    	{
    		grenadetypesecondary += "_mp";
    		grenadesecondarycount = self getloadoutitem( class_num, "specialgrenadecount" );
    	}
    	if ( grenadetypeprimary != "" && grenadetypeprimary != "weapon_null_mp" && !isequipmentallowed( grenadetypeprimary ) )
    	{
    		if ( grenadetypesecondary != level.weapons[ "frag" ] )
    		{
    			grenadetypeprimary = level.weapons[ "frag" ];
    		}
    		else
    		{
    			grenadetypeprimary = level.weapons[ "flash" ];
    		}
    	}
    	/*
    /#
    	println( "^5GiveWeapon( " + grenadetypeprimary + " ) -- grenadeTypePrimary" );
    #/
    	*/
    	self giveweapon( grenadetypeprimary );
    	self setweaponammoclip( grenadetypeprimary, primarygrenadecount );
    	self switchtooffhand( grenadetypeprimary );
    	self.grenadetypeprimary = grenadetypeprimary;
    	self.grenadetypeprimarycount = primarygrenadecount;
    	if ( self.grenadetypeprimarycount > 1 )
    	{
    		self dualgrenadesactive();
    	}
    	if ( grenadetypesecondary != "" && grenadetypesecondary != "weapon_null_mp" && isequipmentallowed( grenadetypesecondary ) )
    	{
    		self setoffhandsecondaryclass( grenadetypesecondary );
    		/*
    /#
    		println( "^5GiveWeapon( " + grenadetypesecondary + " ) -- grenadeTypeSecondary" );
    #/
    		*/
    		self giveweapon( grenadetypesecondary );
    		self setweaponammoclip( grenadetypesecondary, grenadesecondarycount );
    		self.grenadetypesecondary = grenadetypesecondary;
    		self.grenadetypesecondarycount = grenadesecondarycount;
    	}
    	self bbclasschoice( class_num, primaryweapon, sidearm );
    	if ( !sessionmodeiszombiesgame() )
    	{
    		for ( i = 0; i < 3; i++ )
    		{
    			if ( level.loadoutkillstreaksenabled && isDefined( self.killstreak[ i ] ) && isDefined( level.killstreakindices[ self.killstreak[ i ] ] ) )
    			{
    				killstreaks[ i ] = level.killstreakindices[ self.killstreak[ i ] ];
    			}
    			else
    			{
    				killstreaks[ i ] = 0;
    			}
    		}
    		self recordloadoutperksandkillstreaks( primaryweapon, sidearm, grenadetypeprimary, grenadetypesecondary, killstreaks[ 0 ], killstreaks[ 1 ], killstreaks[ 2 ] );
    	}
    	self maps/mp/teams/_teams::set_player_model( team, weapon );
    	self initstaticweaponstime();
    	self thread initweaponattachments( spawnweapon );
    	self setplayerrenderoptions( playerrenderoptions );
    	if ( isDefined( self.movementspeedmodifier ) )
    	{
    		self setmovespeedscale( self.movementspeedmodifier * self getmovespeedscale() );
    	}
    	if ( isDefined( level.givecustomloadout ) )
    	{
    		spawnweapon = self [[ level.givecustomloadout ]]();
    		if ( isDefined( spawnweapon ) )
    		{
    			self thread initweaponattachments( spawnweapon );
    		}
    	}
    	self cac_selector();
    	if ( !isDefined( self.firstspawn ) )
    	{
    		if ( isDefined( spawnweapon ) )
    		{
    			self initialweaponraise( spawnweapon );
    		}
    		else
    		{
    			self initialweaponraise( weapon );
    		}
    	}
    	else
    	{
    		self seteverhadweaponall( 1 );
    	}
    	self.firstspawn = 0;
    	pixendevent();
    }
    
    self calcweaponoptions( class_num, 2 ); //In the zombies function i shared earlier, class_num is taking the place of the camo_index arg. This doesn't exactly get me any closer.
    

    Thank you. Any help would be appreciated. Remember, i'm looking to return a camo. Not change one. If a player spawns in with a diamond camo, i wanna know that they have it through my scripts.

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Unread 0
    • Recent
    • Tags
    • Popular
    • Users
    • Groups