Greetings guys,
I would like to ask you a question about scripting in avorion, as I am bit new to Lua I am having trouble getting a simple value from table. I'm trying to get a warhead & body by name.
Table(C&P from TorpedoGenerator):
local Warheads = {}
table.insert(Warheads, {type = WarheadType.Nuclear, name = "Nuclear"%_T, hull = 1, shield = 1, size = 1.0, color = ColorRGB(0.8, 0.8, 0.8)})
table.insert(Warheads, {type = WarheadType.Neutron, name = "Neutron"%_T, hull = 3, shield = 1, size = 1.0, color = ColorRGB(0.8, 0.8, 0.3)})
table.insert(Warheads, {type = WarheadType.Fusion, name = "Fusion"%_T, hull = 1, shield = 3, size = 1.0, color = ColorRGB(1.0, 0.4, 0.1)})
table.insert(Warheads, {type = WarheadType.Tandem, name = "Tandem"%_T, hull = 2.0, shield = 2.0, size = 1.5, color = ColorRGB(0.8, 0.2, 0.2), shieldAndHullDamage = true})
table.insert(Warheads, {type = WarheadType.Kinetic, name = "Kinetic"%_T, hull = 2.5, shield = 0.25, size = 1.5, color = ColorRGB(0.7, 0.3, 0.7), damageVelocityFactor = true})
table.insert(Warheads, {type = WarheadType.Ion, name = "Ion"%_T, hull = 0.25, shield = 3, size = 2.0, color = ColorRGB(0.2, 0.7, 1.0), energyDrain = true})
table.insert(Warheads, {type = WarheadType.Plasma, name = "Plasma"%_T, hull = 1, shield = 5, size = 2.0, color = ColorRGB(0.2, 0.8, 0.2)})
table.insert(Warheads, {type = WarheadType.Sabot, name = "Sabot"%_T, hull = 3, shield = 0, size = 3.0, color = ColorRGB(1.0, 0.1, 0.5), penetrateShields = true})
table.insert(Warheads, {type = WarheadType.EMP, name = "EMP"%_T, hull = 0, shield = 0.025, size = 3.0, color = ColorRGB(0.3, 0.3, 0.9), deactivateShields = true})
table.insert(Warheads, {type = WarheadType.AntiMatter, name = "Anti-Matter"%_T, hull = 8, shield = 6, size = 5.0, color = ColorRGB(0.2, 0.2, 0.2), storageEnergyDrain = 50000000})
The way I'm trying to get a value from this table:
function addTorpedoes(faction, warhead, body, rarity, tech, amount, velocity, reach, shielddmg, hulldmg)
warhead = Warheads[warhead]
if warhead then
body = Bodies[body]
if body then
rarity = getRarity(rarity or 0)
if rarity then
local tech = math.max(1, tonumber(tech) or 6)
local dps = Balancing_TechWeaponDPS(tech)
local torpedo = TorpedoTemplate(tech, rarity)
It always return false with a implemented debug message that no such warhead was found, and the same thing happens with body.
Any help is appreciated.