Jump to content

infal

Members
  • Posts

    50
  • Joined

  • Last visited

Everything posted by infal

  1. I think it depends specifically on what you want to do. My mod, Infinion Irregular Goods Transportation uses a script on the player to register and handle onSectorEntered events. That event handler searches all ships in the sector and finds any with entity/antismuggle.lua and removes that script and adds a customised version (mods/infinionigta/antismuggle.lua) If I needed to save any data for the military ships, I would do it with secure/restore in the custom antismuggle script. If I needed to save data relevant to the player, I would do it in the player script. I don't know exactly what you're trying to achieve but it sounds like you would do something similar. When the player enters a sector, check all of the stations to see if any you're interested in: a) exist , and b) have your custom script. If not, add the custom script. In the custom script, save any data relevant to the station.
  2. I'm not sure what you mean. This?: <ModLoader> -- Required version of Infinion Corporation: v1.0.0 <ModLoader> -- Actual version of Infinion Corporation: v1.0.2 As long as the actual version is greater than the required version it is considered okay.
  3. Ahh... no. None of my mods do anything with planets. It's not suspicious to you that planets are cuboid on the 1st of April...? Improved Planet Visuals released by Koonschi ;)
  4. Also, ModLoader puts a lot of info into the log files that you can look for to see if it's running, or if there was an error that gets the script set to invalid by the game engine. Client log: %appdata%/Avorion/clientlog *.txt <ModLoader> Initializing ModLoader <ModLoader> Registering mod: Cargo UI ... <ModLoader> Running onInitialize for mod:Cargo UI <ModLoader> Registering player ship script: mods/cargoui/interface.lua Server log %appdata%/Avorion/galaxies/savename/serverlog *.txt <ModLoader> Running onInitialize for mod:Infinion Irregular Goods Transportation Addon <ModLoader> Registering player ship script: data/scripts/modloader/lib/adminui.lua
  5. Admin UI will only show if a mod registers an admin ui module AND the modloader/config.lua : t.giveAdminPanelAutomatically is set to true (which it is by default). If no mods call registerAdminUIModule, then the script isn't attached to the player ships, to save system resources. No sense having a script attached to every player ship if it's not doing anything meaningful. Cargo UI doesn't actually add an admin ui module, as in my mods I'm using the admin ui to cheat in items for testing etc and cargo ui doesn't add any new items. The Cargo UI icon will only show when you're in a ship, not the drone. If you want to manually attach the admin ui to a ship, you can use the command /run Entity():addScript("modloader/lib/adminui.lua")
  6. As I said before, I haven't had any problems installing mods. It's only when you uninstall mods that the game can delete entities and respawn players.
  7. infal

    [Mod] Cargo UI

    Yeah it's definitely possible to add more features. The only reason I haven't is because I expected the mod to have a very short lifespan. Koonschi has said somewhere that he's aware of the cargo window problem and will fix it so, when he does, this mod will be redundant.
  8. infal

    [Mod] Cargo UI

    Updated for Mod Loader v1.2.0 Honestly I thought this one would have been redundant at the last Avorion update, but it seems to still be useful.
  9. Overview; Adds an Arbitrary, Military and Civilian Turret Control System with slightly boosted stats over the base game versions. The Infinion Corporation modules give 2 more turrets than base systems but there is a random factor that means legendaries can add up to 9 turrets. They are random loot drops from Military and Civilian NPCs. If you want them... you wont get them from Xsotan or Pirates. This was really a proof of concept for Mod Loader but it's a good addition to the game. Screenies: Downloads: You need to have Mod Loader v1.2.0+ Mod Loader Forum Topic Infinion Faction Modules v1.0.0 Zip Download
  10. Okay, I've got v1.2.0 of my mod loader up. It adds 3 functions for mod authors: One that lets you register system upgrades as loot drop for NPCs. One that lets you register a script that will be attached to the player ship any time they enter a ship, and, one that lets you add a module to a mod loader admin panel. More info in the OP. I've also added a mod template and a new mod that just shows how to add some basic, modified system upgrades. (just copies of the existing turret systems with boosted stats.) I also forked a 1.3.x dev branch on GitHub
  11. Thanks, it was the smallest of typos but I didn't notice until you pointed it out. I've just put new versions of all 3 downloads with bug fixes and better features. Version History: v1.0.2 25Mar2017 - So many bug fixes... - Dangerous goods permit now actually works! - Now works for military ships that spawn in, faction war etc - Dangerous goods permit now gives a regular warning. Default is every 5 minutes, can adjust in config.lua - Admin UI is now integrated with the Mod Loader Admin UI - Fixed typo in check for home sector (Special thanks to Devious for pointing this out) - Made the Cargo Shield modules very power hungry (20 something GW for legendary) but can be scaled by changing powerFactor in config.lua though they are supposed to be power intensive for balancing. If you're updating, get all 3 downloads!
  12. Exactly. I don't want to spend a bunch of time writing something that is literally already being officially developed, but on the other hand Mojang promised a modding API for Minecraft and 5 years later we have "resource packs". :o
  13. I'd think of that as more a launcher, but maybe that's just semantics. Regardless, what you've described is well beyond the scope of what I'm doing at the moment, but I like the ideas. If no one works on something like that, I might look at it in the future. I'd probably want to put all of the core functionality in a c static lib and make it compatible with zip and patch files. With a proper launcher, a lot of the stuff I'm doing at the moment could be simplified to just a set of utility functions. Having that functionality built in to the game engine would be best though as that would make it possible to have per-save mod configurations and client downloading from server.
  14. Well I expect... no, demand, 75% of all profits ;D I don't really need any special mentions or anything, just pay it forward. As you get better and better at scripting /programming etc you start to find that you're less often the person asking questions and more often the person answering questions. So, as you get more experience, help the people starting out where and when you can. If you do that, my job here is complete. I've run into the problem of renaming scripts causing problems myself. It seems like the game engine handles missing files by just deleting objects so, uninstalling mods is a challenge. If you need to test, use the debug menu to spawn a research station. /run Entity():addScript("lib/entitydbg.lua") I'm glad it all worked for you. I like playing in a mid sized ship... don't like 5 - 6 of my 8 - 10 upgrade slots being Xsotan artifacts, so will definitely add this mod in. I'd say start a new thread for the mod release, a lot of people just wanting to download mods wont necessarily click a thread asking for help with scripting.
  15. Okay, the selectedObject was a long shot but worth considering. Obviously the loot entity stores a reference to the player ship once the player is close enough to pick it up but maybe it's not exposed to LUA. Scanning every entity in the sector would be inefficient. Especially if it's a sector with thousands of asteroids. You can do it other ways though Sector():getEntitiesByType(EntityType.Loot) or you could build a table of loot entities as they're created with onEntityCreate event and then remove them from the list with onLootCollected (and maybe onDestroyed, for despawning?) Then once you have a manageable list of loot entities you can test those for distance to the player ship. I really like the idea of fighter craft that are specifically for loot collection only, no weapons.
  16. So this code local result = transformToCustomSuperModule(items) if result == nil then result = transform(items) end would go in the research function and would replace local result = transform(items) That way, the function transformToCustomSuperModule would be called first and transform would only be called if the player didn't have the right ingredients for your module(s). Instead of calling transform, we want to call transform only if the player doesn't have the ingredients for the custom modules. transformToCustomSuperModule would do the checks for any custom modules eg function transformToCustomSuperModule(items) -- i is a counter to keep track of how many modules match the required input local i i = 0 for _, item in pairs(items) do if string.match(item.script, "systems/teleporterkey") then -- if the input was okay, add 1 to i i = i + 1 end end -- check if i is 5. If it is then the player put 5 of the right modules in. if i == 5 then -- return the custom 25 module return SystemUpgradeTemplate("data/scripts/systems/25turret.lua", Rarity(RarityType.Legendary), random():createSeed()) end -- Just copy and paste from above to get the next recipe i = 0 for _, item in pairs(items) do if string.match(item.script, "systems/25turret") then -- if the input was okay, add 1 to i i = i + 1 end end -- check if i is 5. If it is then the player put 5 of the right modules in. if i == 5 then -- return the custom 125 module return SystemUpgradeTemplate("data/scripts/systems/125turret.lua", Rarity(RarityType.Legendary), random():createSeed()) end -- the input was not valid for any of our recipes so just return nil return nil end Most of the code in transform is not really relevant to what you need to do.
  17. Yes, but the loot drop is also an Entity with a selectedObject field of it's own. I was wondering if when a player gets close and the loot drop starts moving towards the ship, maybe internally the selectedObject of the loot entity had been set to the player ship. So if you could force it to be set to the player ship at a greater radius they might move towards the player ship of their own accord. It's also possible that selectedObject for loot entities is just ignored.
  18. I haven't seen anything that would be an easy mod, like addBaseMultiplier(magnetRange, 2) or something... but I was also thinking about the idea that scooping loot can be tedious. I wondered if a work around could be to have a module that scanned once per second for any entities in a bounding sphere with the property isLoot = true and just teleport them to the player ship's position, but haven't looked into it further. There is another property on Entity called selectedObject. It's a long shot, but maybe loot entities move towards whatever that is set to, so you could use the bounding sphere again and set that value to the player ship entity.
  19. Hey, that was me! ;D I would probably look at putting a check in before the transform method is even called. eg: local result = transformToCustomSuperModule(items) if result == nil then result = transform(items) end and then function transformToCustomSuperModule(items) -- If there are the 5 modules you need to make the super module, -- return the super module. -- Otherwise, return nil and let the default transform function -- handle it end
  20. Client automatically downloading mods from server? I don't think that's possible with LUA. Hopefully one day Koonschi makes it possible right from the game engine.
  21. Over the weekend I've been tinkering with a function that will make it easy for modders to add custom system upgrades to NPC ships as loot with a single function call eg: local scriptCargoShield = "data/scripts/mods/cargoshield/cargoshield.lua" local distribution = { [5] = 0.1, -- legendary [4] = 1, -- exotic [3] = 8, -- exceptional [2] = 16, -- rare [1] = 32, -- uncommon [0] = 128, -- common } local chancePiratesDropCargoShield = 30 registerSystemUpgradeAsLoot(scriptCargoShield, NPC.Pirate, ShipClass.Any, distribution, chancePiratesDropCargoShield) -- distribution can be nil and the script will just use a default table. registerSystemUpgradeAsLoot(scriptCargoShield, NPC.Civilian, ShipClass.Miner, nil, 40) Any time the player enters a sector or anytime ships are created (eg pirate attack, xsotan attack, faction battle), mod loader will try to add loot to the ship(s). This will make it a lot easier to get a custom system upgrade module into the game without hacking base files. It's not quite ready to release but getting close.
  22. At the moment it seems that if the game engine can't find a script added to the player, the player respawns as a different faction. If the game engine can't find a script attached to an entity (ship, station), the entity gets deleted. This is a limitation of the game engine but I haven't had it happen when installing a mod, only uninstalling. Did you delete another mod at the same time as adding this mod? It's not possible to make this mod server side only, because of the dialog (buying the permit) and possibly other things eg: /Avorion/Documentation/ScriptUI.html "ScriptUI This object is only available on the client."
  23. I'm working on fixing a bug for this mod. When temporary defenders spawn in eg Faction Battle, they will ignore the permit and cargo shielding. The dangerous goods permit is attached to the player and I don't think you can have a window for scripts attached to the player. (at least, I haven't been able to make it work) It will give you a notice at 5, 2 and 1 minutes, but I could make it "minutes % 5 == 0" so it would be every 5 minutes eg 15, 10, 5 etc. and maybe put a config option for how often so people could change it to whatever they like if 5 minutes is too often for them.
  24. Why doesn't it work on the server? The entire point of the (mod loader) project was to keep modded files seperate from base files and, then have them load without editing base files. It would take a modest rewrite to go back to not using mod loader and if the (mod loader) system can't possibly work for dedicated server then I'd probably choose just developing mods for singleplayer until Koonschi implements a proper mod loading system (if he does at all!)
  25. Interesting. So could be an error in the ui initialisation assuming both ships have a cargo bay? Does it work if you try to transfer crew or cargo between two ships with hangar bays?
×
×
  • Create New...