Minigun goes to DESELECT instead of a different state on no ammo.

Discuss all aspects related to modding Zandronum here.
Post Reply
ninja2000
 
Posts: 25
Joined: Fri Aug 03, 2012 3:10 pm

Minigun goes to DESELECT instead of a different state on no ammo.

#1

Post by ninja2000 » Thu Oct 22, 2015 4:00 pm

Hello. I have life issues with my minigun. Every thing is fine, but only one thing disturbes me. When firing in primary mode with no ammo in inventory it should go in to the MINISTOPDESELECT (spin barrels down and than A_DESELECT) and not do A_DESELECT. How to fix it?

Code: Select all

ACTOR Spin: Inventory
{
inventory.maxamount 1
}

ACTOR MinigunAmmo : Ammo
{
	Inventory.PickupMessage "Picked up some minigun ammo."
	Inventory.Amount 50
	Inventory.MaxAmount 400
	Ammo.BackpackMaxAmount 800
    Ammo.BackpackAmount 50
	Inventory.Icon "AMMOA0"
	States
	{
	Spawn:
		AMMO A -1
		Loop
	}
}


ACTOR Minigun : Weapon
{
Weapon.AmmoType "MinigunAmmo"
Weapon.SelectionOrder 700
Decal BulletChip
Weapon.AmmoGive 60
Weapon.AmmoUse 1
Inventory.PickupSound "misc/w_pkup"
Inventory.PickupMessage "Picked up a minigun!"
Obituary "%o was shredded by %k's minigun."
+NOEXTREMEDEATH
States
{
Spawn:
MNGN A -1
Loop
Ready:
MNGG A 1 A_WeaponReady
Loop
Ready2: 
TNT1 A 0 A_PlaySound("CHAINSPI")
TNT1 A 0 A_AlertMonsters
MNGG AB 2 A_WeaponReady
Loop
Deselect:
TNT1 A 0 A_JumpIfInventory("Spin",1,"MINISTOPDESELECT")
TNT1 A 0 A_TakeInventory ("Spin",1)
TNT1 A 0 A_STOPSOUND (0)
TNT1 A 0 A_STOPSOUND (1)
MNGG A 0 A_Lower
MNGG A 1 A_Lower
Loop
Select:
MNGG A 0 A_Raise
MNGG A 1 A_Raise
Loop
Fire:
goto morefire
Morefire:
TNT1 A 0 A_JUMPIFNOAMMO ("MINISTOPDESELECT")
TNT1 A 0 A_JumpIfInventory("Spin",1,"Fire2")
TNT1 A 0 A_PlaySound("CHAINSTA")
MNGG AB 4 
MNGG AB 2
MNGG AB 2
Goto Hold
Hold:
TNT1 A 0 A_JUMPIFNOAMMO ("MINISTOPDESELECT")
TNT1 A 0 A_JumpIfInventory("Spin",1,"Fire2")
MNGG A 0 A_GunFlash
TNT1 A 0 A_PlaySound("CHAINSPI")
TNT1 A 0 A_PlaySound("weapons/minigunfire")
MNGG A 2 A_FireBullets(4, 3, -1, 9)
MNGG B 2 A_FireBullets(4, 3, -1, 8.5)
TNT1 A 0 A_STOPSOUND (0)
MNGG B 0 A_ReFire
TNT1 A 0 A_JumpIfInventory("Spin",1,"Fire2")
MNGG AB 2
TNT1 A 0 A_PlaySound("CHAINSTO")
MNGG AB 4
MNGG AB 6
MNGG AB 8
Goto Ready
Fire2:
TNT1 A 0 A_JUMPIFNOAMMO ("MINISTOPDESELECT")
MNGG A 0 A_GunFlash
TNT1 A 0 A_PlaySound("CHAINSPI")
TNT1 A 0 A_PlaySound("weapons/minigunfire")
MNGG A 2 A_FireBullets(5.5, 4.5, -1, 9)
MNGG B 2 A_FireBullets(5.5, 4.5, -1, 8.5)
TNT1 A 0 A_STOPSOUND (0)
MNGG B 0 A_ReFire
goto Ready2
AltFire:
TNT1 A 0 A_JumpIfInventory("Spin",1,"StopAlt")
TNT1 A 0 A_GiveInventory ("Spin",1)
TNT1 A 0 A_PlaySound("CHAINSTA")
MNGG AB 4 
MNGG AB 2
MNGG AB 2
MNGG AB 2
MNGG AB 2
TNT1 A 0 A_PlaySound("CHAINSPI")
MNGG AB 2
MNGG AB 2
goto Ready2
StopAlt:
TNT1 A 0 A_TakeInventory ("Spin",1)
TNT1 A 0 A_PlaySound("CHAINSTO")
MNGG AB 2
MNGG AB 4
MNGG AB 6
MNGG A 4
TNT1 A 0 A_STOPSOUND (0)
Goto Ready
MINISTOPDESELECT:
TNT1 A 0 A_TakeInventory ("Spin",1)
TNT1 A 0 A_PlaySound("CHAINSTO")
MNGG AB 2
MNGG AB 4
MNGG AB 6
MNGG A 4
//I know that it's a very stupid way to fix stuff, but its very late and I'm sleepy. Send coffee. Plz
TNT1 A 0 A_STOPSOUND (0)
Goto DESELECT
NoAmmo:
MNGG A 10 A_PlaySound("weapons/empty")
TNT1 A 0 A_STOPSOUND (0)
goto Ready
Flash:
MNGF A 3 BRIGHT A_Light1
MNGF B 3 BRIGHT A_Light0
Stop
}
}

Code: Select all

D:!

User avatar
Dark-Assassin
Maintenence Crew
Posts: 968
Joined: Fri May 25, 2012 4:25 am

RE: Minigun goes to DESELECT instead of a different state on no ammo.

#2

Post by Dark-Assassin » Sat Oct 24, 2015 5:48 am

Not sure if Goto actions are case sensitive. Try changing Goto DESELECT to Goto Deselect
That's all I can think of right now.
❗ Don't message me for technical or moderation support.
❔ Use the relevant support channels instead.

ninja2000
 
Posts: 25
Joined: Fri Aug 03, 2012 3:10 pm

RE: Minigun goes to DESELECT instead of a different state on no ammo.

#3

Post by ninja2000 » Tue Oct 27, 2015 8:05 pm

I've made it. It was hell.

Code: Select all

ACTOR Spin: Inventory
{
inventory.maxamount 1
}


ACTOR MinigunAmmo : Ammo
{
	Inventory.PickupMessage "Picked up some minigun ammo."
	Inventory.Amount 50
	Inventory.MaxAmount 400
	Ammo.BackpackMaxAmount 800
    Ammo.BackpackAmount 50
	Inventory.Icon "AMMOA0"
	States
	{
	Spawn:
		AMMO A -1
		Loop
	}
}


ACTOR Minigun : Weapon
{
Weapon.AmmoType "MinigunAmmo"
Weapon.SelectionOrder 700
Decal BulletChip
Weapon.AmmoGive 60
Weapon.AmmoUse 1
Inventory.PickupSound "misc/w_pkup"
Inventory.PickupMessage "Picked up a minigun!"
Obituary "%o was shredded by %k's minigun."
+NOEXTREMEDEATH
States
{
Spawn:
MNGN A -1
Loop
Ready:
MNGG A 1 A_WeaponReady
Loop
Ready2: 
TNT1 A 0 A_PlaySound("CHAINSPI")
TNT1 A 0 A_AlertMonsters
MNGG AB 2 A_WeaponReady
Loop
Deselect:
TNT1 A 0 A_JUMPIFINVENTORY ("SPIN",1,"MINISTOPDESELECT")
TNT1 A 0 A_JUMPIFINVENTORY ("MINIGUNAMMO",1,"Lowerlower")
TNT1 A 0 A_PlaySound("CHAINSTO")
MNGG AB 2
MNGG AB 4
MNGG AB 6
MNGG A 4
TNT1 A 0
TNT1 A 0 A_STOPSOUND (0)
TNT1 A 0 A_STOPSOUND (1)
goto Lowerlower
Lowerlower:
TNT1 A 0 A_TakeInventory ("Spin",1)
MNGG A 0 A_Lower
MNGG A 1 A_Lower
Loop
Select:
MNGG A 0 A_Raise
MNGG A 1 A_Raise
Loop
Fire:
TNT1 A 0 A_JumpIfInventory("Spin",1,"Fire2")
TNT1 A 0 A_PlaySound("CHAINSTA")
MNGG AB 4 
MNGG AB 2
MNGG AB 2
Goto Hold
Hold:
TNT1 A 0 A_JumpIfInventory("Spin",1,"Fire2")
MNGG A 0 A_GunFlash
TNT1 A 0 A_PlaySound("CHAINSPI")
TNT1 A 0 A_PlaySound("weapons/minigunfire")
MNGG A 2 A_FireBullets(4, 3, -1, 9)
MNGG B 2 A_FireBullets(4, 3, -1, 8.5)
TNT1 A 0 A_STOPSOUND (0)
MNGG B 0 A_ReFire
TNT1 A 0 A_JumpIfInventory("Spin",1,"Fire2")
MNGG AB 2
TNT1 A 0 A_PlaySound("CHAINSTO")
MNGG AB 4
MNGG AB 6
MNGG AB 8
Goto Ready
Fire2:
TNT1 A 0 A_JUMPIFNOAMMO ("MINISTOPDESELECT")
MNGG A 0 A_GunFlash
TNT1 A 0 A_PlaySound("CHAINSPI")
TNT1 A 0 A_PlaySound("weapons/minigunfire")
MNGG A 2 A_FireBullets(5.5, 4.5, -1, 9)
MNGG B 2 A_FireBullets(5.5, 4.5, -1, 8.5)
TNT1 A 0 A_STOPSOUND (0)
MNGG B 0 A_ReFire
goto Ready2
AltFire:
TNT1 A 0 A_JumpIfInventory("Spin",1,"StopAlt")
TNT1 A 0 A_GiveInventory ("Spin",1)
TNT1 A 0 A_PlaySound("CHAINSTA")
MNGG AB 4 
MNGG AB 2
MNGG AB 2
MNGG AB 2
MNGG AB 2
TNT1 A 0 A_PlaySound("CHAINSPI")
MNGG AB 2
MNGG AB 2
goto Ready2
StopAlt:
TNT1 A 0 A_TakeInventory ("Spin",1)
TNT1 A 0 A_PlaySound("CHAINSTO")
MNGG AB 2
MNGG AB 4
MNGG AB 6
MNGG A 4
TNT1 A 0 A_STOPSOUND (0)
Goto Ready
MINISTOPDESELECT:
TNT1 A 0 A_STOPSOUND (0)
TNT1 A 0 A_STOPSOUND (1)
TNT1 A 0 A_TakeInventory ("Spin",1)
TNT1 A 0 A_PlaySound("CHAINSTO")
MNGG AB 2
MNGG AB 4
MNGG AB 6
MNGG A 4
//I know that it's a very stupid way to fix stuff, but its very late and I'm sleepy. Send coffee. Plz
TNT1 A 0 A_STOPSOUND (0)
Goto Lowerlower
Flash:
MNGF A 3 BRIGHT A_Light1
MNGF B 3 BRIGHT A_Light0
Stop
}
}

Code: Select all

D:!

User avatar
StrikerMan780
Forum Regular
Posts: 279
Joined: Tue May 29, 2012 9:16 pm
Clan: Shadow Mavericks
Clan Tag: [SM]

RE: Minigun goes to DESELECT instead of a different state on no ammo.

#4

Post by StrikerMan780 » Tue Oct 27, 2015 8:15 pm

Or you could have just added +WEAPON.AMMO_OPTIONAL and added a A_JumpIfNoAmmo check. Would have saved you from having to write nearly as complicated code.
Last edited by StrikerMan780 on Tue Oct 27, 2015 8:16 pm, edited 1 time in total.

ninja2000
 
Posts: 25
Joined: Fri Aug 03, 2012 3:10 pm

RE: Minigun goes to DESELECT instead of a different state on no ammo.

#5

Post by ninja2000 » Tue Oct 27, 2015 9:26 pm

Oh noes! There is another problem. When I die with spining minigun (Ready2 state) the weapon will slowly stop rotating the barrels. How to deselect the weapon if health = 0 (go instantly to Lowerlower state)?
Last edited by ninja2000 on Tue Oct 27, 2015 9:27 pm, edited 1 time in total.

Code: Select all

D:!

User avatar
Ænima
Addicted to Zandronum
Posts: 3579
Joined: Tue Jun 05, 2012 6:12 pm

RE: Minigun goes to DESELECT instead of a different state on no ammo.

#6

Post by Ænima » Tue Oct 27, 2015 9:31 pm

http://zdoom.org/wiki/A_JumpIfHealthLower

You should really consider using StrikerMan's suggestion, it's much cleaner.
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

Post Reply