Friday, April 13, 2012

[SC2-SOLVED] Get Exp. Gantries to build non-Exp. units

[:1]PROBLEM SOLVED: I needed to alter Research.lua, not the categories. Thanks, Mithy.
I am currently working on a merge mod that lets all Experimental land units get research upgrades. (Yes, the balancing will be a terror) However, it seems that the category
'EXPERIMENTAL' is mandatory for a unit that is built by an Exp. Gantry. However, if I leave the 'EXPERIMENTAL' category in my merged Exp. land units, then the game will not let them be upgraded, as the 'EXPERIMENTAL' category is also what stops units like the Megalith from being upgraded.
I want my mod to be AI compatible by changing nothing except for weather or not my Exp. units can accept upgrades. Does anyone know how I might be able to trick an Exp. Gantry into building non-'EXPERIMENTAL'-category Exp. units?|||I dont know about how, But I support this, could be cool :)|||You've got this backwards. You don't ever want to remove categories from units unless you are aware of all of the consequences of doing so (which would be VERY far-reaching in this case, and would completely break the AI, and any sim functions that look for units with EXPERIMENTAL category).
All you need to do is remove -EXPERIMENTAL from the affected buff/research categories in Research.lua.
Or, make new buff definitions for experimentals that give different bonus levels, and add those buff names to the Buffs table of each research item you want to affect experimentals, with the appropriate categories (in this case, inclusive of experimental, exclusive of TECH1 and/or TECH2).|||Mithy|||Because the DLC is already shadowing that file in z_lua_dlc1.scd. And the game has some kind of built-in recognition for its own .scd filenames that makes them have higher precedence than any others, so the .scd has to be replaced to change it.
Research is something that basically can't be modified without doing this, as all three of the core research+layout files are already shadowed.
Now, it is possible to use the support mod to sort-of hook Research.lua, but the only things you can change are things the lua uses - Buffs, CommandEnables, Shield, AbilityEnables, etc. There's no way to actually change any of the capitalized variables (e.g. CATS, COST, etc) in a hook, because the engine handles those internally, and the hooked version doesn't get used by the engine.

So, what you're trying to do basically requires a z_lua_dlc1.scd replacement, since removing EXPERIMENTAL from the units that have it would have pretty significant negative consequences.
Edit: Actually, it may be possible to bypass the category restriction by hooking OnResearchTechnology in AIBrain, looking for a custom category variable, and manually calling each affected unit's OnResearchedTechnologyAdded, pointing it to the appropriate research item. It shouldn't be too difficult, and I can probably walk you through this, if you're interested.|||Thanks, but no thanks. I don't know anything about LUA scripting, and only really know much about BP. files. I'll just stick with the more widely used z_lua replacement method. Thanks, though!
EDIT: Wait...how do I compress/encode my modified research.lua file?
It won't work when placed in there uncompressed/encoded.
I use 7zip software to read/write to SCD. files.|||I don't know if 7zip works for .scds. Winrar should always work uncompressed, and versions 4+ should work with Normal compression as well.|||Winrar it is then. I was sort of hoping to avoid that, since it's only a free trial offer, but I guess I'll take 45 days if it works better than what I have now. Thanks for the advice!

No comments:

Post a Comment