[UI] Grant Research through a dialogue

Hi all,

Been trying to build in some more branches to the STC research tree by setting up specialisations (Tactical, Science and Engineering). I have an ugly box with three buttons popping up ok which goes away as desired and even writes to the log but I don’t seem to be able to get it to grant research…

20181021113231_1

Any suggestions? Here’s what I have in behind those buttons

BTN_TACTICAL	= NewMenuButton("ReturnButton",	"TACTICAL",	"Choose a tactical specialisation",			0,	LAYOUT_BUTTONS,	"FEButtonStyle1_Alert_Chipped",	"UI_HideScreen(\"CareerScreen\"); print(\" >> MAIN >> | Tactical Specialisation Chosen\"); Player_Research(FE_GetCurrentPlayerIndex(), \"Specialisation_Tactical\");")
BTN_SCIENCE		= NewMenuButton("ReturnButton",	"SCIENCE",	"Choose a science specialisation",			0,	LAYOUT_BUTTONS,	"FEButtonStyle1_Alert_Chipped",	"UI_HideScreen(\"CareerScreen\"); print(\" >> MAIN >> | Science Specialisation Chosen\"); Player_Research(FE_GetCurrentPlayerIndex(), \"Specialisation_Science\");")
BTN_ENGINEERING	= NewMenuButton("ReturnButton",	"ENGINEERING",	"Choose an engineering specialisation",	0,	LAYOUT_BUTTONS,	"FEButtonStyle1_Alert_Chipped",	"UI_HideScreen(\"CareerScreen\"); print(\" >> MAIN >> | Engineering Specialisation Chosen\"); Player_Research(FE_GetCurrentPlayerIndex(), \"Specialisation_Engineering\");")

Hi,

I have some research grants based on AI difficulty that work. Maybe that will give you an idea.

They had to be placed in the scripts\races\X\deathmatch\props\gbx.lua for each race.

Here’s the gbx.lua for the Taiidan:

Number_Properties_Priority = 2.0

Number_Properties = {
	dm_challenge_research_baseline = 5,
}

String_Properties_Priority = 2.0

String_Properties = {
	dm_carriersonly_research_restrict = "SuperCapitalShipDrive",
	dm_nocruisers_build_restrict = "tai_heavycruiser",
	dm_nocruisers_research_restrict = "HEAVYGUNS",

	dm_noif_build_restrict = "Vgr_IF",
	dm_noif_research_restrict = "IF_tech",

	dm_nodn_build_restrict = "tai_dreadnaught",
	dm_nodn_research_restrict = "DreadnaughtTech",

	dm_rush_research_grant = "FighterDrive,FighterChassis,Subspace,DefenderSubSystems,DefenseFighter,CorvetteDrive,CorvetteChassis,HeavyCorvetteUpgrade,FastTrackingTurrets,Leg",
	dm_BCDN_research_grant = "HeavyGuns,DreadnaughtTech,SuperCapitalShipDrive",



	dm_research_restrict = "HeavyCorvetteAttackBurst,MissileDestroyerVolley",
	dm_allresearch_build_restrict = "tai_researchship",
	dm_allresearch_research_restrict = "HeavyCorvetteAttackBurst,MissileDestroyerVolley",
}

and it gets triggered by these lines in leveldata\multiplayer\lib\cpuplayers.lua:


									--starting reseach grant, based on level of difficulty
										if pass == 0 then
											
											--if Player_GetLevelOfDifficulty(playerIndex) == 1 then



											--elseif Player_GetLevelOfDifficulty(playerIndex) == 2 then



											if Player_GetLevelOfDifficulty(playerIndex) == 3 then

Player_GrantResearchOption(playerIndex, PlayerRace_GetString(playerIndex, "dm_BCDN_research_grant", ""))


											elseif Player_GetLevelOfDifficulty(playerIndex) == 4 then

Player_GrantResearchOption(playerIndex, PlayerRace_GetString(playerIndex, "dm_rush_research_grant", ""))
Player_GrantResearchOption(playerIndex, PlayerRace_GetString(playerIndex, "dm_BCDN_research_grant", ""))
													
											end
										end

If the dialog doesn’t work, I bet you could set it in the pull-down menus of a skirmish. Take a look at the dual-command mod how he set up the menus.

2 Likes

Thanks! I’ll go through that in detail tonight and see what I can cobble together :grin:

What I have done in my mod is to allow the player to hire different types of scientists…research is dependent upon having a certain combination of each of the five types. Further, research branches based upon which of the fourteen mutually exclusive subsystems are constructed upon the Information Sub Station. Players are able to choose from a variety of focuses that then direct research along those specific paths.

2 Likes

I’ve not been having a lot of success and am leaning towards subsystems to manage this too… not quite done with trying to link it all together yet though :wink:

It must be possible, isn’t this exactly what the bentusi do in the campaign?

Subsystems sounds like the way to go. That way the player could change their mind later. And who knows what a pop-up dialogue is going to do in multi-player.

I think the idea of putting it in the game set-up options isn’t going to work either: I noticed that the ‘complete research’ game variant totally favors the Vaygr, and I couldn’t find the problem in the game files, so I think it’s just coded wrong in the game. So I wanted to get rid of that mode all together and set up the game options so that you can set a research bonus for each player individually (including all of it if you want), which turned out to be a pain in the rump roast, but I finally got it working right. The problem is, that it sets them according to the map slot, not the player number. So if you wanted to set a research path in those options, you would also need to have the player choose his slot before the game begins.

If someone knows how to differentiate between the slots and the players in the \lib luas you could totally set it up like that though. I’d also like to know :wink: …anybody?