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

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. if( issubstr( weapon, "upgraded" ) ) help

if( issubstr( weapon, "upgraded" ) ) help

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
6 Posts 4 Posters 518 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.
  • Meat Missileundefined Offline
    Meat Missileundefined Offline
    Meat Missile
    wrote on last edited by Meat Missile
    #1

    Im working on something, I can be a bit of a dummy. Let's say I have a mp5k_zm, I upgrade it and it comes back as mp5k_upgraded_zm, how can I use...

    if( issubstr( weapon, "upgraded" ) ) {
        return "upgraded";
    }
    

    to return the original weapon name where the weapon is still upgraded but will still check as mp5k_zm I have tried get_base_name( weapon ) it's just a big headache just trying to cut some of the code in half, I was told you can do it with if( issubstr ) and help will be amazing

    JezuzLizardundefined 1 Reply Last reply
    0
    • Resxtundefined Offline
      Resxtundefined Offline
      Resxt
      Plutonium Staff
      wrote on last edited by
      #2

      Please stop posting questions in the release section.
      "How do I do X" is NOT a release that you share.

      You should be able to do it with subStr(weapon, "upgraded")[0]

      Meat Missileundefined 1 Reply Last reply
      0
      • Meat Missileundefined Meat Missile

        Im working on something, I can be a bit of a dummy. Let's say I have a mp5k_zm, I upgrade it and it comes back as mp5k_upgraded_zm, how can I use...

        if( issubstr( weapon, "upgraded" ) ) {
            return "upgraded";
        }
        

        to return the original weapon name where the weapon is still upgraded but will still check as mp5k_zm I have tried get_base_name( weapon ) it's just a big headache just trying to cut some of the code in half, I was told you can do it with if( issubstr ) and help will be amazing

        JezuzLizardundefined Offline
        JezuzLizardundefined Offline
        JezuzLizard
        Plutonium Staff
        wrote on last edited by
        #3

        Meat Missile The pattern for defined weapons is pretty simple. It's <weaponname> + "_zm"(except for some special weapons, Treyarch is braindead) or if its upgraded <weaponname> + "upgraded" + "_zm.

        I would do a strTok( weapon, "" ) and rebuild the string without the upgraded part. You can concatenate strings with "" to rebuild the string in a for loop.

        1 Reply Last reply
        0
        • Resxtundefined Resxt

          Please stop posting questions in the release section.
          "How do I do X" is NOT a release that you share.

          You should be able to do it with subStr(weapon, "upgraded")[0]

          Meat Missileundefined Offline
          Meat Missileundefined Offline
          Meat Missile
          wrote on last edited by
          #4

          Resxt Sorry Im bad at reading forums like this

          1 Reply Last reply
          0
          • JuiceTrailer62undefined Offline
            JuiceTrailer62undefined Offline
            JuiceTrailer62
            wrote on last edited by
            #5

            base = get_base_weapon_name( weapon, issubstr( weapon, "upgraded" ) );

            1 Reply Last reply
            0
            • JuiceTrailer62undefined Offline
              JuiceTrailer62undefined Offline
              JuiceTrailer62
              wrote on last edited by
              #6
              has_weapon( weapon ) {
                  if( self has_weapon_or_upgrade( weapon ) ) {
                      if( is_weapon_upgraded( weapon ) ) {
                          return true;
                      }
                      else {
                          return true;
                      }
                  }
                  return false;
              }```
              This works better and I actually tested this
              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