Author Topic: need help with some modifications  (Read 580 times)

plablo

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    23
    • View Profile
on: July 14, 2018, 03:38:53 AM
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?



Hammelpilaw

  • Sr. Member
  • ****
  • Status:
    Online
    Posts:
    494
    • View Profile
    • Scrap Yard - Avofactory
on: July 14, 2018, 08:47:15 AM
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:
Code: [Select]
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:

Code: [Select]
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.
Scrap Yard Galaxy
My mods and tools

If you find an bug in my mods please contact me. My GitLab Account



plablo

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    23
    • View Profile
on: July 14, 2018, 03:11:54 PM
re:
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]
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]
Code: [Select]
                  {size=1, title="Xsotan Scout"%_t},
and their variations just to spawn even more
did i did it right?
« Last Edit: July 14, 2018, 03:17:10 PM by plablo »



Hammelpilaw

  • Sr. Member
  • ****
  • Status:
    Online
    Posts:
    494
    • View Profile
    • Scrap Yard - Avofactory
on: July 14, 2018, 03:24:05 PM
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:

Code: [Select]
DevMode=true
Scrap Yard Galaxy
My mods and tools

If you find an bug in my mods please contact me. My GitLab Account



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    523
    • View Profile
on: July 15, 2018, 02:36:47 AM
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.
Shrooblord



ArgMGa

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    7
    • View Profile
on: July 15, 2018, 08:00:11 AM
Sorry mean to be a quote...
« Last Edit: July 15, 2018, 08:04:29 AM by ArgMGa »



ArgMGa

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    7
    • View Profile
on: July 15, 2018, 08:04:47 AM
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")
« Last Edit: July 15, 2018, 08:10:07 AM by ArgMGa »



Hammelpilaw

  • Sr. Member
  • ****
  • Status:
    Online
    Posts:
    494
    • View Profile
    • Scrap Yard - Avofactory
on: July 15, 2018, 08:19:02 AM
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.
Scrap Yard Galaxy
My mods and tools

If you find an bug in my mods please contact me. My GitLab Account



ArgMGa

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    7
    • View Profile
on: July 15, 2018, 09:32:58 AM
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?



plablo

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    23
    • View Profile
on: July 15, 2018, 04:32:47 PM
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



plablo

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    23
    • View Profile
on: July 23, 2018, 12:20:28 AM
update
looks like changing the plangenerator.lua mess with the creation of sectors with wreckage

 
Code: [Select]
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
« Last Edit: July 23, 2018, 12:22:25 AM by plablo »



Hammelpilaw

  • Sr. Member
  • ****
  • Status:
    Online
    Posts:
    494
    • View Profile
    • Scrap Yard - Avofactory
on: July 24, 2018, 10:50:24 AM
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:


Code: [Select]
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
    ]]
    ..........
Scrap Yard Galaxy
My mods and tools

If you find an bug in my mods please contact me. My GitLab Account