Jump to content

need help with some modifications


plablo

Recommended Posts

Sorry if i put this topic in the wrong section

i'm not a modder, but i want to mess with  pirate/xsotan/trader attacks to spawn more and bigger and powerfull even in normal difficulty not just on insane

i already found how to add more ships  but where do i scale?

Link to comment
Share on other sites

You can modify the size of a ship by modding the ship plan. There are lot of ways to do this. If you modify ./lib/galaxy.lua or ./lib/plangenerator.lua you could make all generated ships larger. Usely galaxy.lua is the better place for balancing, but if you change one thing there, it affects other stuff (like when increasing ship size, the weapons you find or build at turret factory also increases dps) so I recommand not to change it as an unexperienced modder.

 

plangenerator.lua:

function PlanGenerator.makeAsyncShipPlan(callback, values, faction, volume, styleName, material, sync)
    volume = volume * 2 -- ADD THIS LINE to multiply size off ALL npc ships (also Xsotan, pirates, factions) by 2

 

To make Xsotan ships stronger you could modify ./lib/story/xsotan.lua:

 

function Xsotan.createShip(position, volumeFactor)
    position = position or Matrix()
    local volume = Balancing_GetSectorShipVolume(Sector():getCoordinates())

    volume = volume * (volumeFactor or 1)
    volume = volume * 2 -- xsotan ships aren't supposed to be very big -- CHANGE THIS LINE if you have not done in plangenerator.lua yet

    local x, y = Sector():getCoordinates()
    local probabilities = Balancing_GetMaterialProbability(x, y)
    local material = Material(getValueFromDistribution(probabilities))
    local faction = Xsotan.getFaction()
    local plan = PlanGenerator.makeShipPlan(faction, volume, nil, material)
    local ship = Sector():createShip(faction, "", plan, position)    ship.damageMultiplier = ship.damageMultiplier * 2 -- ADD THIS LINE to multiply the damage of normal Xsotan ships by 2

 

I marked 2 lines in the code you could mod.

 

These are only examples, there are lot of scripts that affects generation of different ships/factions and so on. To make enemies stronger I love the damageMultiplier, it's really awesome. Already used it in lot of my balancing mods to make enemies stronger.

 

Ps.: Its the correct section for modding question.

Pps.: Make a backup of your modded scripts, because game scripts may be overwritten when you download an Avorion patch.

 

Link to comment
Share on other sites

just to make sure i did it right.

in the pirate/alien/trader attack lua files, i basically copied and pasted the

 

pirateattack.lua:

Code: [select]
         generator:createScaledRaider(MatrixLookUpPosition(-dir, up, pos)) 

and i didnt forget to add the " + right * -distance * 2.0~  + right * distance * 2.0~"

 

alienattack.lua

Code: [select]
                  {size=1, title="Xsotan Scout"%_t},

and their variations just to spawn even more

did i did it right?

Link to comment
Share on other sites

Your code looks good to me, but only a test can give you the final answer if it works. I recommand testing with the admin panel in debug mode.

 

You can enable debug mode in your test galaxy by editing server.ini in galaxy directory and change DevMode to true:

 

DevMode=true

 

 

Link to comment
Share on other sites

the admin panel in debug mode.
Ohh?? What's this? Do you have a screenshot for me? This potentially sounds game-changing for a modder such as myself, if it is what I think it is.

 

I think he mean for the debug script, i might be wrong but other than the way he says you can try usin this command in the chat:  /run Entity():addScript("lib/entitydbg.lua")

Link to comment
Share on other sites

I think he mean for the debug script, i might be wrong but other than the way he says you can try usin this command in the chat:  /run Entity():addScript("lib/entitydbg.lua")

 

Correct.

 

hehe thanks for confirmin my supicions :P may i ask you about some moding capabilitis on this game?

Link to comment
Share on other sites

if hx == x and hy == y and player.playtime < 30 * 60 then

this is the line to change the time to pirates spawn?

because i found some outdated pirate mods and i been tweaking some lines

 

they do spawn properly using the dev but i want to leave the game to actually spawn by it self

Link to comment
Share on other sites

update

looks like changing the plangenerator.lua mess with the creation of sectors with wreckage

 

2018-07-22 18-28-04| Creating sector at (-7:264)
2018-07-22 18-28-04| Generating new content for sector (-7:264)
2018-07-22 18-28-05| Execution Context (inner to outer):
2018-07-22 18-28-05| #0: generate data/scripts/server/generatesector.lua
2018-07-22 18-28-05| 
2018-07-22 18-28-05| could not execute function 'generate' in '"data/scripts/server/generatesector.lua"':
2018-07-22 18-28-05| 
2018-07-22 18-28-05| data/scripts/lib/plangenerator.lua:483: attempt to perform arithmetic on local 'volume' (a nil value)
2018-07-22 18-28-05| stack traceback:
2018-07-22 18-28-05|     data/scripts/lib/plangenerator.lua:483: in function <data/scripts/lib/plangenerator.lua:482>
2018-07-22 18-28-05|     (...tail calls...)
2018-07-22 18-28-05|     data/scripts/lib/SectorGenerator.lua:415: in function 'createUnstrippedWreckage'
2018-07-22 18-28-05|     data/scripts/lib/SectorGenerator.lua:398: in function 'createWreckage'
2018-07-22 18-28-05|     data/scripts/sectors/wreckagefield.lua:35: in function 'generate'
2018-07-22 18-28-05|     data/scripts/server/generatesector.lua:37: in function <data/scripts/server/generatesector.lua:18>
2018-07-22 18-28-05| 
2018-07-22 18-28-05| Starting thread [stacktrace Sender]...
2018-07-22 18-28-05| Started thread [stacktrace Sender] with id 16
2018-07-22 18-28-05| Script "data/scripts/server/generatesector.lua" or one of its requirements is not in its original state, skipping sending of stack trace.
2018-07-22 18-28-05| scheduled save for sector (-7:264), 0x115e3070, entities: 21
2018-07-22 18-28-05| saving sector (-7:264)

i got these lines on my log files

 

i removed the * 2 and i guess that worked, im not 100% with the wreckage sectors properly working  because i didnt found it yet sector with scrapyard  only sectors with wreckage and some pirates

Link to comment
Share on other sites

hehe thanks for confirmin my supicions :P may i ask you about some moding capabilitis on this game?

 

Offtopic, please open a new thread or send a pm.

 

 

update

looks like changing the plangenerator.lua mess with the creation of sectors with wreckage

 

Oh sure... well it is beacuase "volume" can be nil. Do this in the same function:

 

 

function PlanGenerator.makeAsyncShipPlan(callback, values, faction, volume, styleName, material, sync)
    local seed = math.random(0xffffffff)

    if not material then
        material = PlanGenerator.selectMaterial(faction)
    end

    local code = [[
        package.path = package.path .. ";data/scripts/lib/?.lua"
        package.path = package.path .. ";data/scripts/?.lua"

        local PlanGenerator = require ("plangenerator")

        function run(styleName, seed, volume, material, factionIndex, ...)

            local faction = Faction(factionIndex)
            if not volume then
                volume = Balancing_GetSectorShipVolume(faction:getHomeSectorCoordinates());
                local deviation = Balancing_GetShipVolumeDeviation();
                volume = volume * deviation
            end
            volume = volume * 2 -- ADD THIS LINE

            local style = PlanGenerator.selectShipStyle(faction, styleName)
            local plan = GeneratePlanFromStyle(style, Seed(seed), volume, 2000, 1, material)
            return plan, ...
        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...