Jump to content
  • 0

main weapon appears out of ammo and more


IronLich86

Question

Hi everyone!
I have created a new weapon with which you start the level. The problem is that it appears with zero ammo, but in the status bar it says that you start with 50 ammo.
here the code:

 

DECWEAPS:

ACTOR NewPistol : Pistol
{
	Weapon.SelectionOrder 1900
	+WEAPON.WIMPY_WEAPON
	Weapon.AmmoType "NewClip"
	Weapon.AmmoUse 1
	Weapon.AmmoGive 20
	Weapon.SlotNumber 2

	States
	{
	Deselect:
		TNT1 A 0 A_Lower
		PISG A 1 A_Lower
		Loop
	Select:
		TNT1 A 0 A_Raise
		PISG A 1 A_Raise
		Loop
	Fire:
		PISG A 4
		PISG A 6 A_FirePistol
		PISG A 4
		PISG A 5 A_ReFire
		Goto Ready
	Flash:
		PISF A 7 Bright A_Light1
		Stop
	}
}

 

DECAMMO:

ACTOR NewClip : Clip replaces Clip
{
	Inventory.Amount 10
	Inventory.MaxAmount 200
	Inventory.PickupMessage "Got an ammo clip"

	States
	{
	Spawn:
		CLIP B -1
		Stop
	}
}

 

DECORATE:


#include "DECWEAPS"
#include "DECAMMO"
#include "DECHEAL"


ACTOR NeoDoomGuy : DoomPlayer replaces DoomPlayer
{
	Player.DisplayName "NeoMarine"
	Player.StartItem "NewPistol"
	Player.StartItem "NewFist"
	Player.StartItem "NewClip", 50

	Player.WeaponSlot 1, "NewFist"
	Player.WeaponSlot 2, "NewPistol"
}

 

The other problem, in the same mod, is when using the IDFA and IDKFA cheats. When activated it gives all weapons but without maximum ammo, and the status bar shows
max ammo.

 

Does anyone know where the problem comes from?

 

Thanks.

 

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0

The only "error" I see here is that you're trying to "replace" the "DoomPlayer" actor while you shouldn't.

 

So, remove the "replaces" part and add this 

GameInfo
{
	PlayerClasses = "NeoDoomGuy"
}

in your MAPINFO lump.

 

Try if this changes anything

Share this post


Link to post
  • 0

I've seen that I can't pick up the new ammo either, but the ammunition is displayed correctly in the map editor (Ultimate Doom Builder).

 

Type: 2007 - Ammo clip
Class: New Clip

Share this post


Link to post
  • 0

Okay, modifying weapons and ammo in DECORATE is a bit funky. A few problems right off the bat:

 

1. When making a NEW AMMO TYPE, instead of inheriting from "Clip" or an existing ammo type, you must inherit from the parent class "Ammo". So this

ACTOR NewClip : Clip replaces Clip

is not going to work, and should instead be this:

ACTOR NewClip : Ammo replaces Clip

Whenever you inherit from an already-defined ammo type, ZDoom will interpret it as an alternate pickup for the same kind of ammo. This is useful for making small/medium/large ammo pickups, like how in vanilla doom there are shells and boxes of shells, rockets and boxes of rockets, and so on. Your original code there isn't working because of this, but it's a simple fix.

 

2. The status bar

Unfortunately, you're going to have to make some adjustments to your status bar using SBARINFO if you want non-standard ammo types to display there. If you don't want to go through the effort of modifying the status bar, you can alternatively use the Alt-hud and tell it to ignore the original ammo types (if they're not being used anywhere).

 

 

If you would like an example of these things, I would recommend you take a look through this mod that I made recently: BackpackMod.zip

It's a very simple replacement for the backpack in gameplay, but under the hood I had to do a lot of things to make it work properly when the player uses cheats or console commands to give themselves the vanilla backpack. Take a look at it in SLADE to see what exactly had to be done to get the custom ammo types to function properly.

 

 

I hope this all makes sense. If you have any further questions, feel free to ask.

Edited by SMG_Man

Share this post


Link to post
  • 0

OH YEAH! Now it works! As you said, I have to modify the status bar.

 

Thank you very much for the help and for the example! It has been very good for me to understand how the status bar works and to be able to modify it. The only problem is that I can't get them to show up.

 

ACTOR NewBlueCard : Key replaces BlueCard
{
	Radius 20
	Height 16
	+NOTDMATCH
	Species "BlueCard"
	Inventory.PickupMessage "Blue access diskette"
	Inventory.Icon "STKEYS0"

	States
	{
	Spawn:
		BKEY A -1
		Stop
	}
}

ACTOR NewYellowCard : Key replaces YellowCard
{
	Radius 20
	Height 16
	+NOTDMATCH
	Species "YellowCard"
	Inventory.PickupMessage "Yellow access diskette"
	Inventory.Icon "STKEYS1"

	States
	{
	Spawn:
		YKEY A -1
		Stop
	}
}

ACTOR NewRedCard : Key replaces RedCard
{
	Radius 20
	Height 16
	+NOTDMATCH
	Species "RedCard"
	Inventory.PickupMessage "Red access diskette"
	Inventory.Icon "STKEYS2"

	States
	{
	Spawn:
		RKEY A -1
		Stop
	}
}

ACTOR NewBlueSkull : Key replaces BlueSkull
{
	Radius 20
	Height 16
	+NOTDMATCH
	Species "BlueCard"
	Inventory.PickupMessage "Blue crux access key"
	Inventory.Icon "STKEYS3"

	States
	{
	Spawn:
		BSKU A -1
		Stop
	}
}

ACTOR NewYellowSkull : Key replaces YellowSkull
{
	Radius 20
	Height 16
	+NOTDMATCH
	Species "YellowCard"
	Inventory.PickupMessage "Yellow crux access key"
	Inventory.Icon "STKEYS4"

	States
	{
	Spawn:
		YSKU A -1
		Stop
	}
}

ACTOR NewRedSkull : Key replaces RedSkull
{
	Radius 20
	Height 16
	+NOTDMATCH
	Species "RedCard"
	Inventory.PickupMessage "Red crux access key"
	Inventory.Icon "STKEYS5"

	States
	{
	Spawn:
		RSKU A -1
		Stop
	}
}

 

	DrawSwitchableImage keyslot 2 && 5, "nullimage", "STKEYS0", "STKEYS3", "STKEYS6", 239, 171;
	DrawSwitchableImage keyslot 3 && 6, "nullimage", "STKEYS1", "STKEYS4", "STKEYS7", 239, 181;
	DrawSwitchableImage keyslot 1 && 4, "nullimage", "STKEYS2", "STKEYS5", "STKEYS8", 239, 191;

 

Modified keys work fine and open doors, but they don't show up in the status bar, except when I use the IDKFA cheat. I do not know what I'm doing wrong.

 

Is there a difference between the Key Card and Skull Key keys? I see they will open the same door.

Share this post


Link to post
  • 0
1 hour ago, IronLich86 said:

Is there a difference between the Key Card and Skull Key keys? I see they will open the same door.

In the original Doom, no. ZDoom however allows you to make doors that are skull-key or keycard specific for each type (as well as some more locks, such as for a door that needs all 6 keys).
 

 

1 hour ago, IronLich86 said:

Modified keys work fine and open doors, but they don't show up in the status bar, except when I use the IDKFA cheat. I do not know what I'm doing wrong.

This is another tricky one. If you look at the part of the Status Bar definition for each key, you'll notice this:

DrawSwitchableImage keyslot X && Y

 

What this is saying is when the player picks up the key needed for lock X or lock Y, the little inventory icon will be drawn in the specified part of the HUD (and if they have both keys, it'll draw the little graphic with both the keycard and skullkey). In order to see what key corresponds to each locknumber, you'll need to check the game's default LOCKDEFS lump. The list of lock numbers can be found here, but the actual definitions are in "lockdefs.txt" inside of gzdoom.pk3. The important definitions for the HUD are the following:

 

Spoiler

Lock 1 Doom
{
    //$Title "Red key card"
    RedCard
    Message "$PD_REDC"
    RemoteMessage "$PD_REDCO"
    Mapcolor 255 0 0
}


Lock 2 Doom
{
    //$Title "Blue key card"
    BlueCard
    Message "$PD_BLUEC"
    RemoteMessage "$PD_BLUECO"
    Mapcolor 0 0 255
}


Lock 3 Doom
{
    //$Title "Yellow key card"
    YellowCard
    Message "$PD_YELLOWC"
    RemoteMessage "$PD_YELLOWCO"
    Mapcolor 255 255 0
}


Lock 4 Doom
{
    //$Title "Red skull"
    RedSkull
    Message "$PD_REDS"
    RemoteMessage "$PD_REDSO"
    Mapcolor 255 0 0
}


Lock 5 Doom
{
    //$Title "Blue skull"
    BlueSkull
    Message "$PD_BLUES"
    RemoteMessage "$PD_BLUESO"
    Mapcolor 0 0 255
}


Lock 6 Doom
{
    //$Title "Yellow skull"
    YellowSkull
    Message "$PD_YELLOWS"
    RemoteMessage "$PD_YELLOWSO"
    Mapcolor 255 255 0
}

 

So let's look back at the three "DrawSwitchableImage" things you highlighted in your post. The first one is for "Keyslot 2 && 5", which would be the Blue keycard (Lock 2) and the Blue skull key (Lock 5). The inventory items specified for these locks are the default keys, meaning that if you want your new keys to appear in the status bar when you pick them up, (you guessed it!) much like with getting SBARINFO to have your new ammo types, you will need to replace the entire LOCKDEFS lump.

 

Fortunately this process is really easy; all you have to do is copy and paste the original doom lock definitions in the GZDoom pk3 into a new lump titled "LOCKDEFS", and use Find-and-replace (ctrl-F) in SLADE to change the original key names with your new key actor names. You shouldn't have to tweak anything in SBARINFO for this.

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
Answer this question...

×   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...