Home   Help Search Login Register  

Author Topic: Help!!! Querying magazines  (Read 1080 times)

0 Members and 1 Guest are viewing this topic.

Lone-Wolf

  • Guest
Help!!! Querying magazines
« on: 13 Apr 2009, 01:22:47 »
I am writing a short script to get that Glock pistol working like it should...
And I mean a player action to put on and take off the silencer.  :D

However, I've run into that pesky problem of the two magazine types: glockmag and glocksmag

I have NO IDEA how I can query the number of magazines of a given type in the player's inventory.  ???
i.e. What do I type to find out how many "glockmag" magazines are in the player inventory, for instance?

Can anyone help?

Thanks in advance,
      Lone-Wolf

Walter_E_Kurtz

  • Guest
Re: Help!!! Querying magazines
« Reply #1 on: 13 Apr 2009, 02:25:42 »
NumberOfMagazines = {_x == "GlockMag"} count (Magazines player)

Note that this only counts the number of clips carried, not how much ammunition is in each. If you swap them one-for-one, it's possible for the player to game the system by running the script to replenish every mag. Most people in the past have removed one clip from the player each time, by assuming that at least one mag is likely to be mostly empty. Because this was generally done for primary weapons, it seems fair. For handguns, when you can carry at most 4 clips, this might be a bit harsh.

Lone-Wolf

  • Guest
Re: Help!!! Querying magazines
« Reply #2 on: 13 Apr 2009, 21:24:16 »
Okay, I got it working perfectly.

Fantastic, thanks!  :good:

However, I encountered some errors that seemed to be a problem with the OpFlash engine.  ::) If you change the player's weapon via scripting, then if the player drops the new weapon, all their pistol ammo (if any) disappears.

Anyone else experienced this???
« Last Edit: 15 Apr 2009, 17:54:08 by Lone-Wolf »

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: Help!!! Querying magazines
« Reply #3 on: 19 Apr 2009, 20:21:13 »
It is not a bug. If you drop a weapon the magazines associated with that weapon are droped with the weapon. If someone them pick that weapon up, they get all the magazines also.