Jump to content

Carnaxus

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by Carnaxus

  1. Hey all, I've built a prototyping ship in a creative world for the purpose of building a few station designs and saving them.  I've done that, and now I'm trying to make sure it doesn't try to go flying off into the sunset when I tell its captain to "attack enemies."  It has no engines or thrusters, so it can't actually move, but I can't help but worry that that'll break the AI somehow or something.

     

    What I'd like to do to fix it is to turn it into an actual station.  Problem is, it's not a station founder, it's a ship I built from scratch.  Does anyone know if there's a way to change a ship into a station, perhaps by editing the save files?

  2. I'm pretty sure this is also not the error anyone was expecting:

     

    2018-06-27 20-35-27| Error while adding file data/scripts/systems/debug.lua:
    2018-06-27 20-35-27| data/scripts/systems/debug.lua:21: ')' expected near '='

     

    I've updated the code a bit, although I'm pretty sure I put the "if onServer() then" bit in the wrong place.  Anyways, here's the latest:

     

     

    package.path = package.path .. ";data/scripts/systems/?.lua"
    package.path = package.path .. ";data/scripts/lib/?.lua"
    require ("basesystem")
    require ("utility")
    require ("randomext")
    
    -- optimization so that energy requirement doesn't have to be read every frame
    FixedEnergyRequirement = true
    if onServer() then
    function onInstalled(seed, rarity)
    Entity():addScriptOnce("lib/entitydbg.lua")
    end
    
    function onUninstalled(seed, rarity)
    Entity():removeScript("lib/entitydbg.lua")
    end
    
    function getName(seed, rarity)
        return 
    (
    	(ltext = "Debug Script Attachment")
    )
    end
    
    function getIcon(seed, rarity)
        return "data/textures/icons/cubeforce.png"
    end
    
    function getEnergy(seed, rarity)
        return 1
    end
    
    function getPrice(seed, rarity)
        return 1
    end
    
    function getTooltipLines(seed, rarity)
        return texts
    end
    
    function getDescriptionLines(seed, rarity)
        return
        {
            {ltext = "Naughty naughty!"%_t, lcolor = ColorRGB(1, 0.5, 0.5)}
        }
    end
    end (of "if" statement)

     

  3. Ah.  Well...as expected based on your feedback, in its current incarnation, it didn't work.  The upgrades generated, but they were blank, and didn't have any effect.

     

    I'll make the changes you mentioned and see if it works.  Thanks!

     

    Edit:

     

    Nope, still nothing.

  4. Hello all!  I have literally never touched a LUA script before Avorion, even with more than ten years of Garry's Mod under my belt.  That said, I'm trying to create a ship system upgrade that will attach the debug script to the ship it's installed on, and then will remove it when uninstalled.  Due to the fact that I have never done any LUA work before, I'm hoping someone can go over my script real quick and tell me if I've horribly broken things (or not).

     

     

    package.path = package.path .. ";data/scripts/systems/?.lua"
    package.path = package.path .. ";data/scripts/lib/?.lua"
    require ("basesystem")
    require ("utility")
    require ("randomext")
    
    -- optimization so that energy requirement doesn't have to be read every frame
    FixedEnergyRequirement = true
    
    function onInstalled(seed, rarity)
    do Entity():addScript("lib/entitydbg.lua")
    end
    
    function onUninstalled(seed, rarity)
    do Entity():removeScript("lib/entitydbg.lua")
    end
    
    function getName(seed, rarity)
        return "Debug Script Attachment"
    end
    
    function getIcon(seed, rarity)
        return "data/textures/icons/cubeforce.png"
    end
    
    function getEnergy(seed, rarity)
        return 1
    end
    
    function getPrice(seed, rarity)
        return 1
    end
    
    function getTooltipLines(seed, rarity)
    
        local texts = {}
        local perc, flat = getBonuses(seed, rarity)
    
        if perc ~= 0 then
            table.insert(texts, {ltext = "Cargo Hold"%_t, rtext = string.format("%+i%%", perc * 100), icon = "data/textures/icons/wooden-crate.png"})
        end
    
        if flat ~= 0 then
            table.insert(texts, {ltext = "Cargo Hold"%_t, rtext = string.format("%+i", flat), icon = "data/textures/icons/wooden-crate.png"})
        end
    
        return texts
    end
    
    function getDescriptionLines(seed, rarity)
        return
        {
            {ltext = "Naughty naughty!"%_t, lcolor = ColorRGB(1, 0.5, 0.5)}
        }
    end
    
    

     

     

    I copied the cargoextender.lua file and modified it rather than start from scratch.  Hopefully that in and of itself won't break anything...

×
×
  • Create New...