by DBThanatos » Mon Jun 30, 2008 1:56 am
Im not sure how to explain this, but I'll do my best

.
The problem comes from
this topic.
As I said there, I was trying to replicate the powered PhoenixRod. You start firing so you spend one rocket, if you immediatly release the altfire key you go back to Ready, but if you keep holding it you go to AltHold as expected. In the "AltHold" state, a cycle begins; this will keep firing until the specified amount of shots have been fired (via jumpifinventory and the check). If that amount wasnt reached and you stop firing, all works normally, you go to Ready. However, if you keep firing and the amount is reached, is goes to "HoldEnd" custom state; if you release the Altfire key at this point, it still works as intended, but if you keep pressing it, it will immediatly go to the AltHold state instead of the AltFire one as expected. I see this as a bug, because I was intentionally telling the weapon to go to "Ready" to restart the firing sequence if the button was held. Is very noticeable the fact that it never enters to the AltFire state because it will no longer consume ammo.
Here is the code for the weapon in case Im doing something terribly wrong
Spoiler:
Code: Select all
ACTOR AEoDFPhoenixRod : Weapon 6014
{
+FLOORCLIP
Weapon.AmmoType "RocketAmmo"
Weapon.AmmoType2 "RocketAmmo"
Weapon.AmmoGive 18
Weapon.AmmoUse 1
Weapon.AmmoUse2 1
Inventory.PickupSound "weaponbuild"
Inventory.PickupMessage "Picked up the Phoenix rod."
Obituary "%o saw a fire bird rising from %k's Rod."
AttackSound "weapons/pistol"
States
{
Spawn:
WPHX A -1
Loop
Ready:
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX A 1 A_WeaponReady
Loop
Deselect:
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX A 1 A_Lower
NULL AA 0 A_Lower
Goto Deselect+1
Select:
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX A 1 A_Raise
NULL AA 0 A_Raise
Goto Select+1
Fire:
PHNX B 0 A_PlayWeaponSound("weapons/phoenixshoot")
PHNX B 8 Bright
PHNX C 0 A_GunFlash
DPIS A 0 A_Recoil(6)
PHNX C 7 Bright A_FireCustomMissile("PhoenixShot", 0, 1, 0, 0)
PHNX D 8 Bright
goto Ready
AltFire:
PHNX B 3 Bright
PHNX C 1 Bright A_FireCustomMissile("PhoenixFX2", 0, 1, 0, 0) //only the start is what consumes ammo
PHNX C 1 Bright A_FireCustomMissile("PhoenixFX2", 0, 0, 0, 0)
TNT1 A 0 A_Refire
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX D 3 Bright
goto Ready
AltHold:
TNT1 A 0 A_JumpIfInventory("PhoenixAltFCheck",8,"HoldEnd")
TNT1 A 0 A_GiveInventory("PhoenixAltFCheck",1)
PHNX C 1 Bright A_FireCustomMissile("PhoenixFX2", 0, 0, 0, 0)
TNT1 A 0 A_Refire
HoldEnd:
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX D 3 Bright
goto Ready
Flash:
CRBW W 3 BRIGHT A_Light1
CRBW W 2 BRIGHT A_Light0
Stop
}
}
actor PhoenixAltFCheck : Inventory
{
Inventory.MaxAmount 8
Inventory.Amount 1
}
This doesnt seem to work taking away the custom state
Im not sure how to explain this, but I'll do my best :P.
The problem comes from [url=http://forum.zdoom.org/viewtopic.php?f=3&t=17871]this[/url] topic.
As I said there, I was trying to replicate the powered PhoenixRod. You start firing so you spend one rocket, if you immediatly release the altfire key you go back to Ready, but if you keep holding it you go to AltHold as expected. In the "AltHold" state, a cycle begins; this will keep firing until the specified amount of shots have been fired (via jumpifinventory and the check). If that amount wasnt reached and you stop firing, all works normally, you go to Ready. However, if you keep firing and the amount is reached, is goes to "HoldEnd" custom state; if you release the Altfire key at this point, it still works as intended, but if you keep pressing it, it will immediatly go to the AltHold state instead of the AltFire one as expected. I see this as a bug, because I was intentionally telling the weapon to go to "Ready" to restart the firing sequence if the button was held. Is very noticeable the fact that it never enters to the AltFire state because it will no longer consume ammo.
Here is the code for the weapon in case Im doing something terribly wrong
[spoiler][code]ACTOR AEoDFPhoenixRod : Weapon 6014
{
+FLOORCLIP
Weapon.AmmoType "RocketAmmo"
Weapon.AmmoType2 "RocketAmmo"
Weapon.AmmoGive 18
Weapon.AmmoUse 1
Weapon.AmmoUse2 1
Inventory.PickupSound "weaponbuild"
Inventory.PickupMessage "Picked up the Phoenix rod."
Obituary "%o saw a fire bird rising from %k's Rod."
AttackSound "weapons/pistol"
States
{
Spawn:
WPHX A -1
Loop
Ready:
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX A 1 A_WeaponReady
Loop
Deselect:
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX A 1 A_Lower
NULL AA 0 A_Lower
Goto Deselect+1
Select:
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX A 1 A_Raise
NULL AA 0 A_Raise
Goto Select+1
Fire:
PHNX B 0 A_PlayWeaponSound("weapons/phoenixshoot")
PHNX B 8 Bright
PHNX C 0 A_GunFlash
DPIS A 0 A_Recoil(6)
PHNX C 7 Bright A_FireCustomMissile("PhoenixShot", 0, 1, 0, 0)
PHNX D 8 Bright
goto Ready
AltFire:
PHNX B 3 Bright
PHNX C 1 Bright A_FireCustomMissile("PhoenixFX2", 0, 1, 0, 0) //only the start is what consumes ammo
PHNX C 1 Bright A_FireCustomMissile("PhoenixFX2", 0, 0, 0, 0)
TNT1 A 0 A_Refire
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX D 3 Bright
goto Ready
AltHold:
TNT1 A 0 A_JumpIfInventory("PhoenixAltFCheck",8,"HoldEnd")
TNT1 A 0 A_GiveInventory("PhoenixAltFCheck",1)
PHNX C 1 Bright A_FireCustomMissile("PhoenixFX2", 0, 0, 0, 0)
TNT1 A 0 A_Refire
HoldEnd:
TNT1 A 0 A_TakeInventory("PhoenixAltFCheck",8)
PHNX D 3 Bright
goto Ready
Flash:
CRBW W 3 BRIGHT A_Light1
CRBW W 2 BRIGHT A_Light0
Stop
}
}
actor PhoenixAltFCheck : Inventory
{
Inventory.MaxAmount 8
Inventory.Amount 1
}[/code]This doesnt seem to work taking away the custom state[/spoiler]