Modding Help Play a .ogg with .lua script

Discussion in 'Starbound Modding' started by Noah Nebula, Oct 28, 2018.

  1. Noah Nebula

    Noah Nebula Sandwich Man

    I want a type of npc to play different sounds when you get near to it.

    I am using this script as a base.

    function init()
    self.npcSounds = config.getParameter("npcSounds", {})
    self.soundTimer = 0
    function update(dt)
    self.soundTimer = math.max(0, self.soundTimer - dt)
    if self.soundTimer == 0 then
    local players = world.entityQuery(object.position(), config.getParameter("soundRadius"), {
    includedTypes = {"player"},
    boundMode = "CollisionArea"
    if #players > 0 and #self.npcSounds > 0 then
    object.say(self.npcSounds[math.random(1, #self.npcSounds)])
    self.soundTimer = config.getParameter("soundCooldown")

Share This Page