PDA

View Full Version : Ammo for regular weapons.


GUInterface
07-28-2009, 03:11 AM
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):

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?

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
I believe the max for it is 500 bulletsIt's 300, including those already loaded in your current weapon.
Am I correct in assuming it's something to do with this line?

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
I'm not too good at programming, so I'd appreciate it if someone lent me a hand.
replace
if player.Ammo.VampGun < player.s_SubClass.MaxAmmo.VampGun
by
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)