Jump to content
  • 0

MBF DeHackEd - A_Spawn, Ammo Amount Given


Swalzi

Question

I have two questions regarding DeHackEd coding. One specific to MBF and the other a general DeHackEd question.
 

1) I have an enemy that uses a plasma rifle. I gave it the "Spawn" property that forces it to drop an energy cell on death. The problem is, I want the ammo to be halved(10), not full(20). Is there anyway to halve the ammo dropped?

2) Are ammo multipliers hardcoded? I notice the big ammo boxes are multipliers of 5 and I don't seen an option to change how much ammo they give besides the small ammo pickups. Is it possible to give the player 2 rockets for one rocket, and 6 rockets for a rocket box?


-----
Thank you!

Share this post


Link to post

2 answers to this question

Recommended Posts

  • 1

I don't think either are possible. Here's vanilla Doom's pickup logic:

	// ammo
      case SPR_CLIP:
	if (special->flags & MF_DROPPED)
	{
	    if (!P_GiveAmmo (player,am_clip,0))
		return;
	}
	else
	{
	    if (!P_GiveAmmo (player,am_clip,1))
		return;
	}
	player->message = GOTCLIP;
	break;
	
      case SPR_AMMO:
	if (!P_GiveAmmo (player, am_clip,5))
	    return;
	player->message = GOTCLIPBOX;
	break;
	
      case SPR_ROCK:
	if (!P_GiveAmmo (player, am_misl,1))
	    return;
	player->message = GOTROCKET;
	break;
	
      case SPR_BROK:
	if (!P_GiveAmmo (player, am_misl,5))
	    return;
	player->message = GOTROCKBOX;
	break;
	
      case SPR_CELL:
	if (!P_GiveAmmo (player, am_cell,1))
	    return;
	player->message = GOTCELL;
	break;
	
      case SPR_CELP:
	if (!P_GiveAmmo (player, am_cell,5))
	    return;
	player->message = GOTCELLBOX;
	break;
	
      case SPR_SHEL:
	if (!P_GiveAmmo (player, am_shell,1))
	    return;
	player->message = GOTSHELLS;
	break;
	
      case SPR_SBOX:
	if (!P_GiveAmmo (player, am_shell,5))
	    return;
	player->message = GOTSHELLBOX;
	break;
	
      case SPR_BPAK:
	if (!player->backpack)
	{
	    for (i=0 ; i<NUMAMMO ; i++)
		player->maxammo[i] *= 2;
	    player->backpack = true;
	}
	for (i=0 ; i<NUMAMMO ; i++)
	    P_GiveAmmo (player, i, 1);
	player->message = GOTBACKPACK;
	break;

Notice that the bullet clip is the only one which has special handling for presence of a dropped flag. That means that a dropped ammo pickup of any other type would not be halved. Also notice that the values are 0 for dropped clip, 1 for small ammo pickup, and 5 for large ammo pickup. That means that yes, it's all hardcoded, and if you change the rocket pickup to give 2, then the rocket box will give 10.

 

There's an interesting tidbit for dropped weapons, too:

	// weapons
      case SPR_BFUG:
	if (!P_GiveWeapon (player, wp_bfg, false) )
	    return;
	player->message = GOTBFG9000;
	sound = sfx_wpnup;	
	break;
	
      case SPR_MGUN:
	if (!P_GiveWeapon (player, wp_chaingun, special->flags&MF_DROPPED) )
	    return;
	player->message = GOTCHAINGUN;
	sound = sfx_wpnup;	
	break;
	
      case SPR_CSAW:
	if (!P_GiveWeapon (player, wp_chainsaw, false) )
	    return;
	player->message = GOTCHAINSAW;
	sound = sfx_wpnup;	
	break;
	
      case SPR_LAUN:
	if (!P_GiveWeapon (player, wp_missile, false) )
	    return;
	player->message = GOTLAUNCHER;
	sound = sfx_wpnup;	
	break;
	
      case SPR_PLAS:
	if (!P_GiveWeapon (player, wp_plasma, false) )
	    return;
	player->message = GOTPLASMA;
	sound = sfx_wpnup;	
	break;
	
      case SPR_SHOT:
	if (!P_GiveWeapon (player, wp_shotgun, special->flags&MF_DROPPED ) )
	    return;
	player->message = GOTSHOTGUN;
	sound = sfx_wpnup;	
	break;
		
      case SPR_SGN2:
	if (!P_GiveWeapon (player, wp_supershotgun, special->flags&MF_DROPPED ) )
	    return;
	player->message = GOTSHOTGUN2;
	sound = sfx_wpnup;	
	break;

The chaingun, shotgun, and supershotgun have dropped flag handling. None of the other weapons do. It's interesting that they added it for the SSG, perhaps it means they thought at a time about having SSG-toting zombies in Doom II...

Share this post


Link to post
  • 0

I doubt that it works in Dehacked. It's better to use Decorate in this case (ZDoom format).

Edited by riderr3

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