Your welcome, syntax is a bitch, no matter the programming language. Since we do not have and IDE the equivalent of Visual Studio, there is not much that can help us with these small mistakes.
Let us take your questions one at a time.
Q1
datim wrote:But i have another question, a few attempts earlier i had done it like this, but i also had a lua file into the main folder, that didn't work however. So if you have a lua folder in your hook folder, you cannot have another lua folder in the main folder?
For changes to existing game files (such as armordefinition.lua), you should place them in a hook folder and then in the same directory structure you see in the game files.
If you create your own files that fall under a lua folder, then you create a lua folder under your mod directory. Again, and I cannot stress this enough, see examples done in other mods.
Q2
datim wrote:Also, with the mod_units_UEF.bp , i tried to change the tech level of a unit, however i noticed that i need to use destructive hooking to fix this. Does this mean that i need to have the modunits folder in the hook folder as well? Or, in this case, can i have 2 modunits folders with one of them in the hook (and different name ofcourse) and one of them in the main folder?
This is correct. In a blueprint file, such as in Categories, there are all these text entries inside the array. Example:
- Code: Select all
Categories = {
'PRODUCTSC1',
'SELECTABLE',
'BUILTBYTIER1FACTORY',
'BUILTBYTIER2FACTORY',
'BUILTBYTIER3FACTORY',
'CYBRAN',
'MOBILE',
'NAVAL',
'TECH1',
'DIRECTFIRE',
'ANTIAIR',
'ANTIMISSILE',
'SUBMERSIBLE',
'VISIBLETORECON',
'RECLAIMABLE',
'T1SUBMARINE',
'OVERLAYSONAR',
'OVERLAYANTINAVY',
'OVERLAYDIRECTFIRE',
},
So how do we go about removing 'TECH1' and then adding 'TECH2'? The adding in of 'TECH2' can be simply done with Merge blueprint. The removing of 'TECH1', well...
Option 1, Destructive hooking or "How not to play nice with other mods and have your changes be very hard to find"
Inside your hook folder, create a units folder.
Inside the units folder, you create a folder labeled with the unit id.
Inside the new folder labeled with the unit id, you copy over the original 'unit id'_unit.bp
Open up that 'unit id'_unit.bp file and make any changes you want.
If you have any other mods running and they change the same unit, then it will come down to the UID of the mod as to which will actually run. Sad time for me who usually plays with 70 or so mods at once.
Option 2, ModBlueprints or Non-Destructive Hooking or "How not to play nice with other mods and have your changes be very easy to find"
Inside your hook folder, create a lua folder.
Inside the lua folder, create a system folder.
Inside the system folder, create a file called Blueprints.lua
Now comes the part where you need to look at examples, *cough* BlackOps Unleashed Balance Changes *cough*
You begin in the Blueprints.lua file with this:
- Code: Select all
do
local oldModBlueprints = ModBlueprints
function ModBlueprints(all_bps)
oldModBlueprints(all_bps)
From here you can specify a single unit:
- Code: Select all
if all_bps.Unit.xsl0309 then
Multiple units, the smart way (hint, try to avoid repeating if all_bps.Unit.blaa blaa)
- Code: Select all
local units_SCU = {
'ual0301',
'uel0301',
'url0301',
'xsl0301',
}
for scuid, buildcat in units_SCU do
if all_bps.Unit[scuid] then
Multiple units, the smart way, with faction differences
- Code: Select all
local units_SCU = {
ual0301 = 'BUILTBYTIER4COMMANDER AEON',
uel0301 = 'BUILTBYTIER4COMMANDER UEF',
url0301 = 'BUILTBYTIER4COMMANDER CYBRAN',
xsl0301 = 'BUILTBYTIER4COMMANDER SERAPHIM',
}
for scuid, buildcat in units_SCU do
if all_bps.Unit[scuid] then
or units that have things in common:
- Code: Select all
for unitid, unitbp in all_bps.Unit do
for k, cat in unitbp.Categories do
if cat == 'HOVER' then
Now for your case, Categories is a table of values. So we have to first remove an entry:
Single unit
- Code: Select all
table.removeByValue(all_bps.Unit.uel0106.Categories, 'TECH1')
Multiple units, smart way
- Code: Select all
table.removeByValue(all_bps.Unit[unitid].Categories, 'TECH1')
Units that have things in common
- Code: Select all
table.removeByValue(all_bps.unitbp.Categories, 'TECH1')
Now we add an entry:
Single unit
- Code: Select all
table.insert(all_bps.Unit.uel0106.Categories, 'TECH2')
Multiple units, smart way
- Code: Select all
table.insert(all_bps.Unit[unitid].Categories, 'TECH2')
Units that have things in common
- Code: Select all
table.insert(all_bps.unitbp.Categories, 'TECH2')
Make sure to add all the end's you need to close each function, including the first do function at the top of Blueprints.lua
datim wrote:Thanks again and i will definietly look into 'BlackOps Unleashed Balance Changes'.
For scripting help, which is another order above with modding SupCom, I recommend going through the mod '4DC FAF Release (v0.5)', the units folder (new custom units, not under the hook folder) and look at each units' _Script.lua file