Weird decorate error (RESOLVED)

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
ZDG
Posts: 918
Joined: Sat Jan 02, 2010 12:01 pm
Location: in SlumpEd

Weird decorate error (RESOLVED)

Post by ZDG »

You know that i'm working on Zweaps, but this bug hinders me a LOT, mostly because it's pretty hard to understand.
The thing is, the rocketbox created by the spawner CAN be picked up but gives NO AMMO.
However, if you spawn them using summon, they CAN'T be picked up, but they are THE SAME CLASS.
But the homing ones work very well.
That's REALLY weird.

Code: Select all

Actor NewRocketAmmo :Rocketammo
{
  Inventory.PickupMessage "$GOTROCKET"
  Inventory.Amount 1
  Inventory.MaxAmount 50
  Ammo.BackpackAmount 1
  Ammo.BackpackMaxAmount 100
  Inventory.Icon "ROCKA0"
  States
  {
  Spawn:
    ROCK A -1
    stop
  }
}

Actor NewRocketBox :NewRocketAmmo
{
  Inventory.PickupMessage "$GOTROCKBOX" // "Picked up a box of rockets."
  Inventory.Amount 5
  States
  {
  Spawn:
    BROK A -1
    Stop
  }
}
Actor HomingAmmo : Ammo
{
inventory.maxamount 25
inventory.pickupmessage "Picked up a homing rocket"
inventory.icon "HOCKA0"
inventory.Amount 1
Ammo.BackpackAmount 2
Ammo.BackpackMaxAmount 30
States
 {
  Spawn:
  HOCK A -1
  stop
  }
}
Actor Homingbox : HomingAmmo
{
  inventory.PickupMessage "Got a Homing rocket box."
 Inventory.amount 5
 states
 {
  Spawn:
  HROK A -1
  stop
  }
}
Actor Rocketspawner: RandomSpawner replaces RocketAmmo
{
 DropItem "NewRocketAmmo"
 DropItem "HomingAmmo"
}
Actor RocketBoxSpawner : RandomSpawner replaces Rocketbox
{
 DropItem "NewRocketBox"
 DropItem "HomingBox"
}

 
And now, for something COMPLETELY different:
I made a realoding shotgun with casings, it works PERFECTLY, but it STILL can reload if you don't have any shells. If you don't have any, it SHOULD jump to the WTFNOWAY state:
but it doesn't.

Code: Select all

Actor ImpHunter1 : Weapon
{
 Weapon.SelectionOrder 1300
  Weapon.AmmoUse1 1
  Weapon.AmmoGive1 0
  Weapon.ammogive2 10
  Weapon.AmmoType "MK1ShellsLoaded"
  Weapon.AmmoType2 "Shell"
  Inventory.PickupMessage "Got the Imp Hunter Mk1!" 
  Obituary "%o ate too much of %k's pellets." 
  States
  {
  Ready:
    SGN2 A 1 A_WeaponReady
    Loop
  Deselect:
    SGN2 A 1 A_Lower
    Loop
  Select:
    SGN2 A 1 A_Raise
    Loop
  Fire:
    SGN2 A 2 A_JumpIfNoAmmo ("Reload")
    SGN2 A 2
	SGN2 A 1 A_PlaySound ("IHUFIRE",CHAN_WEAPON)
    SG2F A 4 bright A_FireBullets (5.6, 0, 7, 5, "BulletPuff")
    SGN2 BC 3
	SGN2 D 3 A_PlaySound ("IHUPUMP")
	SGN2 DCB 3
	SGN2 D 0 A_FireCustomMissile("ShellCasing",-90,0)
    SGN2 A 2 A_ReFire
    Goto Ready
  Spawn:
    IMK1 A -1
    Stop
 AltFire:
 Goto Reload
  Reload:
	SGN2 A 0 A_JumpIfInventory ("MK1ShellsLoaded",4,"Ready")
    SGN2 A 0 A_JumpIfInventory ("MK1ShellsLoaded",3,"LoadOneShell")
	SGN2 A 0 A_JumpIfInventory ("MK1ShellsLoaded",2,"LoadTwoShell")
	SGN2 A 0 A_JumpIfInventory ("MK1ShellsLoaded",1,"LoadThreeShell")
    SG2R ABCDE 3
		SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
	SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
		SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
		SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
		SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R DCBA 3
	goto ready
  LoadOneShell:
    SG2R ABCDE 3
	SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
		SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R DCBA 3
	goto ready
  LoadTwoShell:
	SG2R ABCDE 3
	SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
		SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
		SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R DCBA 3
	goto ready
	LoadThreeShell:
   SG2R ABCDE 3
   SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
		SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
		SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R E 0 A_CheckReload
	SG2R E 7 A_PlaySound ("Shelladd")
		SG2R E 0 A_TakeInventory ("Shell",1)
	SG2R E 0 A_GiveInventory ("MK1ShellsLoaded")
	SG2R DCBA 3
	goto ready
	WTFNOWAY:
	SGN2 A 1 A_Print ("You don't have any shells\n left in your inventory!")
	goto ready
  }
}
Actor MK1ShellsLoaded : Ammo
{
 Inventory.MaxAmount 4
}
Last edited by ZDG on Mon May 31, 2010 7:15 am, edited 1 time in total.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Weird decorate error

Post by NeuralStunner »

You're trying to redefine the MaxAmounts, etc. for an existing Ammo class. (Pointlessly, I might add - None of the properties I see in that actor really are "new".) If you want to change MaxAmounts and the like, derive a completely new type directly from Ammo.

Also, I see no checking in the AltFire state of that weapon for Shell. Just checking for its internal ammo counter. Also, you should add the +WEAPON.AMMO_OPTIONAL flag to a weapon that can be reloaded, else it's going to automatically switch to another weapon if you attempt to dry fire.
User avatar
ZDG
Posts: 918
Joined: Sat Jan 02, 2010 12:01 pm
Location: in SlumpEd

Re: Weird decorate error

Post by ZDG »

In fact, the rocket definitions are the same than doom's.
I'll try for the shotgun. But the JumpIfNoAmmo works only for the Ammo in the shotgun (1st type.)
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Weird decorate error

Post by NeuralStunner »

ZDG wrote:I'll try for the shotgun. But the JumpIfNoAmmo works only for the Ammo in the shotgun (1st type.)
You can switch around the check, meaning use [wiki]A_JumpIfInventory[/wiki] to check for at least one of the ammo and jump to an actual firing state.
User avatar
ZDG
Posts: 918
Joined: Sat Jan 02, 2010 12:01 pm
Location: in SlumpEd

Re: Weird decorate error

Post by ZDG »

I meant, the shell check during reloading.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Weird decorate error

Post by NeuralStunner »

Oh. Well, that's not fixable unless reloading is only usable via AltFire. By default, weapons only look at the first ammo type (unless +WEAPON.PRIMARY_USES_BOTH is added.) Weapon.AmmoUse2 would also have to be > 0 for A_JumpIfNoAmmo to have any effect.
User avatar
ZDG
Posts: 918
Joined: Sat Jan 02, 2010 12:01 pm
Location: in SlumpEd

Re: Weird decorate error

Post by ZDG »

Ooookay.. i'll go look in ZD's and TS's code.
User avatar
ZDG
Posts: 918
Joined: Sat Jan 02, 2010 12:01 pm
Location: in SlumpEd

Re: Weird decorate error

Post by ZDG »

Found a way for the shotgun, just added some A_JumpIfinventories with offsets.
But still, nothing for the RL ammo.
User avatar
ZDG
Posts: 918
Joined: Sat Jan 02, 2010 12:01 pm
Location: in SlumpEd

Re: Weird decorate error

Post by ZDG »

Got a new question, here's a Random spawner i created:

Code: Select all

Actor ShellSpawner : RandomSpawner replaces Shell
{
 dropitem MiniShellSpawner 255
 dropitem MiniShellSpawner 255
 dropitem MiniShellSpawner 255
}
Actor MiniShellSpawner: RandomSpawner
{
 dropitem NewShell
 dropitem SlugShell
}
I want the shell spawner to spawn 3 MiniShellSpanwer, however, it doesn't work.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: Weird decorate error

Post by XutaWoo »

Uh, of course it doesn't.

Why are you using a RandomSpawn, which spawns ONE thing from it's DropItem list, to try to spawn three things?

Really, I can't get your logic, since you used it correctly right under that. :?
User avatar
ZDG
Posts: 918
Joined: Sat Jan 02, 2010 12:01 pm
Location: in SlumpEd

Re: Weird decorate error

Post by ZDG »

Meh, corrected that a LOONG time ago, just forgot to edit it. But still NO ONE has found the rocket bug? Whoa, it must be freaking hard.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Weird decorate error

Post by Gez »

It's not been found because there's no bug. Here's what I tested:

Code: Select all

Actor NewRocketAmmo : RocketAmmo {}
Actor NewRocketBox : RocketBox {}

Actor HomingAmmo : Ammo
{
	inventory.maxamount 25
	inventory.pickupmessage "Picked up a homing rocket"
	inventory.icon "HOCKA0"
	inventory.Amount 1
	Ammo.BackpackAmount 2
	Ammo.BackpackMaxAmount 30
	States
	{
	Spawn:
		HOCK A -1
		stop
	}
}
Actor Homingbox : HomingAmmo
{
	inventory.PickupMessage "Got a Homing rocket box."
	Inventory.amount 5
	states
	{
	Spawn:
		HROK A -1
		stop
	}
}
Actor Rocketspawner: RandomSpawner replaces RocketAmmo
{
	DropItem "NewRocketAmmo"
	DropItem "HomingAmmo"
}
Actor RocketBoxSpawner : RandomSpawner replaces Rocketbox
{
	DropItem "NewRocketBox"
	DropItem "HomingBox"
}
Works.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Weird decorate error

Post by NeuralStunner »

ZDG wrote:I want the shell spawner to spawn 3 MiniShellSpanwer, however, it doesn't work.

Code: Select all

Actor ShellSpawner
{
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_DropWeaponPieces("MiniShellSpawner", "MiniShellSpawner", "MiniShellSpawner")
		Stop
	}
}
User avatar
ZDG
Posts: 918
Joined: Sat Jan 02, 2010 12:01 pm
Location: in SlumpEd

Re: Weird decorate error

Post by ZDG »

@Neural Meh, i already said it was ok, and i already fixed it before
@Gez Nope, still ain't workin'
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Weird decorate error

Post by Gez »

Works for me. (Other than the homing ammo being invisible since they have no sprites.) What more can I say?
Locked

Return to “Editing (Archive)”