Decorate Inventory Drop
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.
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.
- DrewbieDoobie007
- Posts: 171
- Joined: Thu Jul 24, 2003 8:12 pm
- Location: Shelton, Nebraska, USA
Decorate Inventory Drop
Is there a way one can make a decorate item that the player drops upon death that checks the inventory of weapons and ammo and drops what the player had?
- bagheadspidey
- Posts: 1490
- Joined: Sat Oct 20, 2007 10:31 pm
- Contact:
Re: Decorate Inventory Drop
Cool idea. I've been playing around with this and have some decorate that drops most of the doom(2) stuff (pretty much everything but armor and powerups) - everything is dropped in two clups, though, which kinda sucks - also it doesn't give change on the ammo. I'll refine it later to get stuff to shoot outwards a little instead of spawning in a clump. Also it could be compacted a lot with a bit of acs.
... of course, you'd have to give your player a custom death state and give him one of these when he dies.
edit - fixed some stuff
Code: Select all
// player drops stuff when he dies
actor PlayerDropStuff : CustomInventory
{
inventory.maxamount 0
inventory.amount 0
+INVENTORY.AUTOACTIVATE
states
{
Use:
// drop weapons
TNT1 A 0 A_DropInventory ("Chainsaw")
TNT1 A 0 A_DropInventory ("Shotgun")
TNT1 A 0 A_DropInventory ("SuperShotgun")
TNT1 A 0 A_DropInventory ("Chaingun")
TNT1 A 0 A_DropInventory ("RocketLauncher")
TNT1 A 0 A_DropInventory ("PlasmaRifle")
TNT1 A 0 A_DropInventory ("BFG9000")
// drop other crap
TNT1 A 0 A_DropInventory ("Backpack")
TNT1 A 0 A_DropInventory ("BlueCard")
TNT1 A 0 A_DropInventory ("BlueSkull")
TNT1 A 0 A_DropInventory ("RedCard")
TNT1 A 0 A_DropInventory ("RedSkull")
TNT1 A 0 A_DropInventory ("YellowCard")
TNT1 A 0 A_DropInventory ("YellowSkull")
// drop ammo
FindBullets:
TNT1 A 0 A_JumpIfInventory ("Clip", 400, 8)
TNT1 A 0 A_JumpIfInventory ("Clip", 350, 8)
TNT1 A 0 A_JumpIfInventory ("Clip", 300, 8)
TNT1 A 0 A_JumpIfInventory ("Clip", 250, 8)
TNT1 A 0 A_JumpIfInventory ("Clip", 200, 8)
TNT1 A 0 A_JumpIfInventory ("Clip", 150, 8)
TNT1 A 0 A_JumpIfInventory ("Clip", 100, 8)
TNT1 A 0 A_JumpIfInventory ("Clip", 50, 8)
goto "FindShells"
DropBullets:
TNT1 AAAAAAAA 0 A_SpawnItem ("ClipBox")
FindShells:
TNT1 A 0 A_JumpIfInventory ("Shell", 100, 5)
TNT1 A 0 A_JumpIfInventory ("Shell", 80, 5)
TNT1 A 0 A_JumpIfInventory ("Shell", 60, 5)
TNT1 A 0 A_JumpIfInventory ("Shell", 40, 5)
TNT1 A 0 A_JumpIfInventory ("Shell", 20, 5)
goto "FindRockets"
DropShells:
TNT1 AAAAA 0 A_SpawnItem ("ShellBox")
FindRockets:
TNT1 A 0 A_JumpIfInventory ("RocketAmmo", 100, 4)
TNT1 A 0 A_JumpIfInventory ("RocketAmmo", 75, 8)
TNT1 A 0 A_JumpIfInventory ("RocketAmmo", 50, 12)
TNT1 A 0 A_JumpIfInventory ("RocketAmmo", 25, 16)
goto "FindCells"
DropRockets:
TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_SpawnItem ("RocketBox")
FindCells:
TNT1 A 0 A_JumpIfInventory ("Cell", 600, 6)
TNT1 A 0 A_JumpIfInventory ("Cell", 500, 6)
TNT1 A 0 A_JumpIfInventory ("Cell", 400, 6)
TNT1 A 0 A_JumpIfInventory ("Cell", 300, 6)
TNT1 A 0 A_JumpIfInventory ("Cell", 200, 6)
TNT1 A 0 A_JumpIfInventory ("Cell", 100, 6)
goto "TakeAmmo"
DropCells:
TNT1 AAAAAA 0 A_SpawnItem ("CellPack")
TakeAmmo:
TNT1 A 0 A_TakeInventory ("Clip", 0x7FFFFFFF)
TNT1 A 0 A_TakeInventory ("Shell", 0x7FFFFFFF)
TNT1 A 0 A_TakeInventory ("RocketAmmo", 0x7FFFFFFF)
TNT1 A 0 A_TakeInventory ("Cell", 0x7FFFFFFF)
}
}
edit - fixed some stuff
Last edited by bagheadspidey on Mon Jan 28, 2008 3:52 pm, edited 1 time in total.
- DrewbieDoobie007
- Posts: 171
- Joined: Thu Jul 24, 2003 8:12 pm
- Location: Shelton, Nebraska, USA
Re: Decorate Inventory Drop
this is excellent, but consider this, could we assign all of these as items inside of 1 custom pickup, using say, the sprites from the backpack pickup (which could me modified to look different if need-be), which is dropped when an actor dies?
Re: Decorate Inventory Drop
ZDescent, anyone?bagheadspidey wrote:I'll refine it later to get stuff to shoot outwards a little instead of spawning in a clump.
- Matt
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
- Contact:
Re: Decorate Inventory Drop
I've tried something similar (magazines that give the picking-up player the same number of rounds that they had when dropped) and I'm quite secure in saying that this is, if not impossible or unfeasible, then unacceptably hacky unless you want to completely revamp the inventory/pickup system.DrewbieDoobie007 wrote:this is excellent, but consider this, could we assign all of these as items inside of 1 custom pickup, using say, the sprites from the backpack pickup (which could me modified to look different if need-be), which is dropped when an actor dies?
Method 1: Create a new pickup for every possible combination of inventory drops. Really bad for thirty-round mags, totally not worth it for a 100-round box, and the DECORATE code alone would probably take up hundreds of megabytes uncompressed if done for all possible item combinations even in vanilla Doom.
Problems: I'll give you one guess.
Method 2: A_CustomMissile a monster that never switches targets. This monster uses a bunch of 0-length loops to extract all the items from the player as they die. It then clears its own hate target, loses the +notargetswitch flag, and has itself constantly switch between A_Look and A_See. In its melee attack this backpack monster gives its target all of its own inventory and disappears.
Problems: Unreliable; substantial risk of giving everything to someone else
Method 3: Similar to Method 2 for the drop, but after setting its inventory the backpack monster just sits there without targeting anything. It does, however, have a +quicktoretaliate flag, and a separate pain state for "pickupdamage". You then define a new key that causes the player to punch and deal "pickupdamage" to whatever's in front of them. In the backpack monster's pain.pickupdamage state, it gives its target all of its own inventory and disappears.
Problems: Requires a new key unless you want the player to switch to a specific weapon before picking anything up; no automatic pickup (EDIT: It occurs to me you can fake this by having the player constantly shoot an instantly exploding invisible projectile with a radius smaller than the player's, with the player being set not to take any "pickupdamage" damage. However, after a few bad framerate-killing experiences with lots of explosions in QuakeC I've always been leery of anything that requires a constant series of explosions to work.)
Last edited by Matt on Tue Jan 29, 2008 1:13 pm, edited 2 times in total.
- DrewbieDoobie007
- Posts: 171
- Joined: Thu Jul 24, 2003 8:12 pm
- Location: Shelton, Nebraska, USA
Re: Decorate Inventory Drop
Upon consideration, and testing some of my own variations of bigheadspidey's code there, I like the separate items droppped better anyways, I definitely see what you mean Vaecrius with the super hacky codes and I definitely dont like the idea of that. Thanks for everybody's help!