PleaZEEED HELP with this "Infinite Ammo Bug"
1 1

1 post in this topic

Recommended Posts

Hi, I am very noob with all this coding thing and Lua files. I tried to do some things for adding to the game, some of them asked before in Suggestion forum. 

 

The thing is I managed to do some of them, but find a BIG BUG when I made a Ranged Weapon. At first couldnt shoot with it. Then I thought I fixed some things but instead the weapon became endless ammo. It shoots, it does what was supossed to do in the rest of things, but the ammo don't decrease. Then I messed all up in the ReloadUtil file and ... well, I am a bit lost.

 

At first I tried to make the weapon use the same pistol clip as the default gun, but couldnt do it to reload, so I made a new item, SBerettaclip (it is almost the same as default but with a change in name and I get it from Necroforge spawning by this moment).

 

Here are the Items as part of WeaponsGuns txt file in the folder scripts: 

 

module Compilation

{
    imports
    {
        Base, 
    }
/************************ITEMS************************/
item SBerettaClip
{
CanStack = FALSE,
DisplayName = S9mm Magazine,
Icon = SBerettaClip,
Type = Normal,
Weight = 0.2,
}
 
/************************WEAPONS************************/
 
item Silencedpistol
 
{ AimingPerkCritModifier = 10,
AimingPerkHitChanceModifier = 15,
AImingPerkMinAngleModifier = 0.05,
AimingTime = 45,
AmmoType = SBerettaClip,
ClipSize = 15,
ConditionLowerChanceOneIn = 50,
ConditionMax = 10,
CriticalChance = 20,
DisplayName = Silenced Pistol,
DoorDamage = 5,
HitChance = 45,
Icon = Silencedpistol,
ImpactSound = null,
IsAimedFirearm = TRUE,
KnockBackOnNoDeath = TRUE,
KnockdownMod = 2,
MaxDamage = 2.5,
MinDamage = 1,
MinAngle = 0.5,
MaxRange = 15,
MinRange = 0.61,
MinimumSwingTime = 0.6,
MaxHitCount = 1,
MultipleHitConditionAffected = FALSE,
NPCSoundBoost = 1.5,
ProjectileCount = 1,
PushBackMod = 0.3,
RecoilDelay = 20,
ReloadTime = 10,
RequiresEquippedBothHands = FALSE,
RunAnim = Run_weapon2,
Ranged = TRUE,
ShareDamage = FALSE,
SoundGain = 1.5,
SoundRadius = 40,
SoundVolume = 40,
SplatBloodOnNoDeath = TRUE,
SplatNumber = 2,
SplatSize = 3,
SubCategory = Firearm,
SwingAnim = Handgun,
SwingTime = 0.6,
SwingSound = pistoldistant2,
SwingAmountBeforeImpact = 0,
Type = Weapon,
ToHitModifier = 1.5,
UseEndurance = FALSE,
WeaponSprite = Handgun,
WeaponWeight = 2.2,
Weight = 2.2,
}
 
And here is the CompilationReloadUtil lua file put in the folder lua/shared/Reloading:
require "Reloading/ISReloadManager"
require "Reloading/ISReloadUtil"
 
 
local Silencedpistol = { name = getItemText("Silenced Pistol"), 
moduleName = 'Compilation',
reloadClass = 'ISSemiAutoWeapon',
ammoType = 'SBerettaClip',
clipName = 'S9mm Magazine',
clipIcon = 'SBerettaClip',
clickSound = 'stormy9mmClick',
ejectSound = 'stormy9mmClipEject',
insertSound = 'stormy9mmClipLoad',
rackSound = 'stormy9mmRack',
containsClip = 1,
rackTime = 10,
reloadTime = 30
clipData = pistolClip };
 
local SBerettaClip = { name = getItemText("SBerettaClip"), 
moduleName = 'Compilation',
reloadClass = 'ISReloadableMagazine',
clipType = 'SBerettaClip',
ammoType = 'Bullets9mm', 
shootSound = 'none',
clickSound = nil,
ejectSound = 'none',
insertSound = 'stormyRevolverInsertRound',
rackSound = 'stormyRevolverInsertRound',
containsClip = 0,
maxCapacity = 15, 
reloadTime = 40, 
rackTime = 10}; 
 
 
ReloadUtil:addWeaponType(Silencedpistol)
ReloadUtil:addMagazineType(SBerettaClip)
 
Can somebody pleazeeeeed help me with this mess?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1