Prototype Lua mod loader

Discuss and distribute tools and methods for modding.
Lemonymous
Posts: 94
Joined: Fri Mar 09, 2018 3:29 am

Re: Prototype Lua mod loader

Postby Lemonymous » Thu Mar 15, 2018 4:28 pm

Captain Trek wrote:Uhhh, am I missing something here? Is it supposed to be possible for ordinary people to understand how to get a mod working using this thing, or is this mod programmers only until you guys can come up with a more user-friendly solution?

It is possible for ordinary people. Could you describe your problem?

Edit: On second thought, I suppose it depends on what you mean by "ordinary people" and "mod programmers". In order to mod you will have to do some scripting, but it is not that difficult if you are willing to learn.

The easiest way to get started is to download both the mod loader and the example mod from the OP and place them in the folders he describes. Then examine and edit the example mod to see what changes. Use the console (button next to 1 on your keyboard) to see if the mod was loaded correctly. Search the web for Lua specific syntax, or ask if there is anything you can't find the answer to.

Good luck!
User avatar
Chrisy15
Posts: 7
Joined: Sun Mar 04, 2018 5:07 pm

Re: Prototype Lua mod loader

Postby Chrisy15 » Thu Mar 15, 2018 6:11 pm

Captain Trek wrote:Uhhh, am I missing something here? Is it supposed to be possible for ordinary people to understand how to get a mod working using this thing, or is this mod programmers only until you guys can come up with a more user-friendly solution?


If you're just trying to use a mod, it's not really more complicated than Overwrite Files -- > Create Folder with Specific Name --> Place Mod In Folder.

If you're trying to make a mod, then as mentioned existing code and mods should be enough to work from. This certainly isn't meant to be a drag-and-drop make-your-own-mod utility thing.
Civ V and VI modder enticed by the idea of giant mech suits suplexing giant insects into each other's paths.

Where the Korean Flower roams, it seems Lua follows...
...no sign of a database yet though...
User avatar
Kieve
Posts: 952
Joined: Tue Sep 18, 2012 2:21 pm
Location: Low Orbit
Contact:

Re: Prototype Lua mod loader

Postby Kieve » Fri Mar 16, 2018 12:07 am

Looks like I'll have to brush up on my scripting knowledge if I'm gonna be any use these days. My, how far things have come...
Lemonymous
Posts: 94
Joined: Fri Mar 09, 2018 3:29 am

Re: Prototype Lua mod loader

Postby Lemonymous » Sat Mar 17, 2018 4:20 pm

When adding new squads via the mod loader, squad filtered statistics gets messed up. In addition, if you remove a mod, trying to open statistics will give an error since it is trying to find a mech that does not exist anymore. Is this something that can be fixed, or is it just something we have to live with?
tom_gamebanana
Posts: 3
Joined: Mon Mar 05, 2018 3:23 am

Re: Prototype Lua mod loader

Postby tom_gamebanana » Tue Mar 20, 2018 1:22 pm

stickthemantis wrote:If I understand correctly, that would require me turning the mod loader into an exe. Right now it's a bunch of scripts which extend off the base game, which might not be the most convenient way to do it, but I'm actually trying to emulate what it would be if the game had official mod support and mods were downloaded from the steam workshop. ITB is a young game, lets hope the devs show the modding community some love.


I could help you with the exe - many mod loaders are similar in the sense that they all take files and move them based on game-specific rules. So we are developing a framework of sorts with various C# libraries you can use to add these common mod loader operations without coding them from scratch - URL downloading, archive decompression, trusted file whitelists, mod backups, mod restores, etc. We have some mod loaders with built in browsing libraries to see installed mods, automatic updating, etc, based on our API. Once you have 1-click web-installing you basically have something as good if not better than the STEAM workshop (think nexus mod manager vs STEAM workshop for skyrim - NMM has much more options relating to load ordering, conflict resolution etc). My email is tom@gamebanana.com if you would like to discuss further. On a semi-related note, I finished ITB!
User avatar
stickthemantis
Posts: 37
Joined: Wed Jan 29, 2014 4:16 pm

Re: Prototype Lua mod loader

Postby stickthemantis » Mon Mar 26, 2018 7:09 pm

Hello everyone, I'm sorry for my recent absence, as I've been ill I've not felt like working on any mods. Fortunately, in the meantime, Automatic has steadily made advances on extending the game with c++, allowing us to among other things make new ui elements and finally get rid of that command prompt popup when opening the game.
ImageImageImage
As you can see, no need to page through the main menu to get to the squad you want. Mods can also add generation options, which are saved in the savefile and potentially allow the users to tweak their mods much more finely than previously.
Additionally, you can now append an entire dat file instead of adding images individually with appendDat, and you can overwrite the Move ability by adding moveSkill to a pawn.

If you have used a previous version of the mod loader/auto's api and the new ui elements won't show up, reinstall the game and then the mod loader.
I'm Cyberboy2000, known as a modder and community leader of Invisible Inc.
I'm using this old account because I've been unable to get any verification email for a new account. Help with changing my name would be appreciated.
User avatar
stickthemantis
Posts: 37
Joined: Wed Jan 29, 2014 4:16 pm

Re: Prototype Lua mod loader

Postby stickthemantis » Thu Mar 29, 2018 8:14 am

Fixed a duplication issue with pilot rearrangement.
Added an isVersion function. It compares a version string to another (for example the mod version), by default it compares to the API version.
Added hooks for before and after environmental effects are played (note that they're called even if the mission doesn't have any environment, so they can be used as before the enemies attack hooks)
I'm Cyberboy2000, known as a modder and community leader of Invisible Inc.
I'm using this old account because I've been unable to get any verification email for a new account. Help with changing my name would be appreciated.
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: Prototype Lua mod loader

Postby kartoFlane » Tue Apr 10, 2018 12:05 am

Seeing as Cyber has been absent and unreachable for extended periods of time, on top of -- for some reason -- ignoring repeated pleas for a git repository to enable community-driven bugfixing, I decided to continue development of the mod loader on my own.

The GitHub repository / download can be found here: https://github.com/kartoFlane/ITB-ModLoader

The download page includes a complete list of changes. Most important perhaps are a fix for the sticky slider issue, mouse input bugs in modded UI, and API changes:

  • modApi:deltaTime()
    Returns the amount of time that passed since the previous frame
  • modApi:elapsedTime()
    Returns the amount of time that passed since the game has been started
    .
  • RENAMED preMissionStartHook and missionStartHook to preMissionAvailableHook and missionAvailableHook
    Done to prevent confusion, since these hooks are fired when a mission becomes accessible on the island map, NOT when the player enters the game board.
    .
  • missionStartHook
    Now actually fires when a mission is started (when player confirms mission selection and loads into the game board)
  • preLoadGameHook / postLoadGameHook
    Fired before/after game state is loaded (including turn reset)
  • saveGameHook
    Fired whenever game state is saved (this happens multiple times per turn)
  • preStartGameHook / postStartGameHook
    Fired right after exiting the hangar, before/after GAME variable is created
Superluminal2 - a ship editor for FTL
User avatar
Blue_Tree
Posts: 21
Joined: Thu Jan 18, 2018 5:18 pm

Re: Prototype Lua mod loader

Postby Blue_Tree » Wed Apr 18, 2018 4:08 pm

Hello,
I am working on a translation and I wanted to know if it's possible to simply load modded scripts (for exemple text.lua translated in french) instead of the base script.
I already made a little mod which change fonts and some other resources but I don't really know how to make a script (I followed the little tutorial for making this mod).
Is it possible to do this and if yes, how ?
User avatar
kartoFlane
Posts: 1488
Joined: Mon Jan 14, 2013 10:20 pm

Re: Prototype Lua mod loader

Postby kartoFlane » Wed Apr 18, 2018 4:56 pm

Generally you shouldn't overwrite whole script files, since the modloader itself overrides functions defined by them to implement its features.
However, the modloader's API has a modApi:overwriteText() function, which should allow you to override entries in Global_Texts, Weapon_Texts, and Achievement_Texts tables.

Something like this:

Code: Select all

local translatedTexts = {
    entry1 = "some text",
    -- rest of your translated texts
}

for k, v in pairs(translatedTexts) do
    modApi:overwriteText(k, v)
end
Superluminal2 - a ship editor for FTL

Who is online

Users browsing this forum: No registered users and 2 guests