ACTOR PerkShotgun : Shotgun replaces Shotgun
{
+WEAPON.NOALERT
decal bulletchip
Weapon.AmmoUse1 0
Weapon.AmmoUse2 0
Weapon.AmmoType1 "Shell"
Weapon.AmmoType2 "ShotgunAmmo"
States
{
Ready:
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,"M3")
TNT1 A 0 A_GiveInventory("FullEmptyShotgun",1)
M3:PKSG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
Loop
Fire:
TNT1 A 0 A_JumpIfInventory("Reloading",1,"ReloadFinish")
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,1)
Goto NoAmmo
TNT1 A 0 A_JumpIfInventory("ShotgunPump",1,1)
Goto NoAmmo
PKSG A 3
PKSG A 1 Offset(0,40) A_FireBullets (5.6, 0, 7, 5, "BulletPuff")
PKSG A 2 Offset(0,36) A_PlaySound("ShotgunFire", CHAN_WEAPON)
TNT1 A 0 A_AlertMonsters
PKSG A 4 Offset(0,33) A_GunFlash
TNT1 A 0 A_TakeInventory("ShotgunPump",1)
TNT1 A 0 A_JumpIfInventory("Reloading",1,"ReloadFinish")
TNT1 A 0 A_JumpIfInventory("ShotgunPump",1,"Ready")
PKSG B 2
PKSG C 1
PKSG D 2
PKSG E 3
TNT1 A 0 A_PlaySound("ShotgunPump")
PKSG F 4
PKSG G 1
//Goto Reload
PKSG H 3
PKSG GFEDCB 2
PKSG A 1
Goto Ready
Reload:
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,"NotFullEmpty")
TNT1 A 0 A_GiveInventory("FullEmptyShotgun",1)
TNT1 A 0 A_GiveInventory("ShotgunPump",1)
Goto AltFire
NotFullEmpty:
TNT1 A 0 A_JumpIfInventory("FullEmptyShotgun",1,"skip")
TNT1 A 0 A_TakeInventory("ShotgunAmmo",1)
skip:TNT1 A 0 A_GiveInventory("ShotgunPump",1)
TNT1 A 0 A_TakeInventory("FullEmptyShotgun",1)
PKSG H 3
PKSG GFEDCB 2
PKSG A 1
PKSG A 7
Goto Ready
NoAmmo:
PKSG A 15 A_PlaySound("weapons/empty")
Goto Ready
AltFire:
//Reload:
TNT1 A 0 A_JumpIfInventory("Shell",1,1)
Goto Ready
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",8,"Ready")
PKSG ABCDEF 2
TNT1 A 0 A_GiveInventory("Reloading",1)
ReloadRepeat:
TNT1 A 0 A_JumpIfInventory("FullEmptyShotgun",1,"7Shells")
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo", 8, "ReloadFinish")
TNT1 A 0 A_JumpIfInventory("Shell", 1, "Skip7")
Goto ReloadFinish
7Shells:
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo", 7, "ReloadFinish")
TNT1 A 0 A_JumpIfInventory("Shell", 1, 1)
Goto ReloadFinish
Skip7:
TNT1 A 0 A_GiveInventory("ShotgunAmmo", 1)
TNT1 A 0 A_Takeinventory("Shell",1)
TNT1 A 0 A_JumpIfInventory("FullEmptyShotgun",1,"M2")
SGRE ABCDE 1
SGRE F 2 A_PlaySound("insertshell")
SGRE GHIJ 1
PKSG F 5 A_WeaponReady(WRF_NOBOB)
Goto ReloadRepeat
M2:TNT1 A 0 A_TakeInventory("ShotgunPump",1)
SGRE ABCDE 1
SGRE F 2 A_PlaySound("insertshell")
SGRE GHIJ 1
PKSG F 5 A_WeaponReady(WRF_NOBOB)
Goto ReloadRepeat
ReloadFinish:
PKSG FEDCBA 2
TNT1 A 0 A_TakeInventory("Reloading",1)
Goto Ready
Flash:
SHTF B 3 Bright A_Light2
SHTF A 2 Bright A_Light1
Goto LightDone
Deselect:
TNT1 A 0 A_JumpIfInventory("Reloading",1,"Deselect2")
D:SHTG A 1 A_Lower
Goto D
Deselect2:
TNT1 A 0 A_Takeinventory("Reloading",1)
PKSG FEDCBA 2
D2:SHTG A 1 A_Lower
Goto D2
}
}
This is a modified portion of DECORATE, showing only the shotgun. It doesn't work as intended.
I want to set the altfire state to be the reload, which means it'll show the shell inserting sprites first then the pumping sprites always. In the fire state, it automatically pumps the shotgun until it's 0, but the code is buggy.
I'm not that familiar with reloading mechanisms in DECORATE, so I'm asking what should I change to get what I want?
ACTOR PerkShotgun : Shotgun replaces Shotgun
{
+WEAPON.NOALERT
decal bulletchip
Weapon.AmmoUse1 0
Weapon.AmmoUse2 0
Weapon.AmmoType1 "Shell"
Weapon.AmmoType2 "ShotgunAmmo"
States
{
Ready:
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,"M3")
TNT1 A 0 A_GiveInventory("FullEmptyShotgun",1)
M3:PKSG A 1 A_WeaponReady(WRF_ALLOWRELOAD)
Loop
Fire:
TNT1 A 0 A_JumpIfInventory("Reloading",1,"ReloadFinish")
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,1)
Goto NoAmmo
TNT1 A 0 A_JumpIfInventory("ShotgunPump",1,1)
Goto NoAmmo
PKSG A 3
PKSG A 1 Offset(0,40) A_FireBullets (5.6, 0, 7, 5, "BulletPuff")
PKSG A 2 Offset(0,36) A_PlaySound("ShotgunFire", CHAN_WEAPON)
TNT1 A 0 A_AlertMonsters
PKSG A 4 Offset(0,33) A_GunFlash
TNT1 A 0 A_TakeInventory("ShotgunPump",1)
TNT1 A 0 A_JumpIfInventory("Reloading",1,"ReloadFinish")
TNT1 A 0 A_JumpIfInventory("ShotgunPump",1,"Ready")
PKSG B 2
PKSG C 1
PKSG D 2
PKSG E 3
TNT1 A 0 A_PlaySound("ShotgunPump")
PKSG F 4
PKSG G 1
//Goto Reload
PKSG H 3
PKSG GFEDCB 2
PKSG A 1
Goto Ready
Reload:
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",1,"NotFullEmpty")
TNT1 A 0 A_GiveInventory("FullEmptyShotgun",1)
TNT1 A 0 A_GiveInventory("ShotgunPump",1)
Goto AltFire
NotFullEmpty:
TNT1 A 0 A_JumpIfInventory("FullEmptyShotgun",1,"skip")
TNT1 A 0 A_TakeInventory("ShotgunAmmo",1)
skip:TNT1 A 0 A_GiveInventory("ShotgunPump",1)
TNT1 A 0 A_TakeInventory("FullEmptyShotgun",1)
PKSG H 3
PKSG GFEDCB 2
PKSG A 1
PKSG A 7
Goto Ready
NoAmmo:
PKSG A 15 A_PlaySound("weapons/empty")
Goto Ready
AltFire:
//Reload:
TNT1 A 0 A_JumpIfInventory("Shell",1,1)
Goto Ready
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo",8,"Ready")
PKSG ABCDEF 2
TNT1 A 0 A_GiveInventory("Reloading",1)
ReloadRepeat:
TNT1 A 0 A_JumpIfInventory("FullEmptyShotgun",1,"7Shells")
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo", 8, "ReloadFinish")
TNT1 A 0 A_JumpIfInventory("Shell", 1, "Skip7")
Goto ReloadFinish
7Shells:
TNT1 A 0 A_JumpIfInventory("ShotgunAmmo", 7, "ReloadFinish")
TNT1 A 0 A_JumpIfInventory("Shell", 1, 1)
Goto ReloadFinish
Skip7:
TNT1 A 0 A_GiveInventory("ShotgunAmmo", 1)
TNT1 A 0 A_Takeinventory("Shell",1)
TNT1 A 0 A_JumpIfInventory("FullEmptyShotgun",1,"M2")
SGRE ABCDE 1
SGRE F 2 A_PlaySound("insertshell")
SGRE GHIJ 1
PKSG F 5 A_WeaponReady(WRF_NOBOB)
Goto ReloadRepeat
M2:TNT1 A 0 A_TakeInventory("ShotgunPump",1)
SGRE ABCDE 1
SGRE F 2 A_PlaySound("insertshell")
SGRE GHIJ 1
PKSG F 5 A_WeaponReady(WRF_NOBOB)
Goto ReloadRepeat
ReloadFinish:
PKSG FEDCBA 2
TNT1 A 0 A_TakeInventory("Reloading",1)
Goto Ready
Flash:
SHTF B 3 Bright A_Light2
SHTF A 2 Bright A_Light1
Goto LightDone
Deselect:
TNT1 A 0 A_JumpIfInventory("Reloading",1,"Deselect2")
D:SHTG A 1 A_Lower
Goto D
Deselect2:
TNT1 A 0 A_Takeinventory("Reloading",1)
PKSG FEDCBA 2
D2:SHTG A 1 A_Lower
Goto D2
}
}
This is a modified portion of DECORATE, showing only the shotgun. It doesn't work as intended.
I want to set the altfire state to be the reload, which means it'll show the shell inserting sprites first then the pumping sprites always. In the fire state, it automatically pumps the shotgun until it's 0, but the code is buggy.
I'm not that familiar with reloading mechanisms in DECORATE, so I'm asking what should I change to get what I want?
Link to the mod I'm modifying
Share this post
Link to post