Jump to content

[REQ] / Help needed: Limiting Xsotan weapon loadout/getting faction


akeean

Recommended Posts

Hey fellow modders, so I'm trying to force Xsotans to ONLY (/mostly) use Lightning or tesla weapons, in order to make purpose built rock plated ships feasible against them. (Also I like to think Xsotan do not assimilate chainguns and other man made-ish weapon systems, given how they disregard station and shipwrecks with their containing technology and I think that Xsotan brought Lightning and Tesla weapons with them and factions just looted it from fighting Xsotans for 200ish years)

 

So far I've tracked down ship generation and arming to lib\shipgenerator.lua and arming a ship with turrets to lib\shiputlity.lua question is, what would be the faction parameter for xsotans? Do they get a certain known ID, or can I somehow get a string name from a passed $faction variable so I can make a filter in the ship generator?

 

Edit: I think I've almost worked it out. Key is the lib/story/xsotan.lua that calls turretgenerator, there i've copied the generateArmed function and changed the probabilities for the weapontypes allowed to be rolled. However my Xsotans at the guardian get spawned with 0 omicron firepower listed, so something is still wonky. Not sure what value I could give "weaponType" to pass on TurretGenerator.generate ... WeaponType.LightningGun for example does not work either.

 

lib/story/xsotan.lua, line 52, look for "local turret = TurretGenerator.generateArmed(x, y)" and replace with

local turret = TurretGenerator.generateXsotan(x, y)

 

then add this to lib/turretgenerator.lua (just before the "return TurretGenerator" in the end

function TurretGenerator.generateXsotan(x, y, offset_in, rarity_in, material_in) -- server

    local offset = offset_in or 0
    local sector = math.floor(length(vec2(x, y))) + offset
    local types = Balancing_GetWeaponProbability(sector, 0)

    types[WeaponType.RepairBeam] = nil
    types[WeaponType.MiningLaser] = nil
    types[WeaponType.SalvagingLaser] = nil
    types[WeaponType.ForceGun] = nil
    types[WeaponType.ChainGun] = nil
    types[WeaponType.MiningLaser] =      nil
    types[WeaponType.SalvagingLaser] =   nil
    types[WeaponType.Bolter] =           nil
    types[WeaponType.ForceGun] =         nil
    types[WeaponType.PlasmaGun] =        nil
    types[WeaponType.Laser] =            nil
    types[WeaponType.Cannon] =           nil
    types[WeaponType.RepairBeam] =       nil
    types[WeaponType.RocketLauncher] =   nil
    types[WeaponType.RailGun] =          nil

    local weaponType = getValueFromDistribution(types)

    return TurretGenerator.generate(x, y, offset_in, rarity_in, weaponType, material_in)
end

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...