monster_barney

monster_barney #

TWHL

Changes #

  • Checks for friendly fire when shooting.
  • Now uses alert sentences (BA_ATTACK) when encountering enemy.
  • Can set a custom head if the model has multiple heads. The bodygroup index 2 is supposed to be the head bodygroup, i.e. the following order is expected : body, gun, heads (the actual naming doesn’t matter. Also the first bodygroup is expected to have only 1 submodel. Multiple bodies are not supported for barney yet).
  • If the model has a sequence with the ACT_MELEE_ATTACK1 activity, barney can use melee attacks. To make the melee attack actually do something you must define the animation events in the sequence and trace_hull_attacks in the entity template (see Entity template examples).

New parameters #

  • Gun state allows to spawn a security guard with a gun drawn.

Skill variables #

  • sk_barney_health - monster’s health.
  • sk_9mm_bullet - handgun bullet damage.
  • sk_357_bullet - Python bullet damage.

Default classification #

Player Ally

Default display name #

Security Guard

Soundscripts #

  • Barney.Pain - pain sound.
  • Barney.Die - death sound.
  • Barney.FirePistol - firing a handgun.
  • Barney.FirePython - firing a Python. Derived from NPC.Python.

Animation events #

  • 2 - draw a weapon
  • 3 - fire a weapon. Play Barney.FirePistol or Barney.FirePython soundscripts.
  • 4 - holster a weapon.

Entity template examples #

Barney’s evil twin from Sven Co-op.

{
    "barnabus": {
        "own_visual": {
            "model": "models/barnabus.mdl"
        },
        "classify": "Human Military"
    }
}

The trace attack rules that emulate monster’s native ones. Could be used as a starting point for further changes.

{
    "monster_barney": {
        "trace_attack": [
            {
                "conditions": {
                    "hitgroup": ["chest", "stomach"],
                    "dmg_type": ["bullet", "slash", "club"]
                },
                "modifier": {
                    "dmg": "*0.5"
                }
            },
            {
                "conditions": {
                    "hitgroup": 10,
                    "dmg_type": ["bullet", "slash", "club"]
                },
                "modifier": {
                    "dmg": "-20",
                    "dmg_min_threshold": 0.01,
                    "hitgroup": "head"
                },
                "threshold_effects": {
                    "ricochet": {
                        "chance": 1.0,
                        "scale": 1
                    }
                }
            },
            {
                "conditions": {
                    "hitgroup": 10
                },
                "modifier": {
                    "hitgroup": "head"
                }
            }
        ]
    }
}

Make Barney use reload by limiting the clip size:

{
    "monster_barney": {
        "primary_weapon": [
            {
                "max_clip": 17
            }
        ]
    }
}

This considers the model has event of id 6 on its sequence with ACT_MELEE_ATTACK1 activity.

{
    "monster_barney": {
        "trace_hull_attacks": {
            "6": {
                "distance": 70,
                "punchangle": {
                    "roll": 5
                },
                "knock": {
                    "forward": 80,
                    "up": 50
                },
                "damage_info": {
                    "damage": "hgrunt_kick",
                    "type": "club"
                },
                "hit_soundscript": {
                    "channel": "item",
                    "waves": ["common/punch.wav"]
                }
            }
        }
    }
}