Author Topic: Advanced item spawner script/plugin?  (Read 1532 times)

Dournbrood

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    2
    • View Profile
on: April 21, 2018, 05:16:10 PM
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.
« Last Edit: April 21, 2018, 05:33:38 PM by Dournbrood »



Devious

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    579
  • Have you seen Rusty?
    • View Profile
    • Rusty's Universe and Community
on: April 22, 2018, 02:10:31 PM
Look for the Avorion commands package made by Aki



Mattoropael

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    15
    • View Profile
on: April 23, 2018, 09:01:43 AM
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:
Spoiler: show
Code: [Select]
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:
Spoiler: show
Code: [Select]
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
« Last Edit: April 23, 2018, 09:04:50 AM by Mattoropael »