• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Weapon/Ammo Pickup glitch(?)

ToiletDuckie

Grizzled Veteran
Aug 22, 2006
59
0
I'll try to keep this one short.

I created a "new" gun... again. It's just a modified STG firing modified Panzerfaust rounds, with a modified ammo amount (5 instead of 32). I have all of the appropriate .uc files modified/syntactically correct, including the ones for ammo, ammopickup, and ammopouch.

Everything compiles just fine, 0 errors. Had to work a few out, mind you, but no errors. I then proceeded to quickly edit a map and allow this gun as a spawnable class.

Now, here's where the weirdness begins. If I spawn as a different class, drop my gun, and summon the new gun, I can pick it up with the correct text display/etc. However, if I summon the ammopickup for the gun, it appears, but when I pick it up.. nothing happens. I get a "you got the ammo" message, but my clip counter stays at 0. I can pick up 10 ammo pouches, still no ammo. If I drop my gun after picking them up, no ammo appears alongside the gun.

On the other hand, if I spawn as a player with the gun, the gun is there, ammo intact, and proper number of clips are present. It can fire and reload just fine. Yet, if I summon the ammo pack, picking it up gives no ammo. If I drop the gun I spawned with, an ammo pouch falls to the ground, same name/messages/etc. as the ones you summon.. yet I can re-pick it up and recieve ammo AND I can pick it up with a summoned gun and recieve ammo.

It sounds vaguely like my AmmoPickup class has some zany error in it.. but if that was the case, how can I drop ammo from the gun I spawned with and pick it back up, since that counts as an ammo pickup ?
 
As far as I can tell, yes. Err, I mean, I don't think I'm forgetting anything.

I only altered a few variables here and there.. the base code is identical to any other gun. Comparing, say, my N44ammo.uc to the PPsh43ammo.uc looks like a mirror image, except mine has a different ItemName and PickupClass... and even then, its still basically the same.

Likewise, a quick comparison of N44ammopickup and PPSh43ammopickup reveals the same situation. Identical code, just a name or two swapped here (and the ammo amount, of course).

That's what has be so confused. The ammo/ammpickup "looks" perfectly correct... and when I spawn with the gun and drop it, thereby creating an ammo pickup on the ground, that ammo pickup works flawlessly. Yet, if I spawn an ammo pickup by itself, it doesn't work... despite every other gun I've attempted to tweak working with ammopickups...



Ooooh new information. It looks like I didn't do anything "wrong" after all. I simply failed to test properly.

Apparently, it doesn't matter what gun you choose.. if you spawn a gun via its _____Pickup , it comes with 0 mags and 0 loaded. More importantly, if you attempt to spawn yourself ammo for the gun via ____AmmoPickup, it will spawn an ammo pouch, let you grab it, and give you 0 ammo. This applies to my N44 gun, my MP40 variant, and even a standard unaltered RO Kar98.
I hadn't realized this before because I would test each gun by spawning with its "base" gun, i.e. testing my kar98 faust by spawning with a rifle, because it was "convenient" to have the ammo already lying there to be picked up.

So, I guess this wasn't a glitch at all... just something in the code... although I don't fully understand why spawning perfectly valid ammo doesn't give you ammo.. but it lets you pick it up and gives you all of the messages. Hmph.
 
Last edited:
Upvote 0