Jump to content

Replacing dropped weapons for ammo


SFoZ911

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...