Weapons question

Hello!

I was wondering if someone can help me with this, is there any way to reload whatever is the size of the clip and not 12 bullets?

For example:
SNS 6 bullets and not 12
Vintage 7 bullets and not 12

image

One way I can think of, is to manually set the amount of stored bullets the player has to 6 bullets TEMPORARILY. This way, when the gun reloads, it uses whatever bullets are ‘remaining’

SudoCode Example:

--player reloads gun

if number of reserve bullets >= 12 then
   cache value of stored bullets into variable 'cache'
   set reserve bullets to 11, or 10, or 3, or 7 (can make it gun independent)
end

-- Then you can add a reload function here

I don’t know how to delay any impending game functionality (for example, “delay reload until this event happens” so what I’d do is to disable the reload key entirely, and use the native “WasDisabledKeyJustPressed” or something like that. Then you can add your own code in to supplement the remaining reload logic.

Think through it, lmk what you think!

Edit: PS. Don’t forget to return the amount of bullets remaining (and account for how much just got used in the reload!)

That is how it is right now, for example,

SNS Pistol, ammount bullets per clip = 6
IF you reload you get 12 = 6 in the actual clip and 6 more remaining,

What i was trying to do is to remove the remaining bullets in the SNS so i only get 6 and not more, and if the clip is higher than 12, get those remaining bullets to get the full clip reloaded

Im not sure I’m following. Here’s what I’m referring to:
Player has 1000 bullets for EXAMPLE GUN
EXAMPLE GUN takes 20 bullets per clip

Player presses reload key
1000 bullets becomes 6 bullets. (1000 bullets gets cached into variable “cachebull”)
Player reloads remaining 6 bullets into gun
Player has 0 bullets.
Player now has 994 bullets (from cachebull variable minus total reloaded)

Press reload again
Player (once again) goes from 994 bullets to 6 bullets
Player reloads 6 bullets into EXAMPLE GUN
Player now has 0 bullets
Player now has 988 bullets

And so on and so forth.

Now that I explain it, it may be possible to just hard set the count of bullets in their gun once. That’d circumvent the need to do the above, but not sure what natives you have to work with there!

if maxAmmoInClip = 6
whenever you reload get = 6 bullets

if maxAmmoInClip = 12
whenever you reload get = 12 bullets

Always depends on the gun

I was trying this code but only can get 1 weapon to work, any idea on how to get more weapons in there?

Are you saying the default is that it only loads 12 bullets into ANY gun, or are you saying you only want to load a specific amount of bullets into a specific gun?

Sorry, but I’m still confused :frowning:

So the default loads 12 bullets into ANY PISTOL, and im trying to change that between the pistols, if i have a sns it load 6 bullets, if i have a heavy pistol 18 and things like that,

Does it make ssense?

Goootcha!

Okay, so the best thing would be to disable the behavior that’s causing this to happen in the first place, but in case you’re not able, use one of the Get_Weapon_Max_Ammo natives to allow reloading back to it’s full capabilities

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.