Jump to content

Aki

Members
  • Posts

    166
  • Joined

  • Last visited

Posts posted by Aki

  1. Server():getOnlinePlayers() does not return a table. I can't use pairs on it, the error I get is: bad argument #1 to 'pairs' (table expected, got userdata). If I try and index it like an array Server():getOnlinePlayers()[0], I get an error saying: property not found or not readable: Player.0 which implies this is a player object? But none of the properties you would use on a Player object seem to return anything. (I am not very familiar with Lua as I am with other languages)

    Did I say it returns table? Read again what I wrote: it returns Player.... I even made that bold. Look at the code I gave you and notice {}. If you catch vararg without {} into a variable (local players = Server():getOnlinePlayers()) then you will get only first Player object, which is of type "userdata".

  2. I have found Galaxy():getPlayerNames(), however it returns a string, not a list, of player names separated by spaces (I think spaces??). I cannot split this string as there are players with spaces in their names.

    That's an issue if it returns it separated with spaces. Should be submitted as bug, I would say.

     

    You cannot use Galaxy():findFaction() for this as player names can change in steam.

    Let's pretend for a moment that it will work with a player name (it used to; it doesn't now). I don't see a problem with that. Player is bound to a name for single session on server (heck, even for a game session as it doesn't refresh). So as long as one doesn't want do remember player name (why would you want that in the first place? use index/id instead then get player name with it from faction object) it should be a good solution.

     

    Found Server():getPlayers() however it always returns nil.  Server():getOnlinePlayers() seems to return a userdata object, but I can't find documentation on it's properties or functions.

    It is written in documentation what it returns: function Player... getOnlinePlayers(), so basically:

    local players = {Server():getOnlinePlayers()} -- table of Players (Player object)

    If getPlayers doesn't work properly try playing with it around as much as you can and also submit it as a bug if you are sure it doesn't work.

     

    By the way it would be nice to have meta __type set up for various userdata (there are some projects that actually did that and it is quite lovely to deal with), but I guess that's just my small wish.

  3. I am still having trouble with the /crew command. I read the forum and still nothing helped me out. I was wondering if you could post a small video on the downloading of this mod.

     

    Read whole point before doing anything.

    Following dots on file paths and names are due to sentence structure, ignore them.

     

    [*]Clean-up if you installed it.

    [*]Download first file from the first post: this one.

    [*]Move that file to <Avorion>/data/scripts/commands/. Make sure that name is crew.lua.

    [*]Download second file from the first post: this one.

    [*]Move tat file to <Avorion>/data/scripts/player/cmd/. Make sure that name is crew.lua. Note that cmd directory might not exist - create it if needed.

    [*]That's it. Test it with example provided in first post.

     

    If you still have problems then press single-quote (') or tilde/backquote (~/`) to open up console. Make a screenshot and post it if there is anything interesting in it.

     

     

  4. Yes of course, feel free to add it to your package. Since i used your code it's the least i can do lol.

     

    Point is I wanted you to add it so it will remain your contribution in commits. ;)

     

    Or, I think, I could rip it from your repository along with your commits, heh.

  5. Again, the same case as with /agoods. With few changes I would gladly accept pull request with this command for the package. You will be listed as an author along with e.g. me and your command will be accessible easier through single package (when the Steam Workshop support will come out).

  6. era5or,

    Charging players for use would be simple. Well, changing faction standings shouldn't be an issue either, but we already have version of this script that allows players only to change home to sector with friendly or own station. I think we should go in this direction. We are just waiting with this version for alliance update which will most likely change some of faction-related stuff.

     

    For charging in data/scripts/player/cmd/sethome.lua:

    local price = 1000
    if player:canPayMoney(price) then
       player:payMoney(price)
       --change home sector, lines 5,6
    end

    Or similar.

  7. Avorion\data\scripts\sectors\asteroidfield.lua:
       50      for i = 1, numAsteroids do
       51          local mat = generator:createAsteroidField()
       52:         local asteroid = generator:createClaimableAsteroid()
       53          asteroid.position = mat
       54      end
    
    Avorion\data\scripts\sectors\asteroidfieldminer.lua:
       46      for i = 1, numAsteroids do
       47          local mat = generator:createAsteroidField()
       48:         local asteroid = generator:createClaimableAsteroid()
       49          asteroid.position = mat
       50      end
    
    Avorion\data\scripts\sectors\functionalwreckage.lua:
       51      for i = 1, numAsteroids do
       52          local mat = generator:createAsteroidField()
       53:         local asteroid = generator:createClaimableAsteroid()
       54          asteroid.position = mat
       55      end
    
    Avorion\data\scripts\sectors\loneconsumer.lua:
       69      for i = 1, numAsteroids do
       70          local mat = generator:createAsteroidField()
       71:         local asteroid = generator:createClaimableAsteroid()
       72          asteroid.position = mat
       73      end
    
    Avorion\data\scripts\sectors\loneshipyard.lua:
       62      for i = 1, numAsteroids do
       63          local mat = generator:createAsteroidField()
       64:         local asteroid = generator:createClaimableAsteroid()
       65          asteroid.position = mat
       66      end
    
    Avorion\data\scripts\sectors\lonetrader.lua:
       62      for i = 1, numAsteroids do
       63          local mat = generator:createAsteroidField()
       64:         local asteroid = generator:createClaimableAsteroid()
       65          asteroid.position = mat
       66      end
    
    Avorion\data\scripts\sectors\lonetradingpost.lua:
       61      for i = 1, numAsteroids do
       62          local mat = generator:createAsteroidField()
       63:         local asteroid = generator:createClaimableAsteroid()
       64          asteroid.position = mat
       65      end
    
    Avorion\data\scripts\sectors\miningfield.lua:
       89      for i = 1, numAsteroids do
       90          local mat = generator:createAsteroidField()
       91:         local asteroid = generator:createClaimableAsteroid()
       92          asteroid.position = mat
       93      end
    
    Avorion\data\scripts\sectors\pirateasteroidfield.lua:
       60      for i = 1, numAsteroids do
       61          local mat = generator:createAsteroidField()
       62:         local asteroid = generator:createClaimableAsteroid()
       63          asteroid.position = mat
       64      end
    
    Avorion\data\scripts\sectors\piratefight.lua:
       64      for i = 1, numAsteroids do
       65          local mat = generator:createAsteroidField()
       66:         local asteroid = generator:createClaimableAsteroid()
       67          asteroid.position = mat
       68      end
    
    Avorion\data\scripts\sectors\resistancecell.lua:
       58      for i = 1, numAsteroids do
       59          local mat = generator:createAsteroidField()
       60:         local asteroid = generator:createClaimableAsteroid()
       61          asteroid.position = mat
       62      end
    
    Avorion\data\scripts\sectors\smallasteroidfield.lua:
       66      for i = 1, numAsteroids do
       67          local mat = generator:createAsteroidField()
       68:         local asteroid = generator:createClaimableAsteroid()
       69          asteroid.position = mat
       70      end
    
    Avorion\data\scripts\sectors\wreckageasteroidfield.lua:
       51      for i = 1, numAsteroids do
       52          local mat = generator:createAsteroidField()
       53:         local asteroid = generator:createClaimableAsteroid()
       54          asteroid.position = mat
       55      end
    
    Avorion\data\scripts\sectors\xsotanasteroids.lua:
       65      for i = 1, numAsteroids do
       66          local mat = generator:createAsteroidField()
       67:         local asteroid = generator:createClaimableAsteroid()
       68          asteroid.position = mat
       69      end
    
    Avorion\data\scripts\startsector.lua:
       48      -- create a big asteroid
       49      local mat = generator:createAsteroidField()
       50:     local asteroid = generator:createClaimableAsteroid()
       51      asteroid.position = mat
       52  
    
    16 matches across 16 files
    

     

    You can start with this list. In most cases spawning claimable asteroid is a result of rolling `numAsteroids = math.random(0, 2)`. Then there is startsector which will always have one. Sadly, there is no global setting for that, but I think it would be worth adding along with others, like "Big asteroids probability", "Asteroid fields amount" etc. to customize generation process not just by seed.

  8. For the add crew...is there a way you can make it add actual professionals instead of just regular crew?

     

    Currently no, sorry, I want to add it asap but if there is someone who want to do it, then I'm open for any contribution.

     

    Is it planned to add fighter spawning?

     

    Yeah, it is a little bit more complicated than /inventory, because you need to create/have squadrons beforehand, but after that it should be quite similar.

     

    I am having problems with the turret adding. I made the lua file and pasted it in data/scripts/commands but it does not work in game :O I tried one of the example ones in the original post and nothing happens.

     

    Make sure you have pasted all files in correct directories. Note the player/cmd/ path.

  9. oooh I see... I thought I could execute a script. Thanks

    Actually. You can! With built-in Lua functions (loadfile, dofile). For instance:

     

    <avorion>/data/scripts/test.lua:

    return 1

     

    In chat:

    /run loadfile("data/scripts/test.lua")()

     

    Prints in console:

    4

     

     

  10. Hey Aki, spend some time helping instead of patrolling the forums for swear words.  Then frustration won't escalate so high.

     

    Frustration is escalated only by your own behaviour. Shulrak's answer was a valid one. Your second post was overreacted and even if you think it wasn't - there are no excuses for using profanity on forums. Any further discussion and your last comment are obsolete.

     

    Locking thread.

  11. For the second command, I do not have anything referring to /cmd anywhere in the player folder, the only folders within player is a mission folder and a story folder. Do I need to make a folder and label it cmd? or am I missing something with the file?

    No, it is a custom directory, so you are not missing anything. Just create it, path must be exact.

     

    So with the /inventory turret script, is there any way to control what bonuses the turrets get? For example, is there a way to make sure the rocket launchers get the seeker bonus? Also, what exactly is the use of the available function? I mean, it's nice knowing what all you can make legally in system, but how does that function have any use when you can spawn what you want? Or does that in some way tie into my earlier question and I just don't realize it?

    How I can create turret with some propeties such as accuracy, heatPerShot (and all of TurretTemplate.html)?

    Currently that is not possible, sorry.

     

    /crew dont work :(.

    if i take: /crew add mechanic he add a unlearnet man but no special mechanik. normal people dont lvl :(. its for other, too

    It is not yet implemented but it should be added really soon. Currently you can only add crewmen of default experience.

  12. The crew command for me seems to be completely broken but everything else works perfectly.. When trying to add crew, it just does nothing at all for me. I've also tried every single combination of the crew command, still nada.

     

    Could you be more specific? Are there any bugs in console? Is there any response from the server when you use it?

     

    am i going crazy or was there a list of the /turret and /system commands here ?

     

    what were the name of the systems again :( 

     

    There are merged into /inventory. You can see all available upgrades with /inventory available upgrades.

  13. Request: command for showing price (money and minerals) of currently boarded ship. Would be useful for those who like to plan ships in creative mode.

     

    Added /price.

     

    edit: I am not sure. But I think the code for the crew has a problem.

    Sometimes we can have a captain in each ship, but this one does not execute orders. I change ships or reverse the captains, and the problem remains.

     

    I wasn't able to reproduce it, could you explain it a little bit more? I have build over 10 ships and filled them with crews. All of them took orders and executed them.

  14. Really liking the idea of the /sethome command, although when I try to use it in game it says "You can only do that in a home sector" Confused, I thought the point of the mod was to set a sector to a home sector?

    Same problem as LeRougePanda

     

    and

     

    I'm getting this error atm. Linux server.

     

    could not execute function 'initialize' in '"data/scripts/player/cmd/sethome.lua"':
    data/scripts/player/cmd/sethome.lua:28: attempt to perform arithmetic on a string value
    stack traceback:
            data/scripts/player/cmd/sethome.lua:28: in function <data/scripts/player/cmd/sethome.lua:3>
    
    Setting script "data/scripts/player/cmd/sethome.lua" to invalid.

     

    Sorry for that, update script and it should work as intended.

  15. You should add that "tmux" program has to be installed before starting the "manager".

    It is there already, though. In first step.

     

    Any idea what the problem is ?

    I haven't ran into this issue, but did you try running it without manager? Does the same issue occur? If yes, did you try validating server files with steamcmd? Check if server's root has steamclient.so and steam_appid.txt. Check if bin/ has libsteam_api.so (more likely client issue rather than api, but still try it).

×
×
  • Create New...