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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. Grabbing Current Offhand...

Grabbing Current Offhand...

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
3 Posts 2 Posters 374 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

    Similar to my "Grabbing A Weapon's Camo..." post, i want to be able to return your current TACTICAL grenade. getcurrentoffhand() grabs your lethal, and i believe your tactical but only if you don't have any lethals. This isn't what i want, i want to be able to grab tactical grenades from your player.

    getsecondaryoffhandclass() Certainly sounds like what i'm looking for, but it returns "smoke" and that's it. I can't find this function anywhere in the dumps either, making it built-in so i'm unable to see the source code for it. Dead end here.

    I have thought of doing a check using self hasweapon("weapon_name"); and then using that, but i haven't tested it. You could do this with all of the equipment and it might work. I'm unsure.

    Something like this probably.

    if(self hasweapon("proximity_grenade_mp") || self hasweapon("tactical_insertion_mp") //Etc etc
    

    There also may be a way to do this by using GetWeaponsList().

    I.E:

    	foreach( weapon in self GetWeaponsList())
    	{
    		if( issubstr( weapon, "proximity" ) || issubstr( weapon, "insertion" ) || issubstr( weapon, "sensor" ) || issubstr( weapon, "hack" ) || issubstr( weapon, "trophy" ) || issubstr( weapon, "emp" ) || issubstr( weapon, "willy" ) || issubstr( weapon, "flash" ) || issubstr( weapon, "concussion" ) )
    		{
    			self.tac = weapon;
                    }
          }
    

    I have tested this already and it didn't work out. Perhaps i have the wrong idea here. Thank you for any help you can offer me. I also apologize for the rapid threads, but i think they all needed their own space. If not, any mods can feel free to take all three of my threads and put them together. I don't mind. It's 3:21AM and i gotta get to sleep. Night y'all. Thank you again.

    1 Reply Last reply
    0
    • birchyundefined Offline
      birchyundefined Offline
      birchy
      wrote on last edited by birchy
      #2

      The class of tacticals is the same as the class of lethals, namely weapon_grenade. Could you specify your use case as there's one or two different trains of thought with approach.

      Deicideundefined 1 Reply Last reply
      0
      • birchyundefined birchy

        The class of tacticals is the same as the class of lethals, namely weapon_grenade. Could you specify your use case as there's one or two different trains of thought with approach.

        Deicideundefined Offline
        Deicideundefined Offline
        Deicide
        wrote on last edited by Deicide
        #3

        birchy said in Grabbing Current Offhand...:

        The class of tacticals is the same as the class of lethals, namely weapon_grenade. Could you specify your use case as there's one or two different trains of thought with approach.

        I'm trying to develop a function to refill grenades, both lethal and tactical to their original amounts from when you spawned.

        Edit: I found a solution to this issue. Ill post it now. This script seems to work just fine. Be sure to include maps/mp/gametypes/_weapons. 👍

        ReloadmyfuckinggrenadesNOW()
        {
            primary_weapons = self getweaponslistprimaries();
            offhand_weapons_and_alts = array_exclude( self getweaponslist( 1 ), primary_weapons );
            arrayremovevalue( offhand_weapons_and_alts, "knife_mp" );
            offhand_weapons_and_alts = array_reverse( offhand_weapons_and_alts );
            self playsound( "fly_equipment_pickup_npc" );
            self playlocalsound( "fly_equipment_pickup_plr" );
            loadout_primary = self loadout_get_offhand_weapon( "primarygrenade" );
            loadout_primary_count = self loadout_get_offhand_count( "primarygrenadecount" );
            loadout_secondary = self loadout_get_offhand_weapon( "specialgrenade" );
            loadout_secondary_count = self loadout_get_offhand_count( "specialgrenadeCount" );
            i = 0;
            while ( i < offhand_weapons_and_alts.size )
            {
                weapon = offhand_weapons_and_alts[ i ];
                if ( maps\mp\gametypes\_weapon_utils::ishackweapon( weapon ) )
                {
                    i++;
                    continue;
                }
                switch ( weapon )
                {
                    case "satchel_charge_mp":
                        if ( self maps/mp/gametypes/_weaponobjects::anyobjectsinworld( weapon ) )
                        {
                            break;
                        }
                    case "bouncingbetty_mp":
                    case "claymore_mp":
                    case "frag_grenade_mp":
                    case "hatchet_mp":
                    case "sticky_grenade_mp":
                        if ( isDefined( self.grenadetypeprimarycount ) && self.grenadetypeprimarycount < 1 )
                        {
                            break;
                        }
                    case "concussion_grenade_mp":
                    case "emp_grenade_mp":
                    case "flash_grenade_mp":
                    case "nightingale_mp":
                    case "pda_hack_mp":
                    case "proximity_grenade_mp":
                    case "sensor_grenade_mp":
                    case "tabun_gas_mp":
                    case "trophy_system_mp":
                    case "willy_pete_mp":
                        if ( isDefined( self.grenadetypesecondarycount ) && self.grenadetypesecondarycount < 1 )
                        {
                            break;
                        }
                        maxammo = weaponmaxammo( weapon );
                        stock   = self getweaponammostock( weapon );
                        if ( weapon == loadout_primary )
                        {
                            maxammo = loadout_primary_count;
                        }
                        else if ( weapon == loadout_secondary )
                        {
                            maxammo = loadout_secondary_count;
                        }
                        if ( stock < maxammo )
                        {
                            ammo = stock + 4;
                            if ( ammo > maxammo )
                            {
                                ammo = maxammo;
                            }
                            self setweaponammostock( weapon, ammo );
                        }
                        break;
                }
                i++;
            }
        }
        

        Have fun! This post may be closed or marked as answered.

        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