<aside> ⚠️ Warning: Before beginning this tutorial, you should already have some experience with DECORATE and ACS. It is also helpful to come into this knowing how to implement custom graphics and implement custom sounds.
</aside>
Weapons are the mechanic that drives vanilla Mega Man 8-Bit Deathmatch, so it is inevitable to want to create custom weapons that interact nicely with the weapons already existing in the game.
Thankfully, weapons are just a combination of one main weapon actor and a multitude of projectile or accessory actors, so we can still use our knowledge of DECORATE when creating weapons. Additionally, Mega Man 8-Bit Deathmatch provides many base actors to inherit from and ACS functions to use when defining some properties specific to weapons.
This tutorial will walk through the setup and creation of a basic minimum weapon. It’s recommended to try following along with your own project file, but don’t worry if you get lost, as a file with everything is provided at the end.
We can begin creating a weapon by first understanding the basic properties and states needed to make a weapon function.
actor NotMegaBuster : BaseMM8BDMWep
{
Weapon.AmmoUse 1
Weapon.AmmoGive 28
weapon.ammotype "NotBusterAmmo"
Weapon.SlotNumber 3
Inventory.Pickupmessage "Power Up! Mega Buster!"
Obituary "%o was bombed by %k's Mega Buster."
Tag "Mega Buster"
inventory.icon "NULLICON"
States
{
SpawnLoop:
WEAP X 1
loop
Ready:
BUST B 0 ACS_NamedExecuteWithResult("core_weaponcolor", CLR_MEGABUSTER)
BUST B 1 A_WeaponReady
goto Ready+1
Select:
BUST B 0
goto SelectSwap
Deselect:
BUST B 0
goto DeselectSwap
Fire:
BUST B 0 A_JumpIfNoAmmo("NoAmmo")
BUST B 0 A_PlaySoundEx("weapons/busters/megabusterfire","Weapon")
BUST B 0 A_FireCustomMissile("MegaShot",0,1,8,0)
BUST CD 3
BUST B 2
BUST B 0 A_Refire
goto Ready+1
NoAmmo:
BUST B 1 ACS_NamedExecuteAlways("core_noammo",0)
goto Ready+1
}
}
The code above defines a weapon that can be a template called NotMegaBuster
, an almost copy of the Mega Buster. We begin by inheriting from [BaseMM8BDMWep](<https://mm8bdm.notion.site/BaseMM8BDMWep-8cc600ca63704fd59c44528ca4060cac>)
, an actor that already exists in Mega Man 8-Bit Deathmatch that sets up some of the more nitty gritty states such as DeselectSwap
and SelectSwap
which are being jumped to, but do not exist in our weapon that we’ve just created.
Every weapon should define a few properties that describe its unique attributes.
We define a few ammo-based properties unique to our weapon, such as the amount of ammo it uses per shot, the amount of ammo received when picking up our weapon, and the actor name of the ammo used for our weapon.
Weapon.AmmoUse 1
Weapon.AmmoGive 28
weapon.ammotype "NotBusterAmmo"
This ammo type must correspond to an actor that exists, so in this case, we would have an actor which looks like the following.
actor NotBusterAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}
We also need to define a slot number for our weapon. This slot number corresponds to the scroll order of weapons and which number players can use to instantly swap to the weapon. The convention for Mega Man 8-Bit Deathmatch is to indicate the type of weapon it is via its slot number. We can use the following numbers to indicate the following slots.
SLOT_BUSTER
: 1SLOT_RANGED
: 2SLOT_RAPID
: 3SLOT_CLOSE
: 4