Modding Help Race exclusive tech?

Discussion in 'Starbound Modding' started by DraikNova, Jun 28, 2017.

  1. DraikNova

    DraikNova Ketchup Robot

    I have a tech I'm making that wouldn't make much sense for those outside of a certain race to use. Is there a way to limit the accessibility of a tech to a certain race? Or should I just have that tech check in its lua whether your character is of the race that can use them or not?
     
  2. Cyel

    Cyel Scruffy Nerf-Herder

    You could make a custom quest script that'd check for the specie before giving the tech?
     
  3. bk3k

    bk3k Oxygen Tank

    A few of the tech mods(mine included) hook the scripts for the tech console in order to add techs(without need of running any quests first). There is no particular reason you can't do something similar while checking the players's race as a condition.

    Edit:

    Rather than a simple match of
    Code:
    if player.species() == "floran" then
      player.makeTechAvailable(tech)
      player.enableTech(tech)
    end
    
    If you where handling lists of techs for multiple species, a species indexed table makes more sense.

    Code:
      local species = player.species()
      if techList[species] then
        for _, tech in ipairs(techList[species]) do
          player.makeTechAvailable(tech)
          player.enableTech(tech)
      else
        for _, tech in ipairs(techList["default"]) do
          player.makeTechAvailable(tech)
          player.enableTech(tech)
        end
      end
    
     
    Last edited: Jun 29, 2017
    AtomicPegasus, DraikNova and Cyel like this.
  4. DraikNova

    DraikNova Ketchup Robot

    That's exactly what I needed, thanks!
     

Share This Page