Basic Mod Questions

Everything about mods can be found here.

Moderator: Morax

Re: Basic Mod Questions

Postby Crazy Cossack » 15 Oct 2018, 03:15

Unfortunately, I cannot get this code to work for adding the T1 radar to the T1 Commander's build list. It works for increasing the health and maxhealth of the T1 radar.

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.
Crazy Cossack
Avatar-of-War
 
Posts: 53
Joined: 13 Mar 2013, 12:44
Has liked: 0 time
Been liked: 9 times
FAF User Name: Crazy_Cossack

Re: Basic Mod Questions

Postby Uveso » 15 Oct 2018, 17:07

Yes commander buildtree is tricky.

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
(17.6 KiB) Downloaded 109 times
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: Basic Mod Questions

Postby Crazy Cossack » 18 Oct 2018, 02:15

Great! That code works, thanks. I understand code like that when I see it but I don't know enough lua yet to come up with my own solutions, so far.

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.
Crazy Cossack
Avatar-of-War
 
Posts: 53
Joined: 13 Mar 2013, 12:44
Has liked: 0 time
Been liked: 9 times
FAF User Name: Crazy_Cossack

Re: Basic Mod Questions

Postby DDDX » 18 Oct 2018, 15:30

One good way of testing things is through replays.
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 ;)
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX

Re: Basic Mod Questions

Postby nine2 » 19 Oct 2018, 00:42

pretty sure that wouldn't work - it would desync
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Basic Mod Questions

Postby DDDX » 19 Oct 2018, 11:59

well sure it desyncs, that's the whole point - you want it to desync. If it does not,t hen the changes you made are not in effect at all and the replay goes on like the original game goes on - meaning you screwed up in your alterations.

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
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX

Re: Basic Mod Questions

Postby nine2 » 26 Oct 2018, 01:46

makes sense, it's a good idea
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Previous

Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest