by Enjay » Tue Jan 29, 2013 12:23 pm
Just thought I'd update with a little info here just in case it helps. When the ZDoom code changed initially I added A_WeaponReady(WRF_NOSWITCH) to the ready state sequence of my Minigun (and it worked as I wanted - as reported earlier). With the current code, the Minigun now half does what I wanted: once the weapon is selected, you cannot deselect it by pressing another weapon button. However, once you have pressed the button for another weapon, the Minigun no longer works properly. Even with the fire button held down, the gun only fires in short bursts (I assume it is going through its fire sequence right to the end before repeating rather than restarting when the fire sequence gets to A_Refire).
I know that the feature has not been fully addressed yet - and I'm not nagging - but I thought the information might be useful. In the spoiler is the code for the weapon concerned but there is quite a bit going on there so it might not be the best example. If a simpler example to work with is required, let me know.
Spoiler:
Code: Select all
///////////////////////////////////////
//Minigun
///////////////////////////////////////
ACTOR MiniGun : Weapon
{
//Weapon.AmmoType "None"
Tag "Minigun"
Weapon.SelectionOrder 20
Weapon.BobSpeed 2.2
Weapon.BobRangeX 0.5
Weapon.BobRangeY 0.75
Weapon.BobStyle "Alpha"
States
{
Ready:
MINI A 1 A_WeaponReady(WRF_NOSWITCH)
Loop
Deselect:
TNT1 A 0 ACS_NamedTerminate ("NJZoomShadow", 0)
TNT1 A 0 A_TakeInventory ("UnZoomerMiniGun", 10)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_PlayWeaponSound("weapons/weaponlower1")
TNT1 AAAAA 0 A_Lower
TNT1 A 1 A_Lower
Goto deselect +4
//Loop
Select:
TNT1 A 1 A_SetCrosshair (23)
TNT1 A 0 ACS_NamedTerminate ("NJZoomShadow", 0)
TNT1 A 0 A_TakeInventory ("UnZoomerMiniGun", 10)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_PlayWeaponSound("weapons/weaponraised")
TNT1 AAAAA 0 A_Raise
TNT1 A 1 A_Raise
Goto Select +5
//Loop
Fire:
MINI B 0 A_GunFlash
MINI B 0 A_PlayWeaponSound("weapons/minigunfire")
MINI B 1 A_FireBullets(3,2,1,10,"NJBulletPuff",1, 3840)
MINI B 1 A_FireCustomMissile("BrassCaseSpawn",0,0,-8,-8)
MINI B 0 A_PlayWeaponSound("weapons/minigunfire")
MINI A 1 A_FireBullets(3,2,1,10,"NJBulletPuff",1, 3840)
MINI A 1 A_FireCustomMissile("BrassCaseSpawn",0,0,-8,-8)
MINI B 0 A_PlayWeaponSound("weapons/minigunfire")
MINI B 1 A_FireCustomMissile ("YellowTracer", 0, 0, 0)
MINI B 1 A_FireCustomMissile("BrassCaseSpawn",0,0,-8,-8)
MINI B 0 A_PlayWeaponSound("weapons/minigunfire")
MINI A 1 A_FireBullets(3,2,1,10,"NJBulletPuff",1, 3840)
MINI A 1 A_FireCustomMissile("BrassCaseSpawn",0,0,-8,-8)
MINI A 0 A_ReFire
MINI B 2
MINI A 2
MINI B 3
MINI A 3
MINI B 4
MINI A 4
Goto Ready
Flash:
MINI D 2 Bright A_Light1
MINI C 2 Bright A_Light2
MINI D 2 Bright A_Light1
MINI C 2 Bright A_Light0
Stop
AltFire:
MINI A 0 A_JumpIfInventory("UnZoomerMiniGun", 1, "UnZoom") //go to unzooming function
//fallthrough
Zoom:
MINI A 0 ACS_NamedExecute ("NJZoomShadow", 0, 0, 0, 0)
MINI A 0 A_ZoomFactor(1.5)
MINI A 0 A_GiveInventory ("UnZoomerMiniGun", 1)
MINI A 1
MINI A 1 A_Refire("ZoomHold")
goto Ready
UnZoom:
MINI A 0 ACS_NamedTerminate ("NJZoomShadow", 0)
MINI A 0 A_ZoomFactor(1.0)
MINI A 0 A_TakeInventory ("UnZoomerMiniGun", 10)
MINI A 1
MINI A 1 A_Refire("ZoomHold")
goto Ready
ZoomHold:
MINI A 1
MINI A 1 A_Refire("ZoomHold")
goto Ready
}
}
actor UnZoomerMiniGun : Inventory
{
inventory.maxamount 1
}
Just thought I'd update with a little info here just in case it helps. When the ZDoom code changed initially I added A_WeaponReady(WRF_NOSWITCH) to the ready state sequence of my Minigun (and it worked as I wanted - as reported earlier). With the current code, the Minigun now half does what I wanted: once the weapon is selected, you cannot deselect it by pressing another weapon button. However, once you have pressed the button for another weapon, the Minigun no longer works properly. Even with the fire button held down, the gun only fires in short bursts (I assume it is going through its fire sequence right to the end before repeating rather than restarting when the fire sequence gets to A_Refire).
I know that the feature has not been fully addressed yet - and I'm not nagging - but I thought the information might be useful. In the spoiler is the code for the weapon concerned but there is quite a bit going on there so it might not be the best example. If a simpler example to work with is required, let me know.
[spoiler][code]///////////////////////////////////////
//Minigun
///////////////////////////////////////
ACTOR MiniGun : Weapon
{
//Weapon.AmmoType "None"
Tag "Minigun"
Weapon.SelectionOrder 20
Weapon.BobSpeed 2.2
Weapon.BobRangeX 0.5
Weapon.BobRangeY 0.75
Weapon.BobStyle "Alpha"
States
{
Ready:
MINI A 1 A_WeaponReady(WRF_NOSWITCH)
Loop
Deselect:
TNT1 A 0 ACS_NamedTerminate ("NJZoomShadow", 0)
TNT1 A 0 A_TakeInventory ("UnZoomerMiniGun", 10)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_PlayWeaponSound("weapons/weaponlower1")
TNT1 AAAAA 0 A_Lower
TNT1 A 1 A_Lower
Goto deselect +4
//Loop
Select:
TNT1 A 1 A_SetCrosshair (23)
TNT1 A 0 ACS_NamedTerminate ("NJZoomShadow", 0)
TNT1 A 0 A_TakeInventory ("UnZoomerMiniGun", 10)
TNT1 A 0 A_ZoomFactor(1.0)
TNT1 A 0 A_PlayWeaponSound("weapons/weaponraised")
TNT1 AAAAA 0 A_Raise
TNT1 A 1 A_Raise
Goto Select +5
//Loop
Fire:
MINI B 0 A_GunFlash
MINI B 0 A_PlayWeaponSound("weapons/minigunfire")
MINI B 1 A_FireBullets(3,2,1,10,"NJBulletPuff",1, 3840)
MINI B 1 A_FireCustomMissile("BrassCaseSpawn",0,0,-8,-8)
MINI B 0 A_PlayWeaponSound("weapons/minigunfire")
MINI A 1 A_FireBullets(3,2,1,10,"NJBulletPuff",1, 3840)
MINI A 1 A_FireCustomMissile("BrassCaseSpawn",0,0,-8,-8)
MINI B 0 A_PlayWeaponSound("weapons/minigunfire")
MINI B 1 A_FireCustomMissile ("YellowTracer", 0, 0, 0)
MINI B 1 A_FireCustomMissile("BrassCaseSpawn",0,0,-8,-8)
MINI B 0 A_PlayWeaponSound("weapons/minigunfire")
MINI A 1 A_FireBullets(3,2,1,10,"NJBulletPuff",1, 3840)
MINI A 1 A_FireCustomMissile("BrassCaseSpawn",0,0,-8,-8)
MINI A 0 A_ReFire
MINI B 2
MINI A 2
MINI B 3
MINI A 3
MINI B 4
MINI A 4
Goto Ready
Flash:
MINI D 2 Bright A_Light1
MINI C 2 Bright A_Light2
MINI D 2 Bright A_Light1
MINI C 2 Bright A_Light0
Stop
AltFire:
MINI A 0 A_JumpIfInventory("UnZoomerMiniGun", 1, "UnZoom") //go to unzooming function
//fallthrough
Zoom:
MINI A 0 ACS_NamedExecute ("NJZoomShadow", 0, 0, 0, 0)
MINI A 0 A_ZoomFactor(1.5)
MINI A 0 A_GiveInventory ("UnZoomerMiniGun", 1)
MINI A 1
MINI A 1 A_Refire("ZoomHold")
goto Ready
UnZoom:
MINI A 0 ACS_NamedTerminate ("NJZoomShadow", 0)
MINI A 0 A_ZoomFactor(1.0)
MINI A 0 A_TakeInventory ("UnZoomerMiniGun", 10)
MINI A 1
MINI A 1 A_Refire("ZoomHold")
goto Ready
ZoomHold:
MINI A 1
MINI A 1 A_Refire("ZoomHold")
goto Ready
}
}
actor UnZoomerMiniGun : Inventory
{
inventory.maxamount 1
}[/code][/spoiler]