Jump to content

Advanced item spawner script/plugin?


Dournbrood

Recommended Posts

To start off, I know that there's technically already ways to spawn in items using the entitydbg.lua script under the player tab where "Guns Guns Guns", "Gimme Systems" and "Mining Lasers" are, but those are entirely randomized so I've been looking for a way to spawn in items of specific types, materials, rarities and even specifying stats. Both for fun and for server management in case somebody's stuff gets yanked for a stupid reason.

 

I did look through the entitydbg.lua script for a bit to see if I could figure out the syntax or find some documentation, but no cigar there.

 

I'm just wondering if somebody has created a lua script or server-side plugin that still allows other players to join with vanilla installations but can also spawn in items in such a specific manner as above. If not, then if somebody could point me to documentation or an example script on how the item generation and spawning works in-terms of scripting, I might be able to do something like that myself.

Link to comment
Share on other sites

There are some simple pre-defined customized spawn scripts floating out there that you can experiment with.

 

Overpowered Weaponry *

Custom Torpedo Spawn Script

 

 

* That one can be further customized since it isn't really using a lot of API functions.

 

Compared to the included chaingun spawn script:

 

package.path = package.path .. ";data/scripts/lib/?.lua"
function execute(sender, commandName, ...)
    
    TurretGenerator = require("turretgenerator")
    TurretGenerator.initialize(Seed(turretSeed))
    local turret = TurretGenerator.generate(200, 200, 0, Rarity(RarityType.Legendary), WeaponType.ChainGun, Material(MaterialType.Trinium))
    local weapons = {turret:getWeapons()}

    turret.size = 1
    turret:clearWeapons()

    for _, weapon in pairs(weapons) do
        weapon.reach = 1500
        weapon.damage = 200
        weapon.fireRate = 10
        turret:addWeapon(weapon)
    end
    turret.baseEnergyPerSecond = nil
    turret.energyIncreasePerSecond = nil
    turret.heatPerShot = 0
    turret.automatic = true
    turret.turningSpeed = 2
    for i=1,50 do 
        Player(sender):getInventory():add(InventoryTurret(turret))
    end
    
    return 0, "", ""
end

function getDescription()
    return "A shorter way to get entitydbg"
end

function getHelp()
    return "A shorter way to get entitydbg"
end

 

Here's a heavily-customized version based on that script with more API functions utilized, which I use for one of my ship's custom AF cannon-based CIWS:

 

package.path = package.path .. ";data/scripts/lib/?.lua"
function execute(sender, commandName, ...)
    
TurretGenerator = require("turretgenerator")
TurretGenerator.initialize(Seed(turretSeed))
local turret = TurretGenerator.generate(200, 200, 0, Rarity(RarityType.Legendary), WeaponType.AntiFighter, Material(MaterialType.Trinium))
local weapons = {turret:getWeapons()}

turret.size = 0.1
turret:clearWeapons()

for _, weapon in pairs(weapons) do
	weapon.damage = 357
	weapon.fireRate = 5
	weapon.accuracy = 0.95
	weapon.reach = 500
	weapon.pvelocity = 300
	weapon.recoil = 0
	weapon.pmaximumTime = weapon.reach / weapon.pvelocity
	weapon.shieldPenetration = 0
	weapon.hullDamageMultiplicator = 1
	weapon.shieldDamageMultiplicator = 1
	weapon.stoneDamageMultiplicator = 10
	--weapon.psize = 0.5
	weapon.pcolor = ColorRGB(1, 1, 1)
	turret:addWeapon(weapon)
end
turret.baseEnergyPerSecond = nil
turret.energyIncreasePerSecond = nil
turret.heatPerShot = nil
turret.automatic = true
turret.simultaneousShooting = true
turret.turningSpeed = 5
turret.slots = 1
turret.crew = Crew() -- No crew requirements
turret.flavorText = "CIWS"
for i=1,350 do 
	Player(sender):getInventory():add(InventoryTurret(turret))
end
    
return 0, "", ""
end

function getDescription()
return "A shorter way to get entitydbg"
end

function getHelp()
    return "A shorter way to get entitydbg"
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...