[HELP] Restricting access to ship class after research?

I would like to be able to restrict ship production of a certain ship class all across the board after a specific research is done. How would I go about doing this?

For example, lets say once I research “x” I will be unable to produce Battlecruisers ever again until the game is over. Or maybe even restricting production capabilities of an entire ship class? (i.e. corvettes)

The easiest way I can think of doing this is by adding it as a part of the gamerule.

For example, here’s a little bit of quick code I did:

function buildRestrictions()
	for playerIndex = 0,Universe_PlayerCount()-1,1 do	
		if Player_HasResearch(playerIndex, "research") == 1 then
			Player_RestrictBuildOption(playerIndex, "BuildItem")
		end
        end
end

All that does is iterate through the players and checks if it has that research item researched. If it does, then it restricts it from being built. All you’d need to do is set up your own checks for research then make sure it’s added as a rule in the timer_updating function in the deathmatch gamerule, by adding Rule_AddInterval(“buildRestrictions”,timer_interval) into that function.

Sorry I can’t be a little more detailed, in a bit of a rush.

EDIT: Check my post later down, turns out it’s a fair bit easier to do it for build options AND research.

You ought to be able to do it in the build and research lua using NOT (!) and setting up the right prerequisites for your ships.
Eg: BC required research = supercapital chassis & ion beams ! Cruise missiles
This would require you to research super cap and ion for a BC, but if you researched cruise missiles you no longer meet the prereq’s and won’t be able to build it.

There should still be some better examples in the relic forums too.

(I’m guessing this will still work after the next patch, I think it’s a LUA thing, not a specific HW thing.)

1 Like

Huh, I just checked the Karos Graveyard docs for the build lua stuff, and there is a not operator for research and subsystem requirements. So if you wanted say, a battlecruiser to not be buildable after a certain research, you’d have (using your own research items as the items)

RequiredResearch = "(BattlecruiserTechnologyTech & AnotherBattlecruiserTech) & !TechThatLocksOutBattlecruisers"

This will work for research too, as I’ve found out.

while I haven’t done much fiddling with HWRM’s files, I’m pretty certain it’ll still work on research entries too. I originally found it while working with the HW2 research luas, and I don’t think GBX has changed them that much.

Huh, you’re right. Just did a super quick test and the not operator works with research too. Strange, the Karos Graveyard docs are wrong. That’s good stuff to know.