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

MBF DeHackEd - A_Spawn, Ammo Amount Given

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
Posted (edited)

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

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
×