1. Welcome to the Starbound support forums. Please check the support FAQs before posting: http://playstarbound.com/support

Bug/Issue spawnNpc behavior node uses "type", but world.lua expects "npcType"

Discussion in 'Starbound Support' started by VOSAbeka, Aug 27, 2026.

  1. VOSAbeka

    VOSAbeka Void-Bound Voyager

    Hello everyone,

    First of all, I would like to thank Chucklefish for creating Starbound. It truly is a wonderful game. I have been playing it for ten years, and it has brought me a great deal of joy throughout that time.

    While examining the vanilla Starbound assets, I found a parameter name mismatch between two files.

    In /behaviors/nodes/world.nodes, the spawnNpc behavior node declares the NPC type parameter as:

    Code:
    "type": {
      "type": "json",
      "value": null
    }
    
    However, in /scripts/actions/world.lua, the spawnNpc(args, board) function checks and uses args.npcType:

    Code:
    if not args.position or not args.species or not args.npcType or not args.level then
      return false
    end
    
    local entityId = world.spawnNpc(
      args.position,
      args.species,
      args.npcType,
      args.level,
      args.seed,
      args.parameters
    )
    
    The behavior node supplies this value as args.type, while the Lua implementation reads args.npcType.

    Because of this mismatch, the vanilla spawnNpc behavior action returns false when it is configured according to the parameter name declared in world.nodes.

    A backward-compatible fix could be:

    Code:
    local npcType = args.npcType or args.type
    
    if not args.position or not args.species or not npcType or not args.level then
      return false
    end
    
    local entityId = world.spawnNpc(
      args.position,
      args.species,
      npcType,
      args.level,
      args.seed,
      args.parameters
    )
    
    Alternatively, the parameter in world.nodes could be renamed from "type" to "npcType". However, accepting both names in world.lua may preserve compatibility with existing behavior trees.

    Thank you for taking the time to read this report, and thank you again for all the happiness Starbound has brought me over the past ten years.

    Best regards,

    VOSA the Player
     

Share This Page