Page 1 of 1

Multiple Galactic Conquest .lvl files

Posted: Thu Sep 10, 2020 7:57 pm
by FiftyAuto
So I have been working on an Era mod and I wanted to include Galactic Conquest. so I read Firefang's tutorial on creating your own galactic conquest with success! However, I ran into the problem when making galactic conquest campains.

See to make a multiple galactic conquest campains you need to have each shell file represent a galactic conquest campain. This is because when you munge the shell.lvl you need to rename it to your galactic conquest for example my republic campagin is "custom_gc_9" then I drag this to my Battlefront 2 _lvl_pc folder, However I want to make a CIS campain as well so I need to rename my "shell" folder to "shell rep" and rename my "shell cis" to "shell" that way it reads my (cis) shell instead and i can rename that to "custom_gc_8" that way I can have both "custom_gc_8" and "custom_gc_9". however when I do this my campaign list shows both campaigns but only the button for my republic campaign functions properly. however when I remove either the "custom_gc_8" or the "custom_gc_9" both the republic and cis campaigns works fine.

"custom_gc_8" Cis Campaign

Code: Select all

print("custom_gc_8: Entered")

local gcTag = "Separatist Alliance"

local gcString = "Age of Republic: Separatist Alliance"

ScriptCB_DoFile("ifs_freeform_init_precis")
ScriptCB_DoFile("ifs_freeform_start_precis")

local start_gc = ifs_freeform_start_precis

ReadDataFile("..\\..\\addon\\zte\\core.lvl")

-------------------------------------------------------------------------------
-- The end of the 7 step section
-------------------------------------------------------------------------------

--add a button to the shell for our custom Galactic Conquest
if custom_GetGCButtonList then
	print("custom_gc_8: Taking control of custom_GetGCButtonList()...")
	
	--check for possible loading errors
	if precis_custom_GetGCButtonList then
		print("custom_gc_8: Warning: Someone else is using our precis_custom_GetGCButtonList variable!")
		print("custom_gc_8: Exited")
		return
	end
	
	--backup the current custom_GetGCButtonList function
	precis_custom_GetGCButtonList = custom_GetGCButtonList

	--this is our new custom_GetGCButtonList function
	custom_GetGCButtonList = function()
	    print("custom_gc_8: custom_GetGCButtonList(): Entered")
	    
	    --get the button table from the real function
	    local list = precis_custom_GetGCButtonList()
	    
	    --add in the button for our Galactic Conqust
	    local ourButton = { tag = gcTag, string = gcString, }
		table.insert( list, 1, ourButton )	    
	    
	    print("custom_gc_8: custom_GetGCButtonList(): Exited")
	    return list
	end
else
	print("custom_gc_8: Warning: No custom_GetGCButtonList() to take over")
	print("custom_gc_8: Exited")
	return
end

--Note: if you want your Galactic Conquest to only be visible at certain times (like when some other GC is completed), you will need to take over the ifs_sp_campaign_fnUpdateButtonVis() and/or ifs_sp_gc_fnUpdateButtonVis() functions (like you did with custom_GetGCButtonList()).  Both of these functions can be found in Common\scripts\PC\ifs_sp_campaign.lua

--listen for when our Galactic Conquest button is clicked
if custom_PressedGCButton then
	print("custom_gc_8: Taking control of custom_PressedGCButton()...")
	
	--check for possible loading errors
	if precis_custom_PressedGCButton then
		print("custom_gc_8: Warning: Someone else is using our precis_custom_PressedGCButton variable!")
		print("custom_gc_8: Exited")
		return
	end
	
	--backup the current custom_GetGCButtonList function
	precis_custom_PressedGCButton = custom_PressedGCButton

	--this is our new custom_GetGCButtonList function
	custom_PressedGCButton = function( tag )
	    print("custom_gc_8: custom_PressedGCButton(): Entered")
	    
	    --not our conquest, so let the game process it normally
	    if tag ~= gcTag then
		    return precis_custom_PressedGCButton()
	    end
	    
	    --it is our Galactic Conquest button, so get our game going
	    start_gc(ifs_freeform_main)
	    
	    print("custom_gc_8: custom_PressedGCButton(): Exited")
	    return true
	end
else
	print("custom_gc_8: Warning: No custom_PressedGCButton() to take over")
	print("custom_gc_8: Exited")
	return
end

print("custom_gc_8: Exited")

"custom_gc_9" Republic Campaign

Code: Select all

print("custom_gc_9: Entered")

local gcTag = "Galactic Republic"

local gcString = "Age of Republic: Galactic Republic"

ScriptCB_DoFile("ifs_freeform_init_prerep")
ScriptCB_DoFile("ifs_freeform_start_prerep")

local start_gc = ifs_freeform_start_prerep

ReadDataFile("..\\..\\addon\\zte\\core.lvl")

-------------------------------------------------------------------------------
-- The end of the 7 step section
-------------------------------------------------------------------------------

--add a button to the shell for our custom Galactic Conquest
if custom_GetGCButtonList then
	print("custom_gc_9: Taking control of custom_GetGCButtonList()...")
	
	--check for possible loading errors
	if prerep_custom_GetGCButtonList then
		print("custom_gc_9: Warning: Someone else is using our prerep_custom_GetGCButtonList variable!")
		print("custom_gc_9: Exited")
		return
	end
	
	--backup the current custom_GetGCButtonList function
	prerep_custom_GetGCButtonList = custom_GetGCButtonList

	--this is our new custom_GetGCButtonList function
	custom_GetGCButtonList = function()
	    print("custom_gc_9: custom_GetGCButtonList(): Entered")
	    
	    --get the button table from the real function
	    local list = prerep_custom_GetGCButtonList()
	    
	    --add in the button for our Galactic Conqust
	    local ourButton = { tag = gcTag, string = gcString, }
		table.insert( list, 1, ourButton )	    
	    
	    print("custom_gc_9: custom_GetGCButtonList(): Exited")
	    return list
	end
else
	print("custom_gc_9: Warning: No custom_GetGCButtonList() to take over")
	print("custom_gc_9: Exited")
	return
end

--Note: if you want your Galactic Conquest to only be visible at certain times (like when some other GC is completed), you will need to take over the ifs_sp_campaign_fnUpdateButtonVis() and/or ifs_sp_gc_fnUpdateButtonVis() functions (like you did with custom_GetGCButtonList()).  Both of these functions can be found in Common\scripts\PC\ifs_sp_campaign.lua

--listen for when our Galactic Conquest button is clicked
if custom_PressedGCButton then
	print("custom_gc_9: Taking control of custom_PressedGCButton()...")
	
	--check for possible loading errors
	if prerep_custom_PressedGCButton then
		print("custom_gc_9: Warning: Someone else is using our zte1_custom_PressedGCButton variable!")
		print("custom_gc_9: Exited")
		return
	end
	
	--backup the current custom_GetGCButtonList function
	prerep_custom_PressedGCButton = custom_PressedGCButton

	--this is our new custom_GetGCButtonList function
	custom_PressedGCButton = function( tag )
	    print("custom_gc_9: custom_PressedGCButton(): Entered")
	    
	    --not our conquest, so let the game process it normally
	    if tag ~= gcTag then
		    return prerep_custom_PressedGCButton()
	    end
	    
	    --it is our Galactic Conquest button, so get our game going
	    start_gc(ifs_freeform_main)
	    
	    print("custom_gc_9: custom_PressedGCButton(): Exited")
	    return true
	end
else
	print("custom_gc_9: Warning: No custom_PressedGCButton() to take over")
	print("custom_gc_9: Exited")
	return
end

print("custom_gc_9: Exited")
If anyone could explain how to solve this situation that would be much appriciated.

Re: Multiple Galactic Conquest .lvl files

Posted: Wed Sep 16, 2020 12:41 pm
by Anakin
There is a bug in the example code from uop 1.3. This causes that only the latest gc script is used. You're gonna break other GC's such as RC or DT with your scripts, too.

First of all i recommend to make yourself familiar with the munge process. The custom lvl maker tool (assets link thread) can help you a lot to munge your lvl's without the shell munge/rename crap.

Next i recommend to have a look at the remastered documentation, that comes with another MUCH easier and saver way to insert your custom campaign into the gui

but if you still wanna use the uop variant and you cannot figure out the bug, i can have another look at your script. I fixed it for my rc gc years ago. But after i switched to remastered, i may have delete the old gc files. So probably i don't have the fix. But i'm about 80% sure that i wrote a bug fix somewhere in my documentation or here on GT.

Re: Multiple Galactic Conquest .lvl files

Posted: Fri Sep 25, 2020 12:04 pm
by FiftyAuto
Hello thanks a ton! so I downloaded the custom lvl maker tool and it makes munging these files alot easier! I tested it on my current cis galactic conquest: custom_gc_6 (which was custom_gc_8) and it worked perfectly! However, when I looked through the Remaster v1.5 documentation I copied the example code and pasted it into the CustomLVL file in my Data_%%% folder. I made a new .req.customlvl file and named it "RTP_interface_script.req.customlvl" I munged it and it successfully made it into my directory. However, I couldn't find the Galactic conquest button anywhere. I'll send you the code in case I did something wrong. Thanks a ton you have been a tremendous help thanks for being patient with me.

RTP_interface_script.req.customlvl

Code: Select all

D:\Program Files (x86)\Steam\steamapps\common\Star Wars Battlefront II\GameData\DATA\_LVL_PC\RTP_interface_script.lvl
RTP_interface_script.req

Code: Select all

ucft
{
	REQN
	{
		"script"
		"RTP_interface_script"
		"ifs_freeform_init_cgc"
		"ifs_freeform_start_cgc"
	}
}
Scripts Folder

RTP_interface_script

Code: Select all

-- STAR WARS BATTLEFRONT II - REMASTER
-- Developer Documentation by Anakin

-- load all scripts needed for your custom gc match here
ScriptCB_DoFile("ifs_freeform_init_cgc")
ScriptCB_DoFile("ifs_freeform_start_cgc")

-- some variables needed by the register function
local gcButtonTag = "cgcButton"				-- the button tag needs to be unique
local gcButtonString = "CGC Tutorial"		-- the name can be localized or hardcoded
local start_gc = ifs_freeform_start_cgc		-- This is the function that starts the gc match.

-- register the button
swbf2Remaster_registerCGCButton(gcButtonTag, gcButtonString, start_gc )
ifs_freeform_init_cgc.lua

Code: Select all

-- STAR WARS BATTLEFRONT II - REMASTER
-- Developer Documentation by Anakin

ifs_freeform_init_cgc = function (this, ALL, IMP)
	
	-- common init
	ifs_freeform_init_common(this)

	-- default victory condition (take all planets)
	this:SetVictoryPlanetLimit(nil)
	
	-- associate codes with teams
	this.teamCode = {
		[ALL] = "all",
		[IMP] = "imp"
	}
	
	-- use adjusted setup
	this.Setup = function(this)
	
		-- remove unused planets
		DeleteEntity("geo")
		DeleteEntity("kam")
		DeleteEntity("kam_system")
		DeleteEntity("geo_system")
		DeleteEntity("end_star")
		DeleteEntity("hot_star")
		DeleteEntity("tantive")
		--DeleteEntity("cor")
		DeleteEntity("dag")
		DeleteEntity("end")
		DeleteEntity("fel")
		DeleteEntity("hot")
		DeleteEntity("kas")
		--DeleteEntity("mus")
		DeleteEntity("myg")
		--DeleteEntity("nab")
		DeleteEntity("pol")
		DeleteEntity("tat")
		DeleteEntity("uta")
		DeleteEntity("yav")
		DeleteEntity("star02")
		DeleteEntity("star03")
		DeleteEntity("star04")
		DeleteEntity("star05")
		DeleteEntity("star06")
		DeleteEntity("star07")
		DeleteEntity("star10")
		DeleteEntity("star12")
		DeleteEntity("star13")
		DeleteEntity("star14")
		DeleteEntity("star15")
		DeleteEntity("star17")
		DeleteEntity("star18")
		DeleteEntity("star20")
		
		-- create the connectivity graph
		this.planetDestination = {
			["cor"] = { "mus", "nab" },
			["mus"] = { "cor", "nab" },
			["nab"] = { "cor", "mus" },

		}

		-- resource value for each planet
		this.planetValue = {
			["cor"] = { victory = 200, defeat = 50, turn = 3 },
			["mus"] = { victory = 20, defeat = 80, turn = 5 },
			["nab"] = { victory = 200, defeat = 50, turn = 3 },
		}
		
		this.spaceValue = {
			victory = 30, defeat = 10,
		}
		
		-- mission to launch for each planet
		this.spaceMission = {
			["con"] = { "spa1g_Diet Dr. Pepper", "spa8g_Diet Dr. Pepper", "spa9g_Diet Dr. Pepper" }
		}
		this.planetMission = {
			["cor"] = {
				["con"] = "cor1g_con",
				["ctf"] = "cor1g_ctf",
			},
			["mus"] = {
				["con"] = "mus1g_con",
				["ctf"] = "mus1g_ctf",
			},
			["nab"] = {
				["con"] = "nab2g_con",
				["ctf"] = "nab2g_ctf",
			},
		}
		
		-- associate names with teams
		this.teamName = {
			[0] = "",
			[ALL] = "common.sides.all.name",
			[IMP] = "common.sides.imp.name"
		}
		
		-- associate names with team bases
		this.baseName = {
			[ALL] = "ifs.freeform.base.all",
			[IMP] = "ifs.freeform.base.imp"
		}
		
		-- associate names with team fleets
		this.fleetName = {
			[0] = "",
			[ALL] = "ifs.freeform.fleet.all",
			[IMP] = "ifs.freeform.fleet.imp"
		}
		
		-- associate entity class with team fleets
		this.fleetClass = {
			[ALL] = "gal_prp_moncalamaricruiser",
			[IMP] = "gal_prp_stardestroyer"
		}
		
		-- associate icon textures with team fleets
		this.fleetIcon = {
			[ALL] = "all_fleet_normal_icon",
			[IMP] = "imp_fleet_normal_icon"
		}
		this.fleetStroke = {
			[ALL] = "all_fleet_normal_stroke",
			[IMP] = "imp_fleet_normal_stroke"
		}
		
		-- set the explosion effect for each team
		this.fleetExplosion = {
			[ALL] = "gal_sfx_moncalamaricruiser_exp",
			[IMP] = "gal_sfx_stardestroyer_exp"
		}
		
		-- team base planets
		this.planetBase = {
			[ALL] = "cor",
			[IMP] = "nab"
		}
		
		-- team potential starting locations
		this.planetStart = {
			[ALL] = { "cor" },
			[IMP] = { "nab" }
		}
	end

end
ifs_freeform_start_cgc

Code: Select all

-- STAR WARS BATTLEFRONT II - REMASTER
-- Developer Documentation by Anakin

function ifs_freeform_start_cgc(this)

	-- save scenario type
	this.scenario = "cgc"
	
	-- assigned teams
	local ALL = 1
	local IMP = 2
	
	-- init our custom defined gc match
	ifs_freeform_init_cgc(this, ALL, IMP)

	-- set to versus play
	ifs_freeform_controllers(this, { [0] = ALL, [1] = ALL, [2] = ALL, [3] = ALL })

	-- ALL start
	this.Start = function(this)
		-- perform common start
		ifs_freeform_start_common(this)

	   	-- set team for each planet
   		this.planetTeam = {
			["cor"] = ALL,
			["mus"] = IMP,
			["nab"] = IMP,
		}
		
		-- create starting fleets for each team
		this.planetFleet = {}
		for team, start in pairs(this.planetStart) do
			local planet = start[math.random(table.getn(start))]
			this.planetFleet[planet] = team
		end
	end
end


Re: Multiple Galactic Conquest .lvl files

Posted: Fri Sep 25, 2020 2:11 pm
by FiftyAuto
Nevermind I figured it out Thanks a ton! :)

Re: Multiple Galactic Conquest .lvl files

Posted: Sat Sep 26, 2020 3:30 am
by Anakin
I think you missed the install process :D

btw. there is no need you use RTP (Remastered Tutorial Project) as 3 letter id ;)

To add a 2nd gc, just duplicate the code from RTP_interface_script and change the ids/names

Re: Multiple Galactic Conquest .lvl files

Posted: Sun Sep 27, 2020 10:50 pm
by FiftyAuto
Thanks a ton! seriously if I may be so bold as to ask you another question, I noticed you were able to change the meshs in galactic conquest for your remastered mod. Is there also a tutorial on how to do this? I want to make my own planet meshes but mostly I want the "%%%_camera" to actually be invisible as well as the "%%%_fleet" to be invisible as well(instead of the base yavin 4 planet mesh). again if you dont know a tutorial or have any advice on how to do that thats fine you have done more than enough thanks! :)

Re: Multiple Galactic Conquest .lvl files

Posted: Wed Sep 30, 2020 3:26 am
by Anakin
Well there is not a specific tutorial for that, but take a look at this HUD tutorial: http://www.gametoast.com/viewtopic.php?f=27&t=29836
It's pretty much the same way. All you want to do is remove a mesh. And it doesn't matter whether it is on the HUD, the GC or ingame. Everything goes exactly the same way

Re: Multiple Galactic Conquest .lvl files

Posted: Tue Oct 06, 2020 6:56 pm
by FiftyAuto
Thanks for guiding me in the right direction. I'm not the best at scripting so I'm having trouble finding what lua I can call for my ReadDataFile("dc:ingame.lvl") since the Galactic Conquest doesnt function like a normal map, but I'm sure I'll figure something out.

Re: Multiple Galactic Conquest .lvl files

Posted: Thu Oct 15, 2020 6:21 am
by Anakin
The galactic conquest mesh and tga things are located in GameData\data\_lvl_pc\gal\gal1.lvl