Weapon does not consume ammo.

Discuss all aspects related to modding Zandronum here.
Post Reply
ninja2000
 
Posts: 25
Joined: Fri Aug 03, 2012 3:10 pm

Weapon does not consume ammo.

#1

Post by ninja2000 » Tue Mar 17, 2015 7:05 am

I have no idea what is going wrong. The weapon should use ammo. But its not doing like so. Any suggestions?

Code: Select all

Actor HellstormCannon : Weapon
{
  Obituary "%o was obliterated by %k's HellStorm Cannon!"
  Weapon.SelectionOrder 2500
  Weapon.AmmoType "ImpactGrenade"
  Weapon.AmmoUse 1
  Weapon.AmmoGive 8
  +Weapon.NoAutoFire
  +Weapon.NoAutoAim
  Inventory.PickupMessage "You got the HellStorm Cannon!"
  States
  {
  Ready:
    HSTM B 1 A_WeaponReady
    Loop
  Deselect:
    HSTM B 1 A_Lower
    Loop
  Select:
    HSTM B 1 A_Raise
    Loop
  Fire:
    HSTM C 4 Bright A_GunFlash
    HSTM D 0 Bright A_PlayWeaponSound("HellStorm/Fire")
    HSTM D 0 Bright A_FireCustomMissile("HellStormBomb1", Random(-9, 9), 0, 0, 0, 0, Random(-2, 6))
    HSTM D 0 Bright A_FireCustomMissile("HellStormBomb5", Random(-9, 9), 0, 0, 0, 0, Random(-2, 6))
    HSTM D 0 Bright A_FireCustomMissile("HellStormBomb2", Random(-9, 9), 0, 0, 0, 0, Random(-2, 6))
    HSTM D 0 Bright A_FireCustomMissile("HellStormBomb6", Random(-9, 9), 0, 0, 0, 0, Random(-2, 6))
    HSTM D 0 Bright A_FireCustomMissile("HellStormBomb3", Random(-9, 9), 0, 0, 0, 0, Random(-2, 6))
    HSTM D 0 Bright A_FireCustomMissile("HellStormBomb7", Random(-9, 9), 0, 0, 0, 0, Random(-2, 6))
    HSTM D 0 Bright A_FireCustomMissile("HellStormBomb4", Random(-9, 9), 0, 0, 0, 0, Random(-2, 6))
    HSTM D 5 Bright A_FireCustomMissile("HellStormBomb8", Random(-9, 9), 0, 0, 0, 0, Random(-2, 6))
    HSTM EF 6 Bright
    HSTM B 6
    HSTM B 20 A_PlaySoundEx("HellStorm/Reload", "SoundSlot6", 0)
    Goto Ready
  Flash:
    TNT1 A 1
    Stop
  Spawn:
    HSTM A -1
    Stop
  }
}

Actor HellStormBomb1
{
  Radius 11
  Height 8
  Speed 35
  Damage 8
  Gravity 0.3
  Scale 0.5
  Projectile
  -NoGravity
  DeathSound "HellStorm/Hit"
  Decal RevenantScorch
  States
  {
  Spawn:
    HSBM A 1 Bright
    Loop
  Death:
    MISL B 0 Bright A_ChangeFlag("NoGravity", 1)
    MISL B 8 Bright A_Explode(64, 80, 1, 1)
    MISL C 6 Bright
    MISL D 4 Bright
    Stop
  }
}

Actor HellStormBomb2 : HellStormBomb1
{
  Speed 34
  Gravity 0.28
}

Actor HellStormBomb3 : HellStormBomb1
{
  Speed 33
  Gravity 0.26
}

Actor HellStormBomb4 : HellStormBomb1
{
  Speed 32
  Gravity 0.24
}

Actor HellStormBomb5
{
  Radius 11
  Height 8
  Speed 45
  Damage 8
  Gravity 0.3
  Scale 0.5
  Projectile
  -NoGravity
  DeathSound "Nodeathsound/sorry"
  Decal RevenantScorch
  States
  {
  Spawn:
    HSBM A 1 Bright
    Loop
  Death:
    MISL B 0 Bright A_ChangeFlag("NoGravity", 1)
    MISL B 8 Bright A_Explode(64, 80, 1, 1)
    MISL C 6 Bright
    MISL D 4 Bright
    Stop
  }
}

Actor hellstormbomb6 : hellstormbomb5
{
  Speed 34
  Gravity 0.28
}

Actor hellstormbomb7 : hellstormbomb5
{
  Speed 33
  Gravity 0.26
}

Actor hellstormbomb8 : hellstormbomb5
{
  Speed 32
  Gravity 0.24
}


Actor ImpactGrenade : Ammo
{
  Inventory.PickupMessage "You got some impact grenades."
  Inventory.Amount 4
  Inventory.MaxAmount 40
  Ammo.BackpackAmount 4
  Ammo.BackpackMaxAmount 80
  Inventory.Icon "HSBMA7A3"
  States
  {
  Spawn:
    HSAM A -1
    Stop
  }
}

Actor ImpactGrenadeBox : ImpactGrenade
{
  Inventory.PickupMessage "You got a box of impact grenades."
  Inventory.Amount 10
  States
  {
  Spawn:
    HSAM B -1
    Stop
  }
}
@EDIT

I've found the isse. One part of "Fire:" should look like this"

Code: Select all

HSTM D 5 Bright A_FireCustomMissile("HellStormBomb8", Random(-9, 9), 1, 0, 0, 0, Random(-2, 6))
Last edited by ninja2000 on Tue Mar 17, 2015 7:25 am, edited 1 time in total.

Code: Select all

D:!

User avatar
Dark-Assassin
Maintenence Crew
Posts: 968
Joined: Fri May 25, 2012 4:25 am

RE: Weapon does not consume ammo.

#2

Post by Dark-Assassin » Tue Mar 17, 2015 7:36 am

Your A_FireCustomMissile's 3rd argument is set to 0, which stops the consumption of any ammo for that call.
http://zdoom.org/wiki/A_FireCustomMissile

Code: Select all

A_FireCustomMissile (string missiletype [, angle angle [, bool useammo [, int spawnofs_horz [, int spawnheight [, bool aim[, angle pitch]]]]]])
❗ Don't message me for technical or moderation support.
❔ Use the relevant support channels instead.

Post Reply