Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. [Support] Problem handling DVARS. !Help

[Support] Problem handling DVARS. !Help

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
6 Posts 3 Posters 700 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.
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    wrote on last edited by Mr. Android
    #1

    I'm trying to get the player's primary weapon, looking in a guide I found something like this:

    Primaryname = self.PrimaryWeapon;
    

    I tried this too but it doesn't seem to work either

    Primaryname = self.primaryWeapon;
    

    But, what it implements and doesn't seem to work, since I send it to print on one line and it doesn't print.

    self iprintln ("Primary weapon on player is" + Primaryname);
    

    Someone to guide me how to handle this please.

    1 Reply Last reply
    0
    • homuraundefined Offline
      homuraundefined Offline
      homura
      Banned
      wrote on last edited by homura
      #2

      That isn't a DVAR but just a variable (that you are making). If you wanted to grab the current weapon the player is holding, you can do something like this:

      displayWeapon()
      {
          primaryWeapon = self getCurrentWeapon();
      
          self iPrintln("You are currently holding: " + primaryWeapon);
      }
      
      Kalitosundefined 1 Reply Last reply
      0
      • homuraundefined homura

        That isn't a DVAR but just a variable (that you are making). If you wanted to grab the current weapon the player is holding, you can do something like this:

        displayWeapon()
        {
            primaryWeapon = self getCurrentWeapon();
        
            self iPrintln("You are currently holding: " + primaryWeapon);
        }
        
        Kalitosundefined Offline
        Kalitosundefined Offline
        Kalitos
        wrote on last edited by
        #3

        homura said in Problem handling DVARS. !Help:

        getCurrentWeapon();

        I understand, but I also understand that the function gets me the player's current weapon, but not the primary weapon. Because I can have the secondary weapon as my current weapon.

        1 Reply Last reply
        0
        • homuraundefined Offline
          homuraundefined Offline
          homura
          Banned
          wrote on last edited by
          #4

          That's all you can do then as far as I know. self.primaryWeapon works in IW4, I think, and I'm not sure how else you can get it in T6. I looked at the BO3 script docs and I couldn't find anything.

          Ox_undefined 1 Reply Last reply
          0
          • homuraundefined homura

            That's all you can do then as far as I know. self.primaryWeapon works in IW4, I think, and I'm not sure how else you can get it in T6. I looked at the BO3 script docs and I couldn't find anything.

            Ox_undefined Offline
            Ox_undefined Offline
            Ox_
            wrote on last edited by
            #5

            Kalitos said in Problem handling DVARS. !Help:

            homura said in Problem handling DVARS. !Help:

            getCurrentWeapon();

            I understand, but I also understand that the function gets me the player's current weapon, but not the primary weapon. Because I can have the secondary weapon as my current weapon.

            homura said in Problem handling DVARS. !Help:

            That's all you can do then as far as I know. self.primaryWeapon works in IW4, I think, and I'm not sure how else you can get it in T6. I looked at the BO3 script docs and I couldn't find anything.

            You can for example see if the weapon is found in level.primary_weapon_array.
            maps\mp\gametypes\_weapons.gsc has a function for checking it as well:

            isprimaryweapon(weaponname)
            {
            	return isDefined(level.primary_weapon_array[weaponname]);
            }
            

            Alternatively, <player> getloadoutitem(<loadout>, "primary") could be used.

            homuraundefined 1 Reply Last reply
            0
            • Ox_undefined Ox_

              Kalitos said in Problem handling DVARS. !Help:

              homura said in Problem handling DVARS. !Help:

              getCurrentWeapon();

              I understand, but I also understand that the function gets me the player's current weapon, but not the primary weapon. Because I can have the secondary weapon as my current weapon.

              homura said in Problem handling DVARS. !Help:

              That's all you can do then as far as I know. self.primaryWeapon works in IW4, I think, and I'm not sure how else you can get it in T6. I looked at the BO3 script docs and I couldn't find anything.

              You can for example see if the weapon is found in level.primary_weapon_array.
              maps\mp\gametypes\_weapons.gsc has a function for checking it as well:

              isprimaryweapon(weaponname)
              {
              	return isDefined(level.primary_weapon_array[weaponname]);
              }
              

              Alternatively, <player> getloadoutitem(<loadout>, "primary") could be used.

              homuraundefined Offline
              homuraundefined Offline
              homura
              Banned
              wrote on last edited by
              #6

              Ox_
              That's perfect, I did not know about that. Thanks so much, Ox_!

              Kalitos I would suggest trying what Ox_ has posted.

              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
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Donate