• Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse

Plutonium

[Support] Problem handling DVARS. !Help

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
6 Posts 3 Posters 90 Views
    • 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
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to homura 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
  • Ox_undefined Offline
    Ox_undefined Offline
    Ox_
    replied to homura 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
  • homuraundefined Offline
    homuraundefined Offline
    homura Banned
    replied to Ox_ 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

  • Login

  • Don't have an account? Register

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

  • Don't have an account? Register

  • Login or register to search.