Weapon Ammo Use Help Please

Need help with your project? Ask here.
User avatar
Herculine
Posts: 70
Joined: Mon Feb 22, 2010 3:44
Location: Ohio
Contact:

Weapon Ammo Use Help Please

Post by Herculine »

I'm working on a custom weapon (not my first one) and everything is working exactly as it should except...

I can't get the thing to consume ammo. I've compared its code to other weapons that are still working properly but can't figure out why it won't use any ammo when fired:

Code: Select all

Actor FusionRifle : Weapon
{
  Radius 20
  Height 16
  Inventory.PickupSound "misc/w_pkup"
  Inventory.PickupMessage "You got the Fusion Rifle!"
  Obituary "%o was fused by %k"
  weapon.ammotype "Cell"
  weapon.ammogive 100
  weapon.ammouse 5
  weapon.kickback 100
  States
  {
  Spawn:
    STPP A -1
    Loop
  Ready:
    STPO AAABBBCCC 1 Bright A_WeaponReady
    Loop
  Deselect:
    STPO E 1 A_Lower
    Loop
  Select:
    STPO E 1 A_Raise
    Loop
  Fire:
    STPO F 0 Bright A_GunFlash
    STPO F 0 Bright A_FireCustomMissile("FusionShot", Random(0,1),0,0)
	STPO F 0 Bright A_FireCustomMissile("FusionShot", Random(0,1),0,15)
	STPO F 0 Bright A_FireCustomMissile("FusionShot", Random(0,1),0,-15)
	STPO F 0 Bright A_FireCustomMissile("FusionShot", Random(0,1),0,45)
	STPO F 0 Bright A_FireCustomMissile("FusionShot", Random(0,1),0,-45)
	STPO F 0 Bright A_FireCustomMissile("FusionShot", Random(0,1),0,30)
	STPO F 0 Bright A_FireCustomMissile("FusionShot", Random(0,1),0,-30)
    STPO GH 3 Bright
    STPO E 4
    STPO D 6 A_ReFire
    Goto Ready
  Flash:
    TNT1 A 1 A_Light1
    TNT1 A 1 A_Light2
    TNT1 A 1 A_Light1
    TNT1 A 1 A_Light0
    Stop
  }
}

actor FusionShot
{
  Radius 13
  Height 8
  Speed 20
  Damage 10  
  Scale 1.0   
  RENDERSTYLE Add
  PROJECTILE
  Decal PlasmaScorchLower
  states
  {
  Spawn:
    FS03 AB 10 BRIGHT A_SpawnItemEx("FusionTrail", 0, 0, 0, 0, 0, 0, Random(-10, 10), 128)
    Loop
  Death:
    FS03 HIJG 3 BRIGHT
    Stop
  }
}

actor FusionTrail
{
  Radius 4
  Height 8
  Speed 0
  Damage 0
  Scale 1.0 
  RENDERSTYLE Add 
  PROJECTILE
  states
  {
  Spawn:
    TNT0 A 2
    FS03 FG 6 BRIGHT A_FadeOut
    Stop
  }
}
What the heck am I doing wrong?

(I'm testing with v1.5.6 [r1346].)
Blue Shadow
Global Moderator
Global Moderator
Posts: 308
Joined: Sun Aug 29, 2010 6:09

Re: Weapon Ammo Use Help Please

Post by Blue Shadow »

The third parameter for [wiki]A_FireCustomMissile[/wiki] is for ammo consumption; setting it to 1, will make the weapon consume ammo, while setting it to 0 will not make it do that.

The A_FireCustomMissile calls you've got there having this parameter set to zero.
User avatar
Herculine
Posts: 70
Joined: Mon Feb 22, 2010 3:44
Location: Ohio
Contact:

Re: Weapon Ammo Use Help Please

Post by Herculine »

That was indeed the problem; I put my 1s in the wrong place.

Thank you for your help!
Post Reply

Return to “Editing Help”