Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   Mods (http://forum.fulqrumpublishing.com/forumdisplay.php?f=143)
-   -   Ammo for regular weapons. (http://forum.fulqrumpublishing.com/showthread.php?t=8420)

GUInterface 07-28-2009 03:11 AM

Ammo for regular weapons.
 
Hello,

I was bothered by the fact that the game stops giving you ammo for the WWI weapons once you finish Chapter 5, so I decided to open up the game files and see if I could change this.

I managed to fix the problem by making every level after Chapter 5 start the player with every weapon (except those unlocked by challenges) and have the vampiric weapon ammo packs give ammo for the regular weapons too. Vampiric machinegun ammo gives ammo for the minigun, regular machinegun and vampiric submachinegun. Vampiric shotgun ammo also gives shells for the regular shotgun. Huge vampiric ammo cache gives ammunition for every single weapon.

This all works fine, however, if the player has max ammo for a vampiric weapon then it won't be picked up even if he doesn't have full ammo for a normal weapon. For example, if I have 550 bullets for the vampiric submachinegun (the max for that weapon) and 50 for the minigun (I believe the max for it is 500 bullets) then the ammo won't be picked up no matter what. The only way to fix it is by wasting a bullet of the vampiric weapon then the ammo will be picked up and added to both types of weapons.

I'm going to assume that this has something to do with a line of coding in the ammo files (this one is for the submachinegun ammo):

Code:

o.Mesh = "Vampgun_ammo"
o.Pack = "VampSMGammo.dat"
o.Scale = 0.003
o.DisabledInVoosh = true
o.RespawnTime = 15
o.AmmoAdd = 50
o.s_SubClass ={}
o.takeDistance = 1.8
o.SaveAfterTake = true
--============================================================================
function o:OnInitTemplate()
    self.CubeMap = nil
    self.DetailMap = nil
    self.NormalMap = nil
    self.Destroy = nil
    self.Impulse = nil
    self:ReplaceFunction("_Synchronize","Synchronize")
    self:ReplaceFunction("Synchronize","nil")
end
--============================================================================
function Ammo_VampGun:OnCreateEntity()
    ENTITY.EnableNetworkSynchronization(self._Entity)
end
--============================================================================
function Ammo_VampGun:OnTake(player)
    if player.Ammo.VampGun < player.s_SubClass.MaxAmmo.VampGun then
            self.TakeFX(player._Entity, self.AmmoAdd)
            GObjects:ToKill(self)
        else
            return false
        end
end
--============================================================================
function Ammo_VampGun:TakeFX(pe,add)
    local player = EntityToObject[pe]
   
    if player then
        player.Ammo.VampGun = player.Ammo.VampGun + add
                player.Ammo.MiniGun  = player.Ammo.MiniGun + add
                player.Ammo.Mp18 = player.Ammo.Mp18 + add 

        player:CheckMaxAmmo()
        if player == Player then player:PickupFX() end
    end

    Templates["Ammo_VampGun.CItem"]:SndEnt("pickup",pe)
end
Network:RegisterMethod("Ammo_VampGun.TakeFX", NCallOn.ServerAndAllClients, NMode.Reliable, "eu")
--============================================================================

Am I correct in assuming it's something to do with this line?

Code:

function Ammo_VampGun:OnTake(player)
    if player.Ammo.VampGun < player.s_SubClass.MaxAmmo.VampGun then
            self.TakeFX(player._Entity, self.AmmoAdd)
            GObjects:ToKill(self)
        else
            return false
        end
end

I'm not too good at programming, so I'd appreciate it if someone lent me a hand.

Thanks in advance.

Gniarf 08-08-2009 07:17 AM

Quote:

Originally Posted by GUInterface (Post 84449)
I believe the max for it is 500 bullets

It's 300, including those already loaded in your current weapon.
Quote:

Originally Posted by GUInterface (Post 84449)
Am I correct in assuming it's something to do with this line?

Code:

function Ammo_VampGun:OnTake(player)
    if player.Ammo.VampGun < player.s_SubClass.MaxAmmo.VampGun then
            self.TakeFX(player._Entity, self.AmmoAdd)
            GObjects:ToKill(self)
        else
            return false
        end
end


Yes
Quote:

Originally Posted by GUInterface (Post 84449)
I'm not too good at programming, so I'd appreciate it if someone lent me a hand.

replace
Code:

if player.Ammo.VampGun < player.s_SubClass.MaxAmmo.VampGun
by
Code:

if (player.Ammo.VampGun < player.s_SubClass.MaxAmmo.VampGun) or (player.Ammo.MiniGun < player.s_SubClass.MaxAmmo.MiniGun) or (player.Ammo.Mp18 < player.s_SubClass.MaxAmmo.Mp18) then
note: I don't mind helping, but due to current state of surgery technology (especially anti-rejection treatments) I'm NOT going to lend you my hand. :-P
(Oh but I can fetch you one from the nearby cemetery)


All times are GMT. The time now is 03:50 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.