fuaZandroX modding reference

Actor and Weapon functions and flags

MBF21_*, A_WeaponAlert, +AVOIDHAZARDS, +STAYONLIFT, +BLOCKASPLAYER, +HIGHERMPROB, WEAPON.NOAUTOSWITCHTO

MBF21 in DECORATE

Availability

UZDoom's, under its names. Not in Zandronum 3.3.

Works in netgames. The server decides each jump, attack and move, and sends the result to every client.

Functions

The MBF21 codepointers DEHACKED reaches as A_ names also go by UZDoom's MBF21_ names. Each takes UZDoom's parameters, all of them given, and the jumps name their state first.

Monster Weapon
MBF21_SpawnObject(type, angle, xofs, yofs, zofs, xvel, yvel, zvel) MBF21_WeaponProjectile(type, angle, pitch, spawnofs_xy, spawnofs_z)
MBF21_MonsterProjectile(type, angle, pitch, spawnofs_xy, spawnofs_z) MBF21_WeaponBulletAttack(hspread, vspread, numbullets, damagebase, damagemod)
MBF21_MonsterBulletAttack(hspread, vspread, numbullets, damagebase, damagemod) MBF21_WeaponMeleeAttack(damagebase, damagemod, zerkfactor, hitsound, range)
MBF21_MonsterMeleeAttack(damagebase, damagemod, hitsound, range) MBF21_WeaponJump(state, chance)
MBF21_HealChase(healstate, healsound) MBF21_ConsumeAmmo(amount)
MBF21_JumpIfHealthBelow(state, health) MBF21_CheckAmmo(state, amount)
MBF21_JumpIfTargetInSight(state, fov), MBF21_JumpIfTracerInSight(state, fov) MBF21_RefireTo(state, skipcheck)
MBF21_JumpIfTargetCloser(state, distance), MBF21_JumpIfTracerCloser(state, distance) MBF21_GunFlashTo(state, dontchangeplayer)
MBF21_JumpIfFlagsSet(state, flags, flags2), MBF21_AddFlags(flags, flags2), MBF21_RemoveFlags(flags, flags2)
MBF21_SeekTracer(threshold, turnmax)

A chance is out of 256. flags takes DEHACKED's vanilla Bits values and flags2 its MBF21 Bits values. The closer checks measure across the ground, as MBF21's do.

A_WeaponAlert(), on a weapon, wakes every monster that can hear the player, as a shot would, without a shot.

Flags

Flag Effect
+AVOIDHAZARDS A walker turns away from a step under a moving crusher or onto a floor that hurts it (MBF's smart move).
+STAYONLIFT A walker riding a lift its target's sector shares a tag with mostly stays on it.
+BLOCKASPLAYER Lines that block players block this actor too.
+HIGHERMPROB The monster fires more often (MinMissileChance 160). Deprecated in UZDoom; kept for old mods.
+WEAPON.NOAUTOSWITCHTO Picking up ammo never switches to this weapon.

Examples

// A zombie written with UZDoom's MBF21 names: it bites up close, fires a three-round burst further out, and goes berserk under half health.
actor MBFZombie : ZombieMan
{
    States
    {
    See:
        POSS A 0 MBF21_JumpIfHealthBelow("Berserk", 10)
        POSS AABBCCDD 4 A_Chase
        Loop
    Missile:
        POSS E 0 MBF21_JumpIfTargetCloser("Bite", 96)
        POSS E 10 A_FaceTarget
        POSS F 8 MBF21_MonsterBulletAttack(11.25, 0, 3, 3, 5)
        POSS E 8
        Goto See
    Bite:
        POSS E 6 A_FaceTarget
        POSS F 6 MBF21_MonsterMeleeAttack(3, 8, "imp/melee", 64)
        Goto See
    Berserk:
        POSS AABBCCDD 2 A_Chase
        Loop
    }
}
// A cacodemon that sinks when hurt: it loses NOGRAVITY (vanilla bit 512) and gains LOGRAV (MBF21 bit 1), then floats again once it heals.
actor SinkingCaco : Cacodemon
{
    States
    {
    Pain:
        HEAD E 0 MBF21_JumpIfFlagsSet("Sunk", 0, 1)
        HEAD E 3 MBF21_RemoveFlags(512, 0)
        HEAD E 3 MBF21_AddFlags(0, 1)
        HEAD F 6 A_Pain
        Goto See
    Sunk:
        HEAD F 6 A_Pain
        Goto See
    }
}
// A plasma rifle written with the MBF21 weapon names: two cells a shot, a stray bolt one time in three, and a refire.
actor MBFPlasmaRifle : Weapon
{
    Weapon.SlotNumber 6
    Weapon.AmmoType "Cell"
    Weapon.AmmoGive 40
    Weapon.AmmoUse 0
    States
    {
    Ready:
        PLSG A 1 A_WeaponReady
        Loop
    Deselect:
        PLSG A 1 A_Lower
        Loop
    Select:
        PLSG A 1 A_Raise
        Loop
    Fire:
        PLSG A 0 MBF21_CheckAmmo("Dry", 2)
        PLSG A 0 MBF21_GunFlashTo("Flash", 0)
        PLSG A 3 MBF21_WeaponProjectile("PlasmaBall", 0, 0, 0, 0)
        PLSG A 0 MBF21_ConsumeAmmo(2)
        PLSG A 0 MBF21_WeaponJump("Stray", 85)
        PLSG B 20 MBF21_RefireTo("Fire", 0)
        Goto Ready
    Stray:
        PLSG A 3 MBF21_WeaponProjectile("PlasmaBall", 6, 0, 0, 0)
        PLSG B 20
        Goto Ready
    Dry:
        PLSG A 10
        Goto Ready
    Flash:
        PLSF A 4 Bright A_Light1
        Goto LightDone
    Spawn:
        PLAS A -1
        Stop
    }
}
// A knife that kills quietly, and a war cry on the alt-fire that brings every monster within earshot.
actor WarCryKnife : Weapon
{
    Weapon.SlotNumber 1
    +WEAPON.NOAUTOSWITCHTO
    +WEAPON.NOALERT
    States
    {
    Ready:
        PUNG A 1 A_WeaponReady
        Loop
    Deselect:
        PUNG A 1 A_Lower
        Loop
    Select:
        PUNG A 1 A_Raise
        Loop
    Fire:
        PUNG B 4
        PUNG C 4 A_CustomPunch(10, true)
        PUNG D 5
        PUNG C 4
        PUNG B 5 A_ReFire
        Goto Ready
    AltFire:
        PUNG A 10 A_WeaponAlert
        Goto Ready
    Spawn:
        CSAW A -1
        Stop
    }
}
// A careful imp that steps around crushers and lava, rides lifts after the player, keeps behind player-only lines and fires often.
actor CarefulImp : DoomImp
{
    +AVOIDHAZARDS
    +STAYONLIFT
    +BLOCKASPLAYER
    +HIGHERMPROB
}

Implementation notes

src/zandronum/src/features/mbf21/.