Jump to content

Dahak

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by Dahak

  1. 1. The script faults when you attempt to access the market with more than 14 types of stolen good.

     

    Reproduction: Do the above, see the log.

     

    Fix: See this thread for a naive patch-job based on the trading upgrade.

     

    2. The displayed value is 25% of the good's value, when it buys for 15%

     

    Also a quick fix.

     

     

    3. When selling stolen goods to the smuggler, using the appropriate menu, they will buy your non-stolen copies first, for the listed price, before buying stolen ones.

     

    Reproduction: Get nonstolen and stolen copies of the same good. Attempt to sell the stolen. It will sell normal goods until you run out, then sell stolen ones.

     

    Fix: Just needs an override of the functions to only pick stolen copies out of cargo.

  2. Its me again, with another quick patchjob.

     

    Smugglers Markets would crash with more than 14 types of stolen goods on board, due to their coding. Correcting their coding causes a crash with more than 15, as the base script it inherits from only has 15 buy lines.

     

    I fixed this by adding pages identical in function to the trading upgrade.

     

    An additional bug fixed is that while stations buy for 15%, it was displaying 25% price.

     

    This does not fix the bug where the station buys nonstolen goods first, unfortunately. I can do that, but I haven't yet since it requires a serverside script change, and I don't have access to that on the server I play on, so don't feel like messing with it at the moment.

     

    The bug report thread is here.

    smugglersmarket.zip

  3. You can't detect the turret as a block, but you can determine the index of the block the turret is attached to via getAttachedBlockIndex called on the turret, and when that block index is destroyed on the ship, the turret is ejected into space.

     

    Yeah, my setValue on the ship seems to be getting eaten though, and invoking the script doesn't preserve local values. I'll probably have to jank this a bit.

     

    Something a person in discord brought up also, is maybe modding all turrets the player has, and then looking for a way to block out mailing, etc. Didn't see anything related to mailing though.

  4. Okay, so, let's discuss this.

     

    I think we can all agree that perfect mod compatibility is generally impossible. Imagine two mods doing the exact opposite of each other, and you've got a conflict, easy as that.

     

    But we can make it so that conflicts appear much less often. I've spent quite some time to think on this and my proposal is this:

    Since in lua, you can just redefine a function, it would be possible to read one script, and then read another script. Imagine 2 scripts that tinker with shipyard.lua. They both have to inject the update() function. What you could do is, in the second script, save the update function and write your own that calls the old one. Like this: 

    local updateOld = update
    function update(timeStep) 
        updateOld(timeStep)
        print("this is my custom output")
    end 
    

     

    The new update() function would replace the old one and call it. The neat thing is: You can repeat this as often as you want actually.

     

    This would be the start. In order for this to work, I'd suggest a second folder which is left untouched by steam updates, so you don't have to reinstall all your mods every time a new update hits. Maybe even a separate folder for every mod that's downloaded when logging into a server, so you have your server mods but they won't pollute your custom games.

     

    The game would load the vanilla script and then load all the modified ones it finds, afterwards. You could, for example, name them shipyard.lua.1 and shipyard.lua.2. Those lie around in the mods folder, and Avorion looks for them, sorts them lexicographically so load order is deterministic, and loads them as well in deterministic order after the vanilla one, into the same VM (or lua_State).

     

    This could work for all scripts, and you wouldn't need diffs.

     

    Any objections? Anything that wouldn't work with this system?

     

    I think I agree with MMaster - but like him, I'm not sure I'm understanding that well.

     

    I would be perfectly happy with mod folders and a "mod.lua" file that's automatically loaded that tells the game how to interpret the mods.

     

     

  5. Really, we probably need to mod most hardcoded lists in the scripts into registries. Probably not too hard. Actually probably just more time consuming than hard, given Lua's amazing table handling. Though we'll still need the above suggestion for a folder that gets called automatically. :/

  6. I didn't get around to testing it, but a strategy I considered was using Entity():isCollectable to find loot that was freshly dropped by the player, who wouldn't be able to pick it up for a few seconds. Since it's possible to determine when turrets are destroyed via callbacks, as well as when the player's own ship's plan is modified (blocks destroyed), I feel like that route could bear fruit for you.

     

    I'm currently testing the viability of automatically placing/resetting turrets when the player enters the build menu to prevent duping via the script I'm working on, so I'll post later with how that goes.

     

    I looked into blockplan, but I believe that's only for blocks - turrets don't count, as they're not part of the blockplan AFAIK.

     

    Now if there's a way to detect when the player goes into the build menu, well, that works fine :)

  7. Well, the old turret will still be there if you don't delete it via the function from Sector, but using that command doesn't cause floating loot, which is nice. My first attempt at replacing a turret involved temporarily deleting the block it was attached to and then quickly grabbing and deleting the resulting loot object, and that was uhh, less than ideal.

     

    EDIT: Oh, but also, you don't have to delete the old turret until after the new one is added. In fact, you can stack however many turrets you want in the same spot, their collisions don't matter.

    On that topic, have you figured out if you can grab a turret when its removed from the ship (or shot off)? I'd like to start making weapon upgrade Systems, but that's a serious requirement to prevent it from being abused.

  8. about your first question, you might want to check out the scripts from Carrier commands, it assigns the player's owned fighters to salvage.

     

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

     

    It does so by getting all of the fighters in a sector, then figuring out which ones belong to the player. That's functional, but we're hoping to figure out if there are any lua functions that will access whatever the game uses internally when a carrier gives commands to its fighters.

    This is pretty much what I'm trying to achieve, and you are correct the mod does not do that atm. I have been dumping lua tables left right and center in an attempt to find out what is and isn't possible. Tbh, what you want is pretty much what i need to take the carrier commands to the next level.

    Aye. There are a number of components that we don't have interfaces to yet ;_;

  9. about your first question, you might want to check out the scripts from Carrier commands, it assigns the player's owned fighters to salvage.

     

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

     

    It does so by getting all of the fighters in a sector, then figuring out which ones belong to the player. That's functional, but we're hoping to figure out if there are any lua functions that will access whatever the game uses internally when a carrier gives commands to its fighters.

  10. It does return a player or nil, and it's perfectly acceptable to return nil. It's a debug message that hasn't been removed yet, not an error, even if it says error.

    My apologies. We saw the error message a ton, and the server op was seeing more and more ships cluttering g up systems, so we assumed it was an error. Thanks for replying, and I'll make sure to check more thoroughly from here out.

  11. Edit: solved. Debug message, not error.

     

    The Player(var) function (constructor? The documents say its a constructor that returns a new Player object, but it's getting an existing one...) errors with the lines:

     

    Sat Jan 28 18:00:52 2017| error constructing Player: No player with index 2000760 found at  [C]:-1: in function Player
    Sat Jan 28 18:00:52 2017|   data/scripts/entity/ai/passsector.lua:37: in function ?

     

    whenever passed the factionID of an AI faction.

     

    This is causing the passsector.lua script to fail.

     

    Reproduction: I've seen it in multiple logs at this point, so I'm assuming its an ubiquitous engine problem.

     

    Expected Behavior: It should return false or nil.

     

    Or, if Player(var) is supposed to error when passed an AI ID, then a different function should be in place for checking if a ship belongs to a player.

  12. Getting this error message in my logs, spamming them up horribly. One log from a day of playing is almost 800mb.

     

    Wed Jan 25 22:53:45 2017| GL DBG: HIGH TYPE_ERROR API 1281: GL_INVALID_VALUE error generated. View frustum must not have a zero values of: (right-left), (top-bottom), or (zFar-zNear).

     

     

    Have a GTX 960 and am running latest drivers. Settings are mostly maxed except SS at 1.5x.

     

    Obviously can reproduce it on my end, but, uh, might not be easy elsewhere.

  13. Okay, so if I'm understanding this right, actually modding stats and so on requires I make scripts that the game runs on anything I want to mod? So if I wanted to mod the behavior of fighters, I'd need to have a script to run on them, and a script that runs that script on them and is attached to the sector or something else. Similarly to wanting to mod fighters, does the same apply to any weapon and so on too?

     

     

    Having a bit of trouble though. I didn't see any callbacks that are specific to fighters, so I'm wondering the best route to go about hooking things to fighters.

     

    To start with very basically, I'm thinking just tagging their on-death function to replace them in the carrier after a period of time and deduct some minerals. Since this is super basic, they'd probably just 'hang' there as debt until you could pay for them, and would lack any UI for this...

     

    Past that, more advanced behavior I might be interested in is how to, say, change them into modules the same as turrets, but based on hangar space and so on; which documentation I'd need to be looking into, especially to make the AI continue to use them.

     

    Basically just hoping to get pointed in the right direction.

×
×
  • Create New...