<aside> ⚠️ Warning: Before beginning this tutorial, you should have already read through and completed the tutorial for creating a basic weapon, advanced weapon, and assist item. Buster upgrades build on the concepts of all of these types of items!
</aside>
Buster upgrades are a class of assist item which give you a new default weapon in lieu of the Mega Buster whenever activated. As you might be able to imagine, this means that in their implementation, they’re a mix between assist items and weapons.
Although this may sound daunting, it actually makes them fairly easy to implement so long as you already understand implementing those other two groups. This page will implement a Proto Strike buster upgrade, inspired by Proto Man’s gameplay from Mega Man Powered Up.
Let’s start by showing the item pickup portion of our Buster Upgrade.
actor ProtoStrikeUpgrade : BaseMM8BDMBusterUpgrade
{
inventory.pickupmessage "$PU_PROTOSTRIKE"
Inventory.pickupsound "item/1up"
inventory.icon "PTROSTRK"
tag "$TAG_PROTOSTRIKEUPGRADE"
inventory.amount 1
inventory.maxamount 1
Inventory.respawntics 350
States
{
SpawnLoop:
PRST A 1
loop
Use:
TNT1 A 0 A_PlaySoundEx("item/refill", "Voice")
TNT1 A 0 A_GiveInventory("BusterGiven",1)
TNT1 A 0 A_GiveInventory("ProtoStrike",1)
TNT1 A 0 A_SelectWeapon("ProtoStrike")
stop
}
}
actor ProtoStrikeUpgrade_Respawn : 8BDMItemRespawn
{
translation "192:192=87:87", "198:198=42:42"
mass 350
}
actor ProtoStrikeUpgrade_RespawnShadow : 8BDMItemRespawnShadow
{
mass 350
States
{
Spawn:
PRST A 0
goto Super::Spawn
}
}
Unlike assist items, every buster upgrade inherits from [BaseMM8BDMBusterUpgrade](<https://mm8bdm.notion.site/BaseMM8BDMBusterUpgrade-ce8d4a6a853145708028a62aa8b1c1db>)
. This parent actor automatically handles some logic on pickup regarding whether a player should be able to pick the buster upgrade up or not.
The Use
state for the buster upgrade should more or less always look like this one, so let’s walk through what this one is doing.
Use:
TNT1 A 0 A_PlaySoundEx("item/refill", "Voice")
TNT1 A 0 A_GiveInventory("BusterGiven",1)
TNT1 A 0 A_GiveInventory("ProtoStrike",1)
TNT1 A 0 A_SelectWeapon("ProtoStrike")
stop
First, it plays the activation sound. Next, it gives an internally defined BusterGiven
flag. This is just a simple inventory item that will come in handy later. Next, we give the actual buster weapon which we’re about to define. Once that’s given, we use A_SelectWeapon
to attempt to force swap the player to the newly given weapon.
The ProtoStrikeUpgrade_Respawn
and ProtoStrikeUpgrade_RespawnShadow
should look familiar to the similar actors created for assist items. For brevity sake, the details won’t be repeated here, but they function exactly the same for buster upgrades as they do for assist items. See the assist item tutorial for details if you’ve forgotten or skipped ahead.
Now that we’ve seen what the item portion of our buster upgrade looks like, let’s take a look at the weapon and pinpoint some of the new elements.
actor ProtoStrike_MugshotColor : MugshotColor { args 87, 42 }
actor ProtoStrike : BaseMM8BDMWep
{
Weapon.AmmoUse 1
Weapon.AmmoGive 3
weapon.ammotype "BusterAmmo"
Weapon.SlotNumber 1
Inventory.Pickupmessage "$PU_PROTOSTRIKE"
Obituary "$OB_PROTOSTRIKE"
Tag "$TAG_PROTOSTRIKE"
inventory.icon "NULLICON"
Dropitem ""
States
{
SpawnLoop:
PRST A 1
stop
Ready:
PRST B 0 A_JumpIfInventory("BusterGiven",1,"TakeBusters")
Goto Ready2
TakeBusters:
PRST B 0 A_GiveInventory("TakeBuster", 1)
Goto Ready2
Ready2:
PRST B 0 ACS_NamedExecuteWithResult("core_weaponcolor", CLR_PROTOBUSTER)
PRST B 1 A_WeaponReady
Goto Ready2+1
Select:
PRST B 0
goto SelectSwap
Deselect:
PRST B 0
goto DeselectSwap
Fire:
PRST B 0 A_PlaySoundEx("weapons/busters/protostrikefire", "Weapon")
PRST B 0 A_FireCustomMissile("ProtoStrikeShot", 0, 0, 8, 0)
PRST B 0 A_ChangeVelocity(-cos(pitch)*9, 0, sin(pitch)*9, CVF_RELATIVE)
PRST CDEFGH 2
PRST B 17
PRST B 0 A_Refire
goto Ready2+1
}
}
If you remember from earlier tutorials, weapons typically will have an ammo bar and thus a NormalBar
actor associated with it, but what to do with buster upgrades which are typically infinite ammo?
We still want some mechanism that defines colors for the weapon, otherwise Maestro’s mugshot won’t look quite right while holding the weapon. That’s where the MugshotColor
actor comes in. The below code defines that Maestro’s mugshot should use palette color 87 for the cyan portion and palette color 42 for the blue portion, but does it without drawing any ammo bar.
actor ProtoStrike_MugshotColor : MugshotColor { args 87, 42 }