I followed this tutorial which uses sound loops for the shooting sound and when the weapon is deselected mid-fire it's supposed to play the shot echo sound, but any time I deselect the weapon it plays the echo sound, not just when shooting. It's only supposed to play the echo if the player does not have "IsFiring". So I don't understand what's causing it to do this because "IsFiring" is only taken away at the beginning of the fire state but is given back in the ready state.
states
{
Select:
RRLD FFFFFFFFFFFFFFF 1 A_Raise
RRLD FGGHHI 1
loop
Deselect:
//RRLD IHHGG 1
//RRLD FFFFFFFFFFFFFFFFFF 1 A_Lower
ASLT A 1 A_JumpIfInventory("IsFiring", 0, "DeselectMidFire")
Goto DeselectEnd
DeselectMidFire:
ASLT A 0 A_StopSound(CHAN_WEAPON)
ASLT A 0 A_PlaySound("weapons/rifle/echo")
ASLT A 1 A_TakeInventory("IsFiring", 1)
Goto DeselectEnd
DeselectEnd:
ASLT A 0 A_StopSound
RRLD IHHGG 1
RRLD FFFFFFFFFFFFFFFFFF 1 A_Lower
Loop
Ready:
ASLT A 0 A_GiveInventory("IsFiring", 1)
ASLT A 1 A_WeaponReady(WRF_ALLOWRELOAD)
Loop
Fire:
ASLT A 0 A_TakeInventory("IsFiring", 1)
ASLT A 0 A_JumpIfNoAmmo("Reload")
TNT1 A 0 A_PlaySound("weapons/rifle/fireloop", CHAN_WEAPON, 1.0, 1)
TNT1 A 0 A_FireCustomMissile("ARBullet", random(-2, 4), 1, 0, 10, 0, random(-3, 5))
TNT1 A 0 A_FireCustomMissile("32mmCasingSpawner", 0, 0, 0, -45)
TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
ASLT A 1 A_ZoomFactor(0.98)
ASLT A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
ASLT B 1 A_Light2
TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
ASLT C 1 A_Light0
//TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
//ASLT C 1
TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
ASLT A 0 A_Refire
ASLT A 0 A_GiveInventory("IsFiring", 1)
ASLT A 0 A_StopSound(CHAN_WEAPON)
ASLT A 0 A_PlaySound("weapons/rifle/echo", CHAN_UI)
TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
ASLT C 1
TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch)
ASLT D 1
Goto Ready
Reload:
ASLT A 0 A_GiveInventory("IsFiring", 1)
//TNT1 A 0 A_StopSound(CHAN_WEAPON)
TNT1 A 0 A_JumpIfInventory("ARAmmo", 52, "Ready")
TNT1 A 0 A_JumpIfInventory("ARAmmo", 52, 2) // If the gun's full, jump 2 states.
TNT1 A 0 A_JumpIfInventory("ARmag", 1, "ReloadWork") // If there's extra ammo, reload.
Goto Ready
ReloadWork:
TNT1 A 0 A_GiveInventory("ARAmmo", 52)
ReloadLoop: // Here's where the magic happens!
TNT1 A 0 A_TakeInventory("ARmag", 1)
TNT1 A 0 A_GiveInventory("ARAmmo", 1) // Only give ONE bullet at a time)
TNT1 A 0 A_JumpIfInventory("ARAmmo", 52, "ReloadFinish") // If it's full, finish up.
TNT1 A 0 A_JumpIfInventory("ARmag", 1, "ReloadLoop") // If it's NOT full, keep it rolling.
Goto ReloadFinish // And if it's not full but there's no reserve ammo, finish up anyway.
ReloadFinish:
ASLT A 0 A_PlaySound("weapons/rifle/reload", CHAN_WEAPON)
RRLD ABCD 2
RRLD E 5
RRLD EEFGHI 3
Goto Ready
Spawn:
SHOT A -1
stop
}
}
Actor IsFiring : Inventory
{
Inventory.MaxAmount 1
}
I followed this tutorial which uses sound loops for the shooting sound and when the weapon is deselected mid-fire it's supposed to play the shot echo sound, but any time I deselect the weapon it plays the echo sound, not just when shooting. It's only supposed to play the echo if the player does not have "IsFiring". So I don't understand what's causing it to do this because "IsFiring" is only taken away at the beginning of the fire state but is given back in the ready state.
states { Select: RRLD FFFFFFFFFFFFFFF 1 A_Raise RRLD FGGHHI 1 loop Deselect: //RRLD IHHGG 1 //RRLD FFFFFFFFFFFFFFFFFF 1 A_Lower ASLT A 1 A_JumpIfInventory("IsFiring", 0, "DeselectMidFire") Goto DeselectEnd DeselectMidFire: ASLT A 0 A_StopSound(CHAN_WEAPON) ASLT A 0 A_PlaySound("weapons/rifle/echo") ASLT A 1 A_TakeInventory("IsFiring", 1) Goto DeselectEnd DeselectEnd: ASLT A 0 A_StopSound RRLD IHHGG 1 RRLD FFFFFFFFFFFFFFFFFF 1 A_Lower Loop Ready: ASLT A 0 A_GiveInventory("IsFiring", 1) ASLT A 1 A_WeaponReady(WRF_ALLOWRELOAD) Loop Fire: ASLT A 0 A_TakeInventory("IsFiring", 1) ASLT A 0 A_JumpIfNoAmmo("Reload") TNT1 A 0 A_PlaySound("weapons/rifle/fireloop", CHAN_WEAPON, 1.0, 1) TNT1 A 0 A_FireCustomMissile("ARBullet", random(-2, 4), 1, 0, 10, 0, random(-3, 5)) TNT1 A 0 A_FireCustomMissile("32mmCasingSpawner", 0, 0, 0, -45) TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch) ASLT A 1 A_ZoomFactor(0.98) ASLT A 0 A_ZoomFactor(1.0) TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch) ASLT B 1 A_Light2 TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch) ASLT C 1 A_Light0 //TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch) //ASLT C 1 TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch) ASLT A 0 A_Refire ASLT A 0 A_GiveInventory("IsFiring", 1) ASLT A 0 A_StopSound(CHAN_WEAPON) ASLT A 0 A_PlaySound("weapons/rifle/echo", CHAN_UI) TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch) ASLT C 1 TNT1 A 0 A_WeaponReady(WRF_NoFire|WRF_NoSwitch) ASLT D 1 Goto Ready Reload: ASLT A 0 A_GiveInventory("IsFiring", 1) //TNT1 A 0 A_StopSound(CHAN_WEAPON) TNT1 A 0 A_JumpIfInventory("ARAmmo", 52, "Ready") TNT1 A 0 A_JumpIfInventory("ARAmmo", 52, 2) // If the gun's full, jump 2 states. TNT1 A 0 A_JumpIfInventory("ARmag", 1, "ReloadWork") // If there's extra ammo, reload. Goto Ready ReloadWork: TNT1 A 0 A_GiveInventory("ARAmmo", 52) ReloadLoop: // Here's where the magic happens! TNT1 A 0 A_TakeInventory("ARmag", 1) TNT1 A 0 A_GiveInventory("ARAmmo", 1) // Only give ONE bullet at a time) TNT1 A 0 A_JumpIfInventory("ARAmmo", 52, "ReloadFinish") // If it's full, finish up. TNT1 A 0 A_JumpIfInventory("ARmag", 1, "ReloadLoop") // If it's NOT full, keep it rolling. Goto ReloadFinish // And if it's not full but there's no reserve ammo, finish up anyway. ReloadFinish: ASLT A 0 A_PlaySound("weapons/rifle/reload", CHAN_WEAPON) RRLD ABCD 2 RRLD E 5 RRLD EEFGHI 3 Goto Ready Spawn: SHOT A -1 stop } } Actor IsFiring : Inventory { Inventory.MaxAmount 1 }
Share this post
Link to post