Modding Help Enemy NPC fire rate

Discussion in 'Starbound Modding' started by Vaderzin, Dec 16, 2022.

  1. Vaderzin

    Vaderzin Scruffy Nerf-Herder

    How can I mod the NPC behaviors so that they fire a gun faster or hold the trigger when using an assault rifle, for exemple.
     
  2. rl.starbound

    rl.starbound Phantasmal Quasar

    NPC behaviors are controlled by behavior trees under the /behaviors directory structure. Behavior files use a custom JSON format that consists of nested lists of nodes, and each node in the behavior tree wraps a small, composable Lua script. In theory, this allows someone versed in behavior trees to build and edit complex behaviors without having to understand Lua code. In practice, well, let's just say that behavior mods are the most difficult and stressful mods I've made.

    There is a (very old, likely abandoned) GUI editor for these files that the Starbounder wiki recommends, but in my opinion, it doesn't actually help in any significant way. The editor does the (relatively easy) job of creating/editing the JSON syntax for you, but the far, far more important and difficult job of understanding and reasoning about the semantics is still entirely up to you. As a result, I don't bother to use the editor, and just hand-edit the behavior files in the few cases in which I have, out of desperation, resorted to editing behaviors.

    Behaviors are very difficult to reason about, extremely difficult to debug, and making even a minor mistake can have very far reaching consequences on the game play. In other words, you can try to make a mod to behavior X in one part of the game, and a mistake you make won't be obvious until you've observed behavior Z in a totally different part of the game. In general, I think there is a reason why very few modders attempt to make major changes to behaviors.

    You might want to check out Supper's Combat Overhaul. Sentient Supper is the only modder I know of who dared to delve deeply into NPC behaviors, so what you're looking for may already exist in that mod. Keep in mind, that mod is not without bugs; it introduces a number of bugs in NPC movement and behavior (not knocking Supper, just indicating the difficulty of reasoning about behaviors), so you'll have to decide whether the improved NPC tactics are worth it.
     
  3. marky04

    marky04 Scruffy Nerf-Herder

    Seeing as NPCs shooting assault rifles don't track the player, is it possible to override this beyond the behaviors? I was thinking a Lua script that works separate from the behavior tree that just changes the rotation of the NPC's firing to track the player. Just a thought.
     

Share This Page