Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Laserzwei

Pages: [1] 2 3 ... 24
1
Mods / Re: [MOD][mOS] move Asteroids
« on: November 08, 2018, 02:30:40 PM »
update

-- 0.19.0 [2018-11-8]
  - dropped complicated and dated way of deleting and recreating asteroids and the as tedious way of detecting sector changes. As a result the code is much smaller and uses less hooks (no modification of server.lua required anymore!)
  - Instead uses Galaxy():transferEntity(type 1)
  - The target sector can be individually selected and jumping out of a system does not inherently transfer asteroids with you.
  - This lifts the previously implied jump-range limit. To prevent unlimited transfer range there is now a config option (MAXTRANSFERRANGE)


2
Mods / Re: [MOD] Carrier Command
« on: November 06, 2018, 06:34:11 PM »
Updated CC to 1.9.2

-- 1.9.2 for 0.19.x [2018-11-06]
  - added Slider to control re-targeting threshold distance (You don't know what that could be? Look in the Wiki!)
  - now runs on stations again (Did nobody notice that this was missing?)
  - fixed some typos, added some more descriptions
  - readme shrinked down to the basic install instructions (advanced Install instructions? Right in the Wiki!)
Reminder: ShipScriptLoader is no longer required! The installation process has been simplyfied by a lot.

3
Mods / Re: [Question/Request] Modding Avorion - Language? Tools? - help
« on: November 05, 2018, 08:49:31 AM »
Hi, first I apology for my english, i speak only spanish so i hope anyone can understand me.
I recently discover avorion from youtube. I buy the game just today (waiting the confirmation of the purchase from steam because i don't have a credit card), and have a few questions:
1) ¿What language for programming use  the game? - i struggle trying to find it -
2) ¿Is necesary to use a compiler or just write the code in the notepad and change his extension?
3) As is now, i figure as i keep learning from the game, that if you leave one sector, that sector unloads from the game and no loger work - ¿anyone as a fix to this? - if no - ¿someone had tried to identify the "active player"  and create a block for the game with the same "player" property to avoid the unload of a sector when the "real" player is no longer there? (I been shooting blindfold for this last question - i don't have the game yet to try)
1) LUA (plus an API which is documented in /steam/.../Avorion/documentation/) mainly. See the Avorion/data/ folder for other stuff (sound/graphic/shader...) to modify
2a)  LUA doesn't require a compiler
2b) There is currently no modloader. You will always have to modify existing gamefiles
3) Sectors have 3 states:
  • Loaded (player inside)
  • semi-Loaded (no player inside, but player-property inside. Refresh rate is lower than in player sectors)
  • Unloaded (no player(-property) inside or max. active sectors exceeded)
There is also an API callback telling when a sector gets loaded back in and how long it was unloaded. This helps with eventual catching up.
There is currently no API to force sectors to load

5
Suggestions / Re: Scripting API requests
« on: October 28, 2018, 03:23:37 PM »
A function to get the started fighters of a specific squad of an specific Entity.
It would best reside in FighterController, because it already controls them.
Something like this:

function Entity... getStartedFightersOfSquad(unsigned int squadIndex)

That should be much better than (my) current workaround:
Code: [Select]
local fighters = {Sector():getEntitiesByType(EntityType.Fighter)}
for _,fighter in pairs(fighters) do
    local fAI = FighterAI(fighter)
    if fAI.mothershipId.number == Entity().index.number and fAI.squad == searchedSquadIndex then
        --do something
    end
end

6
Mods / Re: How to count the number of a specific asteroid in a sector?
« on: October 26, 2018, 11:20:46 AM »
Yesterday I had a much more in-depth description -about how the resource System in Avorion is done from a scripting perspective- prepared, but the Auto-Log-Out deleted it, when I pressed preview  :-\
So I will deliver it as an appendum:

This will Touch the following Classes:
Resource information:

Entity
Material

Resource Manipultaion:

BlockPlan
BlockPlanBlock
Box


Context: Entity

function int... getMineableResources()
Returns all resources available for extraction from that Entity as Arguments. If you expect more than 1 resources on that Entity, you will want to put {} around it to catch them. This is not necessary for Vanilla Asteroids. However: Wreckages with different Materials will need it. It does not provide any clue of what Material these resources are.

function Material getMineableMaterial()
This returns exactly 1 Material. It is only suitable to get a single resource. I haven't tested what it returns in case of multiple resources, but I doubt it holds meaningful Information.

function double... getPlanResourceValue()
This is pretty much a combination of the above. It returns 7 double Values (One for each Material: Iron->Avorion). Each of them holds the amount of resources build into the Entity. Most of these Values will have 0 in them. They are always given in ascending order, starting with Iron. To catch them in a single Table again use {}.
Here is an example code snippet:

Code: [Select]
local resources = {Entity():getPlanResourceValue()}
for material, amount in ipairs(resources) do
    print(Material(material-1).name, amount)
end
2 things to metion:
1. I use ipairs to traverse the table. It requires the indices to start with 1 and the next following to be +1. If not, data might be lost! The big pro: It is in order. pairs might traverse randomly.
2. I use material-1 to map the table indices to Material indices. The Material indices start with 0, the LUA-table with 1.

This is basically all the information about the resources on an Entity you can get.
If you want to manipulate them you have to dig into BlockPlan

To get the Blockplan of entity use:
Code: [Select]
Entity:getPlan:get()getPlan() returns a Plan Object, which is basically an extended BlockPlan. the following get() gives the actual BlockPlan.
Both have the same -already discussed- getPlanResourceValue() function


Context: BlockPlan
The resources in an Entity are defined by the Blocks which make it up. So to manipulate the resources on an Entity (mainly, but not limited to Asteroids or wreckages) you have to modify the underlaying BlockPlanBlocks.

You can get these blocks by traversing through the BlockPlan.
Either use the tree-like traversing starting with the given BlockPlanBlock attribute root and root:getChildren(). Followed with the BlockPlan function BlockPlanBlock getBlock(int index). Traversing it in this manner allows to get information about the structual properties (to destroy a root-Block you need to inflict enough damage to destroy all of its children as well)
Or use function int... getBlockIndices() with function BlockPlanBlock getBlock(int index).
Don't forget to get them into a table with {...}.

Context: BlockPlanBlock

To manipulate the material-type, you can modify it with the BlockPlanBlock attribute material. It requires to be a Material object.
To Manipulate the amount, you have to change the volume of the block. Much like it costs proportionally more to build a Block, you also gain more resources back from it. The Volume of a Block is defined by it's size. As every (building-)Block is actually a cuboid, you have to change its size. It is stored in the box property. You can test which sizes you want in the building mode (it also allows to add resource-stones)- the build-cost and the resource-amount are the same.
You will probaly have to fiddle around with the Box's attributes, to get the desired results.

This completes the information and manipulation of resources in Entities -  available for modding.

7
Mods / Re: How to count the number of a specific asteroid in a sector?
« on: October 25, 2018, 08:20:48 PM »
since nobody answered:

function Material getMineableMaterial()

8
Suggestions / Re: Scripting API requests
« on: October 24, 2018, 11:29:10 PM »
I've got a relatively small request:

add something like
function Entity, ... getEnemies(var relationThreshold)
to shipAI.
The Intention is to have quick access to all Enemy Entities, in cases where "getNearestEnemy()" does not return the most reasonable target. (E.g. it selects a fighter close by, but the Big Mainship might be a better target...)

9
Mods / Re: [MOD] Carrier Command
« on: October 19, 2018, 03:37:43 PM »
Laserzwei? can we get the loot mod to work with the newest CC?

https://www.avorion.net/forum/index.php/topic,4694.0.html

this is the mod I was trying to get to work, can you fix it so this works or right it into the current CC mod?
I won't be updating it. If you find someone who wants to, I will gladly support him with code snippets and the concepts of how CC-plugins are supposed to work.

Also:
Updated CC to 1.9.0 experimental
changelog:
-- 1.9.0 experimental for 0.19.x [2018-10-19]
  - halved calculation times for targeting enemies by changing the order of if-statements
  - discarded the seperate Xsotan-enemy detection code and used Vanilla ShipAi. As a result Xsotan aren't seen as neutral by the ship (and only the ship CC is running on) anymore
  - added Unsupervised targeting-option to enable Vanilla-targeting behavior against enemies(which overrites Attack Civils, Attack Stations, Aggressive Targetting). It's also one magnitude faster than the beforehand mentioned speed increase.
  - added config option to enforce Unsupervised targeting serverwide

There is no apparent reason to update from 1.18.5 as it will work just fine with Avorion 0.19. I've just spend some time improving the code

Edit [2018-10-24]: With the announced changes to Salvage- and MineAI it is to assume that it will take some time before they get integrated ino Carrier Commander
Edit [2018-10-28]:
Updated CC to 1.9.1 experimental:
-- 1.9.1 experimental for 0.19.x [2018-10-28]
  - Dropped requirement for ShipScriptLoader. Instead I'm using vanilla /entity/init.lua
  - To properly work with alliance ships either overwriting claimalliance.lua or modifying shipfounder line 140 to use addScriptOnce is mandatory. See: readme/install instructions
  - Guardian gets its proper priority assigned now (Thanks to Hammelpilaw)
  - fighters will always prefer higher priority targets
  - with multiple same-priority targets fighters will prefer its current target, but only if it is 15km closer than the next closest target (effectively avoiding them to chase enemies to far off and getting into crossfire)
  - changed default priorities: fighter > ship > guardian > station
Again: The install procedure has changed! with 1.9.1 and up. Follow the instructions in the readme file(s).

10
Mods / Re: How to get ship Entity from turret Entity?
« on: September 27, 2018, 09:42:58 AM »
I'm also interested.
There is a "ParentEntity"- Component (Enums -> ComponentType -> ParentEntity), but it's not surfaced to the LUA API.
There is also the possibility of going through the ships of the same faction and search for that specific turret:
Code: [Select]
function MyMod.onSomeoneFired(turretId)
    local turret = Entity(turretId)
    local parent
    local possibleParents = {getEntitiesByFaction(turret.factionIndex)}
    for _,p in pairs(possibleParents) do
        if (p.isShip or p.isStation) then
            local pTurrets = {p:getTurrets()}
            for _,t in pairs(pTurrets) do
                if t.index.number == turret.index.number then
                    parent = p
            end
        end
    end
    if parent then print("parent found", parent.name) else print("no parent found, weird!") end
end
I didn't try the code but it should work ;D

11
Mods / Re: [MOD] advanced shipyard
« on: September 12, 2018, 01:54:28 PM »
seems to have minor issues with the latest beta version- it functions, but im guessing it doesn't recognise the new folder system- aside from that, its still ticking over smoothly
This was vanilla related, but it's fixed now

Update:
1.8.2 (0.18)
  - now using, in 0.18.3 introduced, createSavedDesignsSelection

12
Mods / Re: [MOD] Carrier Command
« on: August 11, 2018, 09:22:03 AM »
cant get work 1.7.5... i get stuck everytime in loading screen.... where i can download old 1.7.4? my fiail was to delete my zip file after downloading...need to go back to working version

got work only if i dont copy/overide "claimalliance.lua"

i play now with 1.7.5 in 1.7.1game and ignore claimalliance.lua file ^^

Spoiler: show

ok still not work.....

2018-08-11 02-08-01| #0: dockAll.initialize mods/CarrierCommander/scripts/entity/ai/dockAllFighters.lua
2018-08-11 02-08-01|
2018-08-11 02-08-01| could not execute function 'dockAll.initialize' in '"mods/CarrierCommander/scripts/entity/ai/dockAllFighters.lua"':
2018-08-11 02-08-01|
2018-08-11 02-08-01| mods/CarrierCommander/scripts/entity/ai/dockAllFighters.lua:81: attempt to index field 'cc' (a nil value)
2018-08-11 02-08-01| stack traceback:
2018-08-11 02-08-01|     mods/CarrierCommander/scripts/entity/ai/dockAllFighters.lua:81: in function 'getSquadsToManage'
2018-08-11 02-08-01|     mods/CarrierCommander/scripts/entity/ai/dockAllFighters.lua:20: in function <mods/CarrierCommander/scripts/entity/ai/dockAllFighters.lua:18>
2018-08-11 02-08-01|
2018-08-11 02-08-01| Starting thread [Stacktrace Sender]...
2018-08-11 02-08-01| Started thread [Stacktrace Sender] with id 20
2018-08-11 02-08-01| Script "mods/CarrierCommander/scripts/entity/ai/dockAllFighters.lua" or one of its requirements is not in its original state, skipping sending of stack trace.
2018-08-11 02-08-01| scheduled save for sector (204:5), 0xadf40b0, entities: 15
2018-08-11 02-08-01| saving sector (204:5)
2018-08-11 02-08-01| sector (204:5) saved to "C:\Users\Kartonka\AppData\Roaming\Avorion\galaxies\dedicated_server\sectors\204_5"
2018-08-11 02-08-01| player events roughly every 11.53 minutes
2018-08-11 02-08-01| Player Stahlglanz moved to sector (204:5) server time taken for change: 3ms
2018-08-11 02-08-01| scheduled save for sector (204:5), 0xadf40b0, entities: 15
2018-08-11 02-08-01| saving sector (204:5)
2018-08-11 02-08-01| sector (204:5) saved to "C:\Users\Kartonka\AppData\Roaming\Avorion\galaxies\dedicated_server\sectors\204_5"
2018-08-11 02-08-02| Execution Context (inner to outer):
2018-08-11 02-08-02| #0: dockAll.updateServer mods/CarrierCommander/scripts/entity/ai/dockAllFighters.lua

You didn't follow the install instructions, no wonder bad things happen
Go here: https://discord.gg/ZJYYxrZ . I might be able to still help you

13
Mods / Re: [MOD] Carrier Command
« on: August 10, 2018, 08:36:07 AM »
update

-- 1.8.5 for 0.18.x (beta) [2018-08-10]
-- 1.7.5 for 0.17.1 (main)

  - fixed "stuck" looking UI with dock All

Edit: If you are updating, make sure all fighters are docked.

14
Mods / Re: [MOD] Carrier Command
« on: August 09, 2018, 03:23:12 PM »
Another random question. I'm on a server and I know the mod versions match (friends with the admin and I helped create the modpack we're using which includes this awesome mod), but for some reason my salvage fighters are always performing as if "Salvage Nearest" is unchecked.  Even logged out and back in, recalling and changing it then and the fighters always move to whatever is closest to my ship if I'm flying around a sector.  We're using the 1.7.3 version if that makes a difference.  Any ideas?  It's making the salvagers not very efficient if they're flying KM's away from their current target if I get close to another wreck.
You've observed that right! (and it affected miners and attackers as well)

Update


-- 1.8.4 for 0.18.x (beta) [2018-08-09]
-- 1.7.4 for 0.17.1 (main)
  - switched from nearest old target to nearest of squad
  - dock-all now forcefully stops carrier-commands

15
Mods / Re: [MOD] Carrier Command
« on: August 06, 2018, 07:27:54 PM »
Maybe I'm missing something but you said that salvaging/mining were separate addons for this mod.  Where are those located? I don't see anything about them in the mods  folder from the updated zips on the initial post.
CarrierCommander_xxx.zip/CarrierCommander/mods/CCBasicCommands/scripts/entity/ai/

Pages: [1] 2 3 ... 24