Classes:PowerWeaponLevel2

From ZDoom Wiki
Jump to navigation Jump to search
Note: Wait! Stop! You do not need to copy this actor's code into your project! Here's why:
  1. This actor is already defined in GZDoom, there's no reason to define it again.
  2. In fact, trying to define an actor with the same name will cause an error (because it already exists).
  3. If you want to make your own version of this actor, use inheritance.
  4. Definitions for existing actors are put on the wiki for reference purpose only.
Enhanced weapon power
Actor type Power Game MiniZDoomLogoIcon.png (ZDoom)
DoomEd Number None Class Name PowerWeaponLevel2


Classes: InventoryPowerupPowerWeaponLevel2

PowerWeaponLevel2 is an internal class. An item of this class is placed in the player's inventory while the player's weapons are powered-up, like the power-up given by the tome of power from Heretic.

To make powered-up weapons, you must add the flag POWERED_UP to the powered up weapon and add the Weapon.SisterWeapon property to both weapons (powered-up and normal). If a weapon has no powered-up sister weapon, PowerWeaponLevel2 has no effect on it.

Here's an example:

This is the normal weapon

ACTOR AK47 : Weapon
{
	Inventory.PickupSound "misc/pkup" 
	Inventory.PickupMessage "You got the AK47!" 
	Weapon.AmmoType "Clip" 
	Weapon.AmmoGive 60
	Weapon.AmmoUse 1
	Weapon.SisterWeapon AK9000
	AttackSound "weapons/pistol" 
	Obituary "%o was mowed down by %k's AK47."
	States 
	{ 
	Spawn: 
		SK74 A -1 
		Loop 
	Ready: 
		AK47 A 1 A_WeaponReady 
		Loop 
	Deselect: 
		AK47 A 1 A_Lower 
		Loop 
	Select: 
		AK47 A 1 A_Raise 
		Loop 
	Fire: 
		AK47 A 0 A_GunFlash
		AK47 A 4 A_FireBullets(5, 0, 1, 5, 0, 1)
		AK47 B 4 A_FireBullets(5, 0, 1, 5, 0, 1)
		AK47 B 0 A_ReFire
		goto Ready
	Flash: 
		AKFL A 5 BRIGHT A_Light1 
		AKFL B 5 BRIGHT A_Light0 
		Stop 
	} 
} 

And this is the powered up weapon

ACTOR AK9000 : AK47
{ 
	+POWERED_UP 
	Weapon.AmmoGive 0 
	Weapon.SisterWeapon AK47
	States 
	{ 
	Fire: 
		AK47 A 0 A_GunFlash
		AK47 A 2 A_FireBullets(5, 3, 3, 4, 0, 1)
		AK47 B 2 A_FireBullets(5, 3, 3, 4, 0, 1)
		AK47 B 0 A_ReFire
		goto Ready 
	Flash: 
		AKFL A 3 BRIGHT A_Light1 
		AKFL B 3 BRIGHT A_Light0 
		Stop 
	}
} 

DECORATE definition

ACTOR PowerWeaponLevel2 : Powerup native
{
  Powerup.Duration -40
  Inventory.Icon "SPINBK0"
  +INVENTORY.NOTELEPORTFREEZE
}