making a weapon still work with no ammo
Posted: Thu Feb 14, 2008 11:11 am
Im having trouble with my weapon, Im using the doom alpha rifle as a weapon and you can toggle the bayonet with secondary fire (either on or off), however you cant use the bayonet when there is no ammo in the standard rifle, is there any way to make it so you can use the bayonet WITHOUT ammo? ive had a crack at it with jumpifnoammo but so far no results. Heres the code:
Code: Select all
actor Rifle : Weapon 10014
{
obituary "%o was shot by %k's rifle."
inventory.pickupmessage "You got the Rifle!"
weapon.selectionorder 1900
weapon.kickback 100
weapon.ammotype "Clip"
weapon.ammouse 1
weapon.ammogive 10
+WEAPON.WIMPY_WEAPON
states
{
Ready:
PRIF A 0 A_JumpIfInventory("bayonetready",1,3)
PRIF A 0 A_jumpifnoammo (2)
PRIF A 1 A_WeaponReady
goto ready
PBAY B 1 A_WeaponReady
goto ready+5
Deselect:
PRIF A 1 A_Lower
loop
Select:
PRIF A 1 A_Raise
loop
Fire:
PRIF A 0 A_jumpifnoammo (8)
PRIF A 0 A_JumpIfInventory("bayonetready",1,7)
PRIF A 3
PRIF A 0 A_playweaponsound("grunt/attack")
PRIF B 0 A_FireBullets (0, 0, 1, 5, "BulletPuff")
PRIF B 3 A_GunFlash
PRIF C 2
PRIF B 4 A_ReFire
goto Ready
PBAY B 4
PBAY C 4
PBAY D 5 A_CustomPunch(5,0,0,"puff")
PBAY C 4
PBAY B 5 A_ReFire
goto ready
Flash:
PSHO E 3 bright A_Light1
PSHO F 2 bright A_Light0
stop
Altfire:
PBAY A 0 A_JumpIfInventory("bayonetready",1,18)
PBAY A 0 A_GiveInventory("bayonetready",1)
PRIF BCDEFGH 1
PBAY MLKJIHGFE 1
goto Ready
PBAY A 0 A_TakeInventory("bayonetready",1)
PBAY EFGHIJKLM 1
PRIF HGFEDCB 1
goto Ready
Spawn:
RIFL A -1
stop
}
}