Forged Alliance Forever Forged Alliance Forever Forums 2018-10-26T01:46:27+02:00 /feed.php?f=41&t=16789 2018-10-26T01:46:27+02:00 2018-10-26T01:46:27+02:00 /viewtopic.php?t=16789&p=168799#p168799 <![CDATA[Re: Basic Mod Questions]]> Statistics: Posted by nine2 — 26 Oct 2018, 01:46


]]>
2018-10-19T11:59:21+02:00 2018-10-19T11:59:21+02:00 /viewtopic.php?t=16789&p=168612#p168612 <![CDATA[Re: Basic Mod Questions]]>
What is important, though is that you close the desync window and enjoy watching the replay unfold differently, to see exactly what you changed and how it affects the gameplay ;)
I use this method to test stuff all the time, trust me. I have some...hmm...i dare say over 500 watched desynced replays, easier than starting another game.
Though, wish I knew abut the ctrl+f10 method, that seems even faster :p

Statistics: Posted by DDDX — 19 Oct 2018, 11:59


]]>
2018-10-19T00:42:48+02:00 2018-10-19T00:42:48+02:00 /viewtopic.php?t=16789&p=168608#p168608 <![CDATA[Re: Basic Mod Questions]]> Statistics: Posted by nine2 — 19 Oct 2018, 00:42


]]>
2018-10-18T15:30:28+02:00 2018-10-18T15:30:28+02:00 /viewtopic.php?t=16789&p=168599#p168599 <![CDATA[Re: Basic Mod Questions]]> For example, you start a game and start making a Paragon, and end the game when it is 10% completed.
Then you edit the cost of Paragon to be 10%, and just go watch the replay.
That same replay will show what happened earlier BUT USING CURRENT FILES. That means that you will watch yourself making that Paragon before you ended the game, even though you only made it to 10% originally.

It works for whatever you need - if you are making a new weapon, order the unit to shoot the ground, then end the game, edit the weapon and watch the same replay and whatever you edited will be seem in your replay.
It's quick, it's easy, you can speed it up 10x to get to where you need....and you dont need 500 games to test, just a couple...and a 500 seen replays ;)

Statistics: Posted by DDDX — 18 Oct 2018, 15:30


]]>
2018-10-18T02:15:21+02:00 2018-10-18T02:15:21+02:00 /viewtopic.php?t=16789&p=168587#p168587 <![CDATA[Re: Basic Mod Questions]]>
I have some more general questions to increase my general knowledge of where stuff is and what it means. Where are the best places to look for the files, functions etc. which handle buffs, regen and adjacency? Plus any mods which alter these kind of things so I can see examples? I am also interested in how to mod wreckage values.

I found lua/sim/AdjacencyBuffs

This table is interesting but what does each column (titled Size4 etc.) actually mean?
local adj = { -- SIZE4 SIZE8 SIZE12 SIZE16 SIZE20
T1PowerGenerator={
EnergyActive= {-0.0625, -0.03125, -0.0208, -0.01563, -0.0025},
EnergyMaintenance= {-0.0625, -0.03125, -0.0208, -0.01563, -0.0125},
EnergyWeapon= {-0.0250, -0.01250, -0.0083, -0.00625, -0.0050},
RateOfFire= {-0.0400, -0.01250, -0.0083, -0.00625, -0.0050},

Obviously, I want to play around with (change) adjancy buffs. Also, the routines which govern regen processing I have not really found yet (other than what's in the unit blueprints where regen buff levels can be altered.

With wreckage, I found wreckage percentage in the unit blueprints (which seem to say 90% mass) but real wreckage values seem to be about 81% mass. I haven’t checked many though. I am not sure why this discrepancy but I haven’t played with wreckage values yet.

I know this is a lot to ask. Feel free to answer one question per post if you want to take your time.

Statistics: Posted by Crazy Cossack — 18 Oct 2018, 02:15


]]>
2018-10-15T17:07:54+02:00 2018-10-15T17:07:54+02:00 /viewtopic.php?t=16789&p=168486#p168486 <![CDATA[Re: Basic Mod Questions]]>
If you want an un-upgraded commander to build this unit you need to add 'BUILTBYCOMMANDER''.
But you also need to remove all other commander build categories: BUILTBYTIER1COMMANDER, BUILTBYTIER2COMMANDER, BUILTBYTIER3COMMANDER

Here is a mod that add and remove the categories inside blueprints.lua as example:
T1ComRadarV1.zip

Statistics: Posted by Uveso — 15 Oct 2018, 17:07


]]>
2018-10-15T03:15:36+02:00 2018-10-15T03:15:36+02:00 /viewtopic.php?t=16789&p=168477#p168477 <![CDATA[Re: Basic Mod Questions]]>
Spoiler: show
if bp.BlueprintId == 'ueb3101'
or bp.BlueprintId == 'uab3101'
or bp.BlueprintId == 'urb3101'
or bp.BlueprintId == 'xsb3101' then
if bp.Defense.Health then
bp.Defense.Health = 100
end
if bp.Defense.MaxHealth then
bp.Defense.MaxHealth = 100
end
if bp.Categories then
-- table.insert(bp.Categories, 'BUILTBYCOMMANDER')
-- table.insert(bp.Categories, 'BUILTBYTIER1COMMANDER')
table.insert(bp.Categories, 5, 'BUILTBYCOMMANDER')
table.insert(bp.Categories, 6, 'BUILTBYTIER1COMMANDER')
end;
-- table.remove(bp.Categories, 5)

end -- end Radar T1


You will note I have tried directly inserting at undefined positions (the now commented out lines) and then I have tried inserting at defined positions in the table. Nothing works and I get no errors. I wonder if the table size has to be expanded elsewhere first? Or is there something that needs to be changed in the Commander (ACU) files to make this work?

This is puzzling because a test of table.remove did work. That test is now commented out too. If table.insert can be solved then I can add as well as remove units to/from build lists for various builders and factories. I may or may not want to do such things in a mod but it will be good to have the basic knowledge on how to do this. At the moment I am stuck. Nothing I try works. I've looked for examples of this in other mods but I can find no examples of table.insert in bp.Categories or elsewhere.

Statistics: Posted by Crazy Cossack — 15 Oct 2018, 03:15


]]>
2018-10-14T14:16:12+02:00 2018-10-14T14:16:12+02:00 /viewtopic.php?t=16789&p=168468#p168468 <![CDATA[Re: Basic Mod Questions]]>
Crazy Cossack wrote:
table.insert(bp.Categories, 'BUILTBYCOMMANDER')

This will enable an unupgraded ACU to build the unit.

If you want to add this to the "T1" commander build tree use this:
Code:
table.insert(bp.Categories, 'BUILTBYTIER1COMMANDER')


These are all 4 commander categories:
Code:
table.insert(bp.Categories, 'BUILTBYCOMMANDER')
table.insert(bp.Categories, 'BUILTBYTIER1COMMANDER')
table.insert(bp.Categories, 'BUILTBYTIER2COMMANDER')
table.insert(bp.Categories, 'BUILTBYTIER3COMMANDER')


If you only use BUILTBYCOMMANDER and you upgrade your ACU, then you can't build the unit any longer.
You need to add also the higher tier commander categories.

Statistics: Posted by Uveso — 14 Oct 2018, 14:16


]]>
2018-10-14T03:42:18+02:00 2018-10-14T03:42:18+02:00 /viewtopic.php?t=16789&p=168458#p168458 <![CDATA[Re: Basic Mod Questions]]>
table.remove(bp.Categories, 5)

But the reverse did not work;

table.insert(bp.Categories, 'BUILTBYCOMMANDER')

This didn't work. I was trying to add the radar to the T1 commander's build menu.

Your code for removal will perform better if developers change the relevant category at all. But it's actually adding an item to the build menu that I really want to know how to do. I will keep experimenting but all answers welcomed. :)

Statistics: Posted by Crazy Cossack — 14 Oct 2018, 03:42


]]>
2018-10-14T03:06:40+02:00 2018-10-14T03:06:40+02:00 /viewtopic.php?t=16789&p=168456#p168456 <![CDATA[Re: Basic Mod Questions]]>

Let's say you want to remove the category 'BUILTBYTIER2ENGINEER' from the blueprint categories array:
Code:
BP.Categories = RemoveItemFromArray('BUILTBYTIER2ENGINEER',BP.Categories)


To make this work, you need to include this function to your script file:
Code:
function RemoveItemFromArray(REMOVEME,ARRAY)
    zold = 1
    while ARRAY[zold] do
        if ARRAY[zold] == REMOVEME then
            table.remove(ARRAY, zold)
        else
            zold = zold + 1
        end
    end
    return ARRAY
end

Statistics: Posted by Uveso — 14 Oct 2018, 03:06


]]>
2018-10-13T22:19:57+02:00 2018-10-13T22:19:57+02:00 /viewtopic.php?t=16789&p=168447#p168447 <![CDATA[Re: Basic Mod Questions]]>
I don't know how to hook a whole file yet. I am probably overlooking something obvious.

With the current method I know how to change basic parameters (numeric values attached to variables). My next step is to learn how to delete or insert entries into tables. However, I can't get table.insert to work yet. I have tried to use this code to make the T1 radar, in its blueprint file, build-able by the T1 ACU Commander but the code does not seem to work. There may be something else I need to do?

Spoiler: show
-- Radar T1

if bp.BlueprintId == 'ueb3101'
or bp.BlueprintId == 'uab3101'
or bp.BlueprintId == 'urb3101'
or bp.BlueprintId == 'xsb3101' then
if bp.Defense.Health then
bp.Defense.Health = 100
end
if bp.Defense.MaxHealth then
bp.Defense.MaxHealth = 100
end
if bp.Categories then
table.insert(bp.Categories, 'BUILTBYCOMMANDER')
end;
-- table.remove(bp.Categories, 5)
end -- end Radar T1



If I remove the 3 lines to make it buildable and test that table.remove command then that works. I can for example take away the ability of a T2 ACU to make a T1 radar. These are just experiments to learn LUA. I have no real idea what will happen in my mod yet.

But I figure my first two steps are;

(a) learn how to change numeric parameters; (DONE)
(b) learn how to add and subtract unit capabilities by inserting and removing capabilities in list tables. (Still working on it.)

When I want to complexly modify whole files or create new files, I will have to learn how to hook whole files, for sure.

Statistics: Posted by Crazy Cossack — 13 Oct 2018, 22:19


]]>
2018-10-13T18:08:54+02:00 2018-10-13T18:08:54+02:00 /viewtopic.php?t=16789&p=168440#p168440 <![CDATA[Re: Basic Mod Questions]]>
Crazy Cossack wrote:
That means that I know how to change parameter values in blueprint files and nothing else.


Modding Blueprints.lua acts as : individual unit lua -----> blueprints.lua (you current hook) ----> Mod execution.


But, you can change values directly in individual unit bp too.

First so you need to copy and modify unit from the .nx2. rename the nx2 as a zip file and unpack it.
Image


Then Copy and hook the files needed (here in my Alliance of Heroes mod, UAL001 Aeon ACU) :
Image



Now you can have access to a huge amount of individual data you can change :

In the bp :
Image

This is a link to understand values and data : http://supcom.wikia.com/wiki/Blueprint


And in the individual script dealing with building restriction (as you requested) (Here AEON ACU enhancements T2-T3)
Image


About lua programming, don't be afraid, it's easy to understand and to learn if you proceed step by step. Just keep a look on existing code, and try to understand.

You can always ask on this forum for help.

Statistics: Posted by Franck83 — 13 Oct 2018, 18:08


]]>
2018-10-13T08:17:39+02:00 2018-10-13T08:17:39+02:00 /viewtopic.php?t=16789&p=168431#p168431 <![CDATA[Re: Basic Mod Questions]]> https://www.lua.org/pil/contents.html#P1

Statistics: Posted by speed2 — 13 Oct 2018, 08:17


]]>
2018-10-13T02:47:57+02:00 2018-10-13T02:47:57+02:00 /viewtopic.php?t=16789&p=168428#p168428 <![CDATA[Re: Basic Mod Questions]]>
Spoiler: show
-- Mexes T1

if bp.BlueprintId == 'ueb1103'
or bp.BlueprintId == 'uab1103'
or bp.BlueprintId == 'urb1103'
or bp.BlueprintId == 'xsb1103' then
if bp.Defense.Health then
bp.Defense.Health = 1000
end
if bp.Defense.MaxHealth then
bp.Defense.MaxHealth = 1000
end
if bp.Economy.MaintenanceConsumptionPerSecondEnergy then
bp.Economy.MaintenanceConsumptionPerSecondEnergy = 4
end
end -- end Mexes T1


That means that I know how to change parameter values in blueprint files and nothing else. I am learning from a very low base of knowledge. (Ignore the precise changes to the T1 mexes, it's just a test mod.)

The next thing I feel I need to learn is how to control what an engineer or ACU or factory can make i.e their build capabilities. What is the simplest and most elegant way to do that (to add or subtract to the list of what they can make)?

Because my knowledge base is low, I first have to learn by "monkey see - monkey do" techniques. As I put more items together, I will start to understand the overall language (LUA) and the folder and file structures of FAF. I hope. :)

To put my poor programming knowledge in context, I taught myself Basic and Turbo Pascal many years ago. I wrote a chess program with basic AI in Turbo Pascal. It had 2 move look-ahead (4 ply search) with a minimax algorithm. I modded Cossacks 3 for the last few years (mainly a parameters mod but it had some other aspects). Cossacks 3 uses object Pascal in its very large and messy scripts and full destructive hooking at the whole of file level, handled by their simple mod manager. So, change one parameter in a huge file (thousands of lines) and you had to overwrite that whole file on load. Then when the developers changed/inserted a hundred lines in that file (all over the place) for a patch it usually broke my mod and I had to do a file compare and merge on that file. This could happen to multiple files at patch time. Due to this and other issues with Cossacks 3 I gave up modding and playing it. It has a very poor game engine anyway.

I understand arrays but not classes and objects so that is a problem area with my knowledge. And of course, I have no idea where stuff is in all the different FAF files. LUA syntax is a bit different too. Some stuff seems case sensitive. There are no markers at end lines like (;) and the "if-then" statement needs an "end" statement (probably because there is no end line character like (;)). Also, "==" seems to mean "equal to" and "=" apparently means "becomes equal to" which other languages express as ":=".

A link to a syntax guide would be great. I'll start searching on the net too.

Statistics: Posted by Crazy Cossack — 13 Oct 2018, 02:47


]]>
2018-10-12T13:42:37+02:00 2018-10-12T13:42:37+02:00 /viewtopic.php?t=16789&p=168419#p168419 <![CDATA[Re: Basic Mod Questions]]> viewtopic.php?f=41&t=12970&start=10

You can also force the debugwindow to show up while gamestart:

Please Make a desktop-shortcut from the file:
C:\ProgramData\FAForever\bin\ForgedAlliance.exe
(Rightclick the file and select "Send to" -> Desktop Shortcut")

Open the shortcut and change the Command line (target):
from:
C:\ProgramData\FAForever\bin\ForgedAlliance.exe
to:
C:\ProgramData\FAForever\bin\ForgedAlliance.exe /init init_faf.lua /EnableDiskWatch /log C:\game.log /showlog

commandline explanation:
"/init init_faf.lua" this will start the normal FAF version of the game. Change this to "/init init_fafbeta.lua" and you will start the beta version of FAF
"/EnableDiskWatch" with this you can change unit or game files and the game will immediately load and execute the new changes. You dont need to restart the game.
"/log C:\game.log" will force to write the game.log at c:\ root dir.
"/showlog" displays the Debug Window (Shows the same what you can find inside the game.log)

[Edit] you should read the full topic from viewtopic.php?f=41&t=12970
There are many hints for start modding.

Statistics: Posted by Uveso — 12 Oct 2018, 13:42


]]>