Is there a way to make ammo give multiple bullets to weapon?

Wed Feb 16, 2022 11:29 am

Is there a way to an ammo give X bullets to weapon A and Y bullets to weapon B?

Basically I want to make the pistol and chaingun weapon use different ammo.
Pistol max ammo would be 44.
And chaingun max ammo would be 156.
When you pick a clip it would give 2 bullets to pistol and 8 bullets to chaingun.
When you pick a box of bullets 11 bullets to pistol and 39 bullets to chaingun.
Picking a chaingun would give 4 bullets to pistol and 16 to chaingun.

Re: Is there a way to make ammo give multiple bullets to wea

Wed Feb 16, 2022 4:46 pm

This can be done in DECORATE with fake items. Like:


Code:
Actor FakeClip : CustomInventory replaces Clip
{
  Radius 12
  Height 8
  Inventory.PickupMessage "You picked up Bullet Clip - +4 Pistol, +8 Chaingun"
  States
  {
  Spawn:
    XXXX A -1
    Stop
  Pickup:
    TNT1 A 1 A_GiveInventory ("PistolBullet", 4)
    TNT1 A 1 A_GiveInventory ("ChainBullet", 8)
    Stop
  }
}


Use that as an example of the Pickup for ammo. Now, you can also do this:

Code:
Actor FakeCGun : CustomInventory replaces Chaingun
{
  Radius 12
  Height 8
  Inventory.PickupMessage "You picked up a Chaingun!"
  States
  {
  Spawn:
    XXXX A -1
    Stop
  Pickup:
    TNT1 A 1 A_GiveInventory ("PistolBullet", 11)
    TNT1 A 1 A_GiveInventory ("ChainBullet", 14)
    TNT1 A 1 A_GiveInventory ("Chaingun")
    Stop
  }
}


See where it says "Replaces Chaingun"? That will swap the Chaingun for your fake item. The "Spawn: XXXX A -1" should have the XXXX part replaced with the correct designation of whatever Sprite is being used.

You'll also have to alter the Pistol and Chaingun themselves to use different ammo. Here's another example:

Code:
ACTOR Chaingun : DoomWeapon
{
   Weapon.SelectionOrder 700
   Weapon.AmmoUse 1
   Weapon.AmmoGive 0
   Weapon.AmmoType "ChainBullet"
   Inventory.PickupMessage "$GOTCHAINGUN" // "You got the chaingun"
   Obituary "$OB_MPCHAINGUN" // "%o was mowed down by %k's chaingun."
   Tag "$TAG_CHAINGUN"
   States
   {
   Ready:
     CHGG A 1 A_WeaponReady
     Loop
   Deselect:
     CHGG A 1 A_Lower
     Loop
   Select:
     CHGG A 1 A_Raise
     Loop
   Fire:
     CHGG AB 4 A_FireCGun
     CHGG B 0 A_ReFire
     Goto Ready
   Flash:
     CHGF A 5 Bright A_Light1
     Goto LightDone
     CHGF B 5 Bright A_Light1
     Goto LightDone
   Spawn:
     MGUN A -1
     Stop
   }
}


See where I replaced the AmmoUse with "ChainBullet"? That will make it use your new ammo. This should get you started.

Re: Is there a way to make ammo give multiple bullets to wea

Wed Feb 16, 2022 4:52 pm

Also, to edit the properties of the Ammo used, int he way you want, let's look at the Pistol Ammo.

This is how it looks normally:
Code:
ACTOR Clip : Ammo
{
  Inventory.PickupMessage "$GOTCLIP" // "Picked up a clip."
  Inventory.Amount 10
  Inventory.MaxAmount 200
  Ammo.BackpackAmount 10
  Ammo.BackpackMaxAmount 400
  Inventory.Icon "CLIPA0"
  States
  {
  Spawn:
    CLIP A -1
    Stop
  }
}


This is what you need to fix up:
Code:
ACTOR PistolBullet : Ammo
{
  Inventory.Amount 0
  Inventory.MaxAmount 44
  Ammo.BackpackAmount 11
  Ammo.BackpackMaxAmount 88
  Inventory.Icon "CLIPA0"
  States
  {
  Spawn:
    CLIP A -1
    Stop
  }
}


See how I edited the MaxAmounts? When combined with the Fake Items we created before, this Ammo type is now recognized as being used with the Pistol. You'll have to make your own version for the Chaingun named "ChainBullet" instead of "PistolBullet" and alter the totals.

You can also make your own Fake "ClipBox" (instead of "replaces clip" it would be "replaces ClipBox") from the first example and set the values as you need.


This isn't the "accepted" and "proper" way to do things - everyone's using ZScript now. But, this should work just fine for a personal mod just for yourself.

Re: Is there a way to make ammo give multiple bullets to wea

Thu Feb 17, 2022 10:21 am

One technical point: picking up a chaingun should not give ammunition to a pistol. Chaingun uses it's own ammo, so I doesnt make any sense to give a pistol ammo when picking up a chaingun.

Re: Is there a way to make ammo give multiple bullets to wea

Thu Feb 17, 2022 4:38 pm

He specified that he wanted this. I gave him the instructions to get it done. I don't feel it does anyone any good to question what or why they want something in a Mod.

Re: Is there a way to make ammo give multiple bullets to wea

Fri Feb 18, 2022 12:38 am

Sure, the point is for OP.

Re: Is there a way to make ammo give multiple bullets to wea

Fri Feb 18, 2022 6:15 pm

ramon.dexter wrote:One technical point: picking up a chaingun should not give ammunition to a pistol. Chaingun uses it's own ammo, so I doesnt make any sense to give a pistol ammo when picking up a chaingun.


I think the pistol is sort of worthless when you have a chaingun and decided to balance things out by making a wad where machine gun and pistol use different ammo.
The max amount of ammo of each weapon was split between pistol and chaingun based at how fast they use bullets while shooting, and the amount of bullets you got when picking a clip and clipbox was split bitween the weapons using the same rules. At my previous wad (or previous version of it), if you got a clip you got only pistol ammo. and if you got a clipbox you got just chaingun ammo.

I decided to change the wad, making sure each ammo will give bullets to both pistol and chaingun (the value they give at normal doom, will still be split between weapons based at how fast the weapon waste bullets). The idea is that sometimes an wad map have tons of bulletbox and 0 clips, and at previous wad would means not being able to get more pistol ammo, same with a map with tons of clips but that have no bulletbox.

NeoTerraNova wrote:He specified that he wanted this. I gave him the instructions to get it done. I don't feel it does anyone any good to question what or why they want something in a Mod.

Thanks for the info and help.