Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sky

Replacing dropped weapons for ammo

Recommended Posts

I'm working on a small addon and I replaced all existing weapons in the doom arsenal and I want to change the weapons that are dropped by dead zombies for ammo. The thing is I want to keep the weapon sprite so it could be picked up by the player for ammo but not usable by the player(since he have new weapons for that matter).

Any idea how I can achieve that?

Share this post


Link to post

Make it a Custom Inventory, with spawn sprite = the weapon sprite, but using A_GiveInventory to actually give ammo to the player, and let enemies drop it via DropItem. Or perhaps, instead of CustomInventory, make it a regular ammo type derived from an ammo type of your player's weapon, and set its spawn sprite to look like the monster's weapon (and maybe edit pickup sound).

There is also an alternative way to achieve it without altering DECORATE of any enemies, which might be useful if you want your weapon mod be compatible with "foreign" monster mods, but this alternative way is a lot more complicated to explain, and so I won't bring it up unless you tell me that you're interested in doing it that way (=without altering monster DECORATE).

Share this post


Link to post

Do you mean you want them to drop guns similar to SS officers in Wolf 3D where they drop a gun the first time then drop ammo when you have the gun?

Share this post


Link to post

I believe that he just wants Shotgunguys to drop shotguns and Chaingunners to drop chainguns as usual, and they would also look like shotguns/chainguns as usual, except that the player won't get the weapons upon picking them up, only their ammo (4 shells for a shotgun, 10 bullets for a chaingun).

Share this post


Link to post

Yea, exactly what scifista said. I have no problem altering any monster behavior. I basically want to have something like heretic where the only weapons you can pick up are the weapons that have been placed by the mapper. It's for weapon balance. The reason I want to keep the weapon sprite pickup is for more of a cosmetic thing, you know since they're holding weapons.

Share this post


Link to post

Zombiemen carry rifles and drop pistol clips. But yeah the only way I can think of is to create a new "thing" which is the ammo with the gun sprite and edit them to drop those instead of the guns. But I may just be completely wrong or overcomplicating it unintentionally.

Share this post


Link to post

Yea but I don't have any good sprite that resembles that rifle. If you have any suggestions, I'll be more than happy to hear about it.

Share this post


Link to post

There's a rifle sprite floating around which looks to be based on a rough M4 carbine design, most commonly seen in BD where the zombiemen drop rifles instead of clips. I'm not sure if you want this though since Doomguy doesn't have a rifle (despite ironically having a rifle on his sprite like the zombiemen)

Share this post


Link to post

I'll take a look, thanks. Also scifista if you have the nerves to explain to me the other method I'll be happy to hear about it.

Share this post


Link to post

I will describe the process for a shotgun, then you can mimic it for the chaingun and possibly any other weapons too.

Basically, you make the Shotgunguy's dropped weapon to replace the original shotgun (instead of your weapon replacement), but you also make it change itself to your custom weapon's pickup upon being spawned otherwise than dropped by a Shotgunguy.

So, the steps:

1. Go to definition of your custom shotgun replacement. I assume you're using a keyword "replaces Shotgun" to make it replace the original shotgun. Remove this "replacing Shotgun" text from the definition. Now the weapon's definition header should look for example like this:

Actor SFoZ911_Shotgun : DoomWeapon {
2. Define the Shotgunguy's shotgun pickup as a CustomInventory this way:
Actor DummyShotgun : CustomInventory replaces Shotgun {
    Inventory.PickupSound "xyz" // whatever sound you want it to play upon pickup
    Inventory.PickupMessage "xyz" // whatever message you want it to display upon pickup
    States {
      Spawn:
        TNT1 A 0
        TNT1 A 0 A_CheckFlag("DROPPED","DummySpawn")
        TNT1 A 0 A_SpawnItemEx("SFoZ911_Shotgun")
        stop
      DummySpawn:
        SHOT A -1
        stop
      Pickup:
        TNT1 A 0 A_GiveInventory("Shell",4)
        stop
    }
}
Explanation: Upon being spawned, the thing checks if it has DROPPED flag. If yes (=it's dropped by a monster), the thing will continue being a Shotgunguy's shotgun pickup that only gives ammo to the player. If no (=it's normally placed in the map), the thing will spawn your custom shotgun in its place and remove itself.

The very first seemingly useless "TNT1 A 0" in the pickup's definition is actually necessary as a dummy first frame that enables the consequent frame's action to be executed, because the engine never executes actions on the very first frame after a thing is spawned.

I haven't tested it at the moment, but I remember getting something very similar to work once. So even if this guide turned out non-working, I'm sure there would be a fix or workaround to make the principle work.

Share this post


Link to post

It worked like a charm, gonna try to do the same for the heavy weapon dude. Thank you very much sir!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×