Here's an example in decorate I did for a mod I worked on called NZDE, it has the behaviour you wish to emulate.
Code: Select all
Actor Kar98k : Weapon 10043
{
Weapon.KickBack 0
Weapon.AmmoType1 "In_Kar"
Weapon.AmmoType2 "Reserve_Kar"
Weapon.AmmoGive1 5
Weapon.AmmoGive2 9999
Weapon.AmmoUse 1
Inventory.PickupMessage "Kar98k"
Inventory.PickupSound "misc/w_pkup"
Weapon.SelectionOrder 1400
Weapon.Slotnumber 1
+AMMO_OPTIONAL
+NOAUTOFIRE
Radius 1
Height 1
States
{
Spawn:
KAR9 Z -1
Loop
Ready:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSmode",1)
TNT1 A 0 A_JumpIfInventory("reload",1,"Reload")
TNT1 A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
TNT1 A 0 A_JumpIfInventory("throwspec",1,"ThrowSpecial")
KAR9 A 0 A_JumpIfInventory("knife",1,"Knife")
KAR9 A 1 A_WeaponReady
Loop
Ready.ADS:
TNT1 A 0 A_JumpIfInventory("reload",1,"Reload")
TNT1 A 0 A_JumpIfInventory("thrownade",1,"ThrowGrenade")
TNT1 A 0 A_JumpIfInventory("throwspec",1,"ThrowSpecial")
KAIM A 0 A_JumpIfInventory("knife",1,"Knife")
KAIM A 1 A_WeaponReady
Loop
Deselect:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
KAR9 A 0 A_JumpIfInventory("SpeedCola",1,"Deselect.SpeedSwitch")
KAR9 A 1 A_Lower
KAR9 A 1 A_Lower
KAR9 A 0 A_Lower
Loop
Deselect.SpeedSwitch:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
KAR9 A 1 A_Lower
KAR9 A 0 A_Lower
KAR9 A 0 A_Lower
Loop
Select:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
KAR9 A 0 A_JumpIfInventory("SpeedCola",1,"Select.SpeedSwitch")
KAR9 A 1 A_Raise
KAR9 A 1 A_Raise
KAR9 A 0 A_Raise
Loop
Select.SpeedSwitch:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
KAR9 A 1 A_Raise
KAR9 A 0 A_Raise
KAR9 A 0 A_Raise
Loop
Fire:
KAR9 A 0 A_JumpIfInventory("K98KZoomed",1,"Fire.ADS")
TNT1 A 0 A_JumpIfNoAmmo("Reload")
TNT1 A 0 A_JumpIfInventory("DoubleTap",1,"Fire.DoubleTap")
TNT1 A 0 A_PlayWeaponSound("weapons/kar")
TNT1 A 0 A_ZoomFactor(0.98)
TNT1 A 0 ACS_ExecuteAlways(253,0,random(-2,3),0,0)
TNT1 A 0 A_SpawnItemEx("GunSmoke",12,0,36,1,0,1,0)
TNT1 A 0 A_Jump(200,3)
KAR9 A 1 A_FireBullets(1,1,-1,95,"GunSmoke")
TNT1 A 0 A_Jump(256,2)
KAR9 A 1 A_RailAttack(95,0,1,none,none,1,0,"GunSmoke")
TNT1 A 0 A_ZoomFactor(0.95)
KAR9 E 1 BRIGHT A_Light2
TNT1 A 0 A_ZoomFactor(0.98)
KAR9 F 1 BRIGHT A_Light1
KAR9 A 1 A_ZoomFactor(1)
KAR9 A 16
TNT1 A 0 A_PlaySound("weapons/karcyc")
KAR9 ABC 3
TNT1 A 0 A_SpawnItemEx("Casing_Rifle",12,2,36,0,random(1,2),random(2,3),0)
KAR9 D 4
KAR9 CBA 3
KAR9 A 8
KAR9 A 2 A_WeaponReady
Goto Ready
Fire.ADS:
TNT1 A 0 A_JumpIfNoAmmo("Reload")
TNT1 A 0 A_JumpIfInventory("DoubleTap",1,"Fire.DoubleTap.ADS")
TNT1 A 0 A_PlayWeaponSound("weapons/kar")
TNT1 A 0 A_ZoomFactor(0.98)
TNT1 A 0 ACS_ExecuteAlways(253,0,random(-2,3),0,0)
TNT1 A 0 A_SpawnItemEx("GunSmoke",12,0,36,1,0,1,0)
TNT1 A 0 A_Jump(200,3)
KAIM A 1 A_FireBullets(1,1,-1,95,"GunSmoke")
TNT1 A 0 A_Jump(256,2)
KAIM A 1 A_RailAttack(95,0,1,none,none,1,0,"GunSmoke")
TNT1 A 0 A_ZoomFactor(0.95)
KAIM B 1 BRIGHT A_Light2
TNT1 A 0 A_ZoomFactor(0.98)
KAIM B 1 BRIGHT A_Light1
KAIM A 1 A_ZoomFactor(1)
KAR9 A 16
TNT1 A 0 A_PlaySound("weapons/karcyc")
KAR9 ABC 3
TNT1 A 0 A_SpawnItemEx("Casing_Rifle",12,2,36,0,random(1,2),random(2,3),0)
KAR9 D 4
KAR9 CBA 3
KAR9 A 8
KAR9 A 1 A_ZoomFactor(1.6)
KAR9 A 1 A_WeaponReady
Goto Ready.ADS
AltFire:
TNT1 A 0 A_JumpIfNoAmmo("Reload")
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("K98KZoomed",1,8)
TNT1 A 0 A_Giveinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.6)
TNT1 A 0 A_Giveinventory("K98KADSMode",1)
K98A A 1
Goto Ready.ADS
TNT1 AAAAAA 0
K98A A 1
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
Goto Ready
Fire.DoubleTap:
TNT1 A 0 A_PlayWeaponSound("weapons/kar")
TNT1 A 0 A_ZoomFactor(0.98)
TNT1 A 0 ACS_ExecuteAlways(253,0,random(-2,3),0,0)
TNT1 A 0 A_SpawnItemEx("GunSmoke",12,0,36,1,0,1,0)
KAR9 A 1 A_FireBullets(1.3,1.3,-1,105,"GunSmoke")
TNT1 A 0 A_ZoomFactor(0.99)
KAR9 E 1 BRIGHT A_Light2
KAR9 F 1 BRIGHT A_Light1
KAR9 A 1 A_ZoomFactor(1)
KAR9 A 8
TNT1 A 0 A_PlaySound("weapons/karcyc")
KAR9 ABC 2
TNT1 A 0 A_SpawnItemEx("Casing_Rifle",12,2,36,0,random(1,2),random(2,3),0)
KAR9 D 4
KAR9 CBA 2
KAR9 A 4
KAR9 A 1 A_WeaponReady
Goto Ready
Fire.DoubleTap.ADS:
TNT1 A 0 A_PlayWeaponSound("weapons/kar")
TNT1 A 0 A_ZoomFactor(0.98)
TNT1 A 0 ACS_ExecuteAlways(253,0,random(-2,3),0,0)
TNT1 A 0 A_SpawnItemEx("GunSmoke",12,0,36,1,0,1,0)
TNT1 A 0 A_Jump(200,3)
KAIM A 1 A_FireBullets(1,1,-1,95,"GunSmoke")
TNT1 A 0 A_Jump(256,2)
KAIM A 1 A_RailAttack(95,0,1,none,none,1,0,"GunSmoke")
TNT1 A 0 A_ZoomFactor(0.95)
KAIM B 1 BRIGHT A_Light2
TNT1 A 0 A_ZoomFactor(0.98)
KAIM B 1 BRIGHT A_Light1
KAIM A 1 A_ZoomFactor(1)
KAR9 A 8
TNT1 A 0 A_PlaySound("weapons/karcyc")
KAR9 ABC 2
TNT1 A 0 A_SpawnItemEx("Casing_Rifle",12,2,36,0,random(1,2),random(2,3),0)
KAR9 D 4
KAR9 CBA 2
KAR9 A 4
KAR9 A 1 A_ZoomFactor(1.6)
KAR9 A 1 A_WeaponReady
Goto Ready.ADS
Reload:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
TNT1 A 0 A_TakeInventory("reload",1)
TNT1 A 0 A_JumpIfInventory("In_Kar",5,"Ready")
TNT1 A 0 A_JumpIfInventory("Reserve_Kar",1,"ReloadLoop")
Goto Ready
ReloadLoop:
TNT1 A 0 A_JumpIfInventory("In_Kar",5,"Reloading")
TNT1 A 0 A_JumpIfInventory("Reserve_Kar",1,1)
Goto Reloading
TNT1 A 0 A_TakeInventory("Reserve_Kar",1)
TNT1 A 0 A_GiveInventory("In_Kar",1)
Loop
Reloading:
TNT1 A 0 A_JumpIfInventory("SpeedCola",1,"Reloading.SpeedReload")
KAR9 A 1 A_PlaySound("weapons/karrel")
KAR9 ABCD 3
KAR9 D 2 Offset(2,32)
KAR9 D 2 Offset(8,32)
KAR9 D 2 Offset(24,32)
KAR9 D 2 Offset(56,32)
KAR9 D 2 Offset(64,32)
KAR9 G 8 Offset(-32,32)
KAR9 GHIJ 3 Offset(-32,32)
KAR9 D 2 Offset(56,32)
KAR9 D 2 Offset(24,32)
KAR9 D 2 Offset(8,32)
KAR9 D 2 Offset(0,32)
KAR9 D 16
KAR9 DCBA 2
TNT1 A 0 A_TakeInventory("reload",1)
Goto Ready
Reloading.SpeedReload:
KAR9 A 1 A_PlaySound("weapons/karrel")
KAR9 ABCD 2
KAR9 D 2 Offset(2,32)
KAR9 D 2 Offset(8,32)
KAR9 D 2 Offset(24,32)
KAR9 D 2 Offset(56,32)
KAR9 D 2 Offset(64,32)
KAR9 G 4 Offset(-32,32)
KAR9 GHIJ 2 Offset(-32,32)
KAR9 D 2 Offset(56,32)
KAR9 D 2 Offset(24,32)
KAR9 D 2 Offset(8,32)
KAR9 D 2 Offset(0,32)
KAR9 D 8
KAR9 DCBA 1
TNT1 A 0 A_TakeInventory("reload",1)
Goto Ready
ThrowGrenade:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
KAR9 A 0 A_ZoomFactor(1)
KAR9 A 1 Offset(0,32)
KAR9 A 1 Offset(0,40)
KAR9 A 1 Offset(0,56)
KAR9 A 1 Offset(0,72)
TNT1 A 0 Offset(0,32)
TNT1 A 0 A_PlaySound("weapons/grenadepin")
NADE ABCDE 1
TNT1 A 0 A_SpawnItemEx("Casing_Grenade",6,-1,36,random(4,6),random(-1,-2),0,0)
NADE FGH 1
TNT1 A 8
TNT1 A 0 A_PlaySound("weapons/grenadethr")
NADE IJK 1
TNT1 A 0 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
NADE LM 1
KAR9 A 1 Offset(0,72)
KAR9 A 1 Offset(0,56)
KAR9 A 1 Offset(0,40)
KAR9 A 1 Offset(0,32)
TNT1 A 0 A_TakeInventory("thrownade")
Goto Ready
ThrowSpecial:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
TNT1 A 0 A_TakeInventory("throwspec")
TNT1 A 0 A_JumpIfInventory("SpecGrenade_N74ST",1,"ThrowN74ST")
TNT1 A 0 A_JumpIfInventory("SpecGrenade_Molotov",1,"ThrowMolotov")
TNT1 A 0 A_JumpIfInventory("SpecGrenade_BouncingBetty",1,"ThrowBouncingBetty")
Goto Ready
ThrowN74ST:
TNT1 A 0 A_JumpIfInventory("N74STAmmo",1,1)
Goto Ready
TNT1 A 0 A_TakeInventory("N74STAmmo",1)
TNT1 A 0 A_TakeInventory("sights",1)
TNT1 A 0 A_ZoomFactor(1)
KAR9 A 1 Offset(0,32)
KAR9 A 1 Offset(0,40)
KAR9 A 1 Offset(0,56)
KAR9 A 1 Offset(0,72)
TNT1 A 0 Offset(0,32)
TNT1 A 0 A_PlaySound("weapons/grenadepin")
N74S ABCD 1
TNT1 A 2
TNT1 A 0 A_PlaySound("weapons/grenadethr")
NADE ABCDE 1
TNT1 A 0 A_SpawnItemEx("Casing_Grenade",6,-1,36,random(4,6),random(-1,-2),0,0)
NADE FGH 1
TNT1 A 8
TNT1 A 0 A_PlaySound("weapons/grenadethr")
NADE IJK 1
TNT1 A 0 A_FireCustomMissile("ThrownN74ST",0,0,0,0)
NADE LM 1
KAR9 A 1 Offset(0,72)
KAR9 A 1 Offset(0,56)
KAR9 A 1 Offset(0,40)
KAR9 A 1 Offset(0,32)
Goto Ready
ThrowMolotov:
TNT1 A 0 A_JumpIfInventory("MolotovAmmo",1,1)
Goto Ready
TNT1 A 0 A_TakeInventory("MolotovAmmo",1)
KAR9 A 0 A_TakeInventory("sights",1)
KAR9 A 0 A_ZoomFactor(1)
KAR9 A 1 Offset(0,32)
KAR9 A 1 Offset(0,40)
KAR9 A 1 Offset(0,56)
KAR9 A 1 Offset(0,72)
TNT1 A 0 Offset(0,32)
TNT1 A 0 A_PlaySound("weapons/grenadepin")
NADE ABCDE 1
TNT1 A 0 A_SpawnItemEx("Casing_Grenade",6,-1,36,random(4,6),random(-1,-2),0,0)
NADE FGH 1
TNT1 A 8
TNT1 A 0 A_PlaySound("weapons/grenadethr")
NADE IJK 1
TNT1 A 0 A_FireCustomMissile("ThrownMolotov",0,0,0,0)
NADE LM 1
KAR9 A 1 Offset(0,72)
KAR9 A 1 Offset(0,56)
KAR9 A 1 Offset(0,40)
KAR9 A 1 Offset(0,32)
TNT1 A 0 A_TakeInventory("thrownade")
Goto Ready
ThrowBouncingBetty:
TNT1 A 0 A_JumpIfInventory("BouncingBettyAmmo",1,1)
Goto Ready
TNT1 A 0 A_TakeInventory("sights",1)
TNT1 A 0 A_TakeInventory("BouncingBettyAmmo",1)
TNT1 A 0 A_ZoomFactor(1)
KAR9 A 1 Offset(0,32)
KAR9 A 1 Offset(0,40)
KAR9 A 1 Offset(0,56)
KAR9 A 1 Offset(0,72)
TNT1 A 0 Offset(0,32)
TNT1 A 0 A_PlaySound("weapons/grenadepin")
N74S ABCD 1
TNT1 A 2
TNT1 A 0 A_PlaySound("weapons/grenadethr")
NADE ABCDE 1
TNT1 A 0 A_SpawnItemEx("Casing_Grenade",6,-1,36,random(4,6),random(-1,-2),0,0)
NADE FGH 1
TNT1 A 8
TNT1 A 0 A_PlaySound("weapons/grenadethr")
NADE IJK 1
TNT1 A 0 A_FireCustomMissile("BouncingBetty_OnGround",0,0,0,0)
NADE LM 1
KAR9 A 1 Offset(0,72)
KAR9 A 1 Offset(0,56)
KAR9 A 1 Offset(0,40)
KAR9 A 1 Offset(0,32)
Goto Ready
Knife:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
KAR9 A 0 A_JumpIfInventory("Machete",1,"Knife.Machete")
KAR9 A 1 Offset(-16,52)
KAR9 A 1 Offset(-24,60)
KAR9 A 1 Offset(-30,66)
KAR9 A 1 Offset(-32,68)
KAR9 A 1 Offset(-32,84)
KNIF A 1 Offset(0,32)
KNIF A 1 Offset(-4,32)
KNIF A 1 Offset(-12,32)
TNT1 A 0 A_CustomPunch(4,0,0,"KnifeSlash")
KNIF A 1 Offset(-24,32)
KNIF B 1 Offset(-40,32)
KNIF B 1 Offset(-64,32)
KNIF B 1 Offset(-88,32)
TNT1 A 0 A_CustomPunch(4,0,0,"KnifePuff")
KNIF C 1 Offset(-112,32)
KNIF C 1 Offset(-136,32)
KNIF C 1 Offset(-160,32)
TNT1 A 0 A_CustomPunch(6,0,0,"KnifeSlash")
KAR9 A 1 Offset(32,80)
KAR9 A 1 Offset(32,64)
KAR9 A 1 Offset(30,62)
KAR9 A 1 Offset(24,56)
KAR9 A 1 Offset(16,48)
KAR9 A 1 Offset(0,32)
TNT1 A 0 A_TakeInventory("knife",1)
Goto Ready
Knife.Machete:
TNT1 A 0 A_Takeinventory("K98KZoomed",1)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_Takeinventory("K98KADSMode",1)
KAR9 A 1 Offset(-16,52)
KAR9 A 1 Offset(-24,60)
KAR9 A 1 Offset(-30,66)
KAR9 A 1 Offset(-32,68)
KAR9 A 1 Offset(-32,84)
TNT1 A 0 ACS_ExecuteAlways(253,0,random(0,-1),random(3,6),0)
MCHT A 2
MCHT B 2
TNT1 A 0 A_CustomPunch(38,0,0,"KnifeSlash")
MCHT C 2
MCHT D 2
TNT1 A 0 A_CustomPunch(38,0,0,"MachetePuff")
MCHT E 2
MCHT F 2
TNT1 A 0 A_CustomPunch(40,0,0,"KnifeSlash")
KAR9 A 1 Offset(32,80)
KAR9 A 1 Offset(32,64)
KAR9 A 1 Offset(30,62)
KAR9 A 1 Offset(24,56)
KAR9 A 1 Offset(16,48)
KAR9 A 1 Offset(0,32)
TNT1 A 0 A_TakeInventory("knife",1)
Goto Ready
NoAmmo:
KAR9 A 4 A_PlaySound("weapons/noammo")
Goto Ready
}
}
Actor In_Kar : Ammo
{
Inventory.Amount 1
Inventory.MaxAmount 5
}
Actor Reserve_Kar : Ammo
{
Inventory.Amount 1
Inventory.MaxAmount 50
}
Actor K98KZoomed : Inventory
{
inventory.maxamount 1
}
Actor K98KADSMode : Inventory
{
inventory.maxamount 1
}