Problems with adding a custom game mode.

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Problems with adding a custom game mode.

Post by thelegend »

Hey all,
I have a little problem and I tried a lot to fix. I have added a custom game mode called "freemode". I made a new era to my map (works fine). Now I have added a custom mode. But its on in my game.

Here are my files:

LC1a_free.lua:
Hidden/Spoiler:
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("setup_teams")
ScriptCB_DoFile("ObjectiveTDM")


local ALL = 1
local IMP = 2
-- These variables do not change
local ATT = 1
local DEF = 2

function ScriptPostLoad()
EnableSPHeroRules()
-- This is the actual objective setup
TDM = ObjectiveTDM:New{teamATT = 1, teamDEF = 2,
multiplayerScoreLimit = 100,
textATT = "game.modes.tdm",
textDEF = "game.modes.tdm2", multiplayerRules = true, isCelebrityDeathmatch = true}
TDM:Start()

AddAIGoal(1, "Deathmatch", 100)
AddAIGoal(2, "Deathmatch", 100)
end





function ScriptInit()

ReadDataFile("ingame.lvl")



SetMaxFlyHeight(60)
SetMaxPlayerFlyHeight(60)


SetMemoryPoolSize ("ClothData",20)
SetMemoryPoolSize ("Combo",50) -- should be ~ 2x number of jedi classes
SetMemoryPoolSize ("Combo::State",650) -- should be ~12x #Combo
SetMemoryPoolSize ("Combo::Transition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Condition",650) -- should be a bit bigger than #Combo::State
SetMemoryPoolSize ("Combo::Attack",550) -- should be ~8-12x #Combo
SetMemoryPoolSize ("Combo::DamageSample",6000) -- should be ~8-12x #Combo::Attack
SetMemoryPoolSize ("Combo::Deflect",100) -- should be ~1x #combo


ReadDataFile("sound\\tat.lvl;tat2gcw")
ReadDataFile("dc:SIDE\\niko.lvl",
"niko_bellic")

ReadDataFile("dc:SIDE\\cop.lvl",
"cop_officer" )

ReadDataFile("dc:SIDE\\pas.lvl",
"pas_passant" )

ReadDataFile("SIDE\\imp.lvl",
"imp_inf_rifleman" )

SetupTeams{
all = {
team = ALL,
units = 0,
reinforcements = -1,
soldier = { "niko_bellic",0, 0},
assault = { "",0,0},
engineer = { "",0,0},
sniper = { "",0,0},
officer = { "",0,0},
special = { "",0,0},

},
imp = {
team = IMP,
units = 20,
reinforcements = -1,
soldier = { "imp_inf_rifleman",10, 20},
assault = { "",0,0},
engineer = { "",0,0},
sniper = { "i",0,0},
officer = { "",0,0},
special = { "",0,0},
},
}

SetTeamName (3, "passants")
AddUnitClass (3, "pas_passant", 100,120)
SetUnitCount (100, 120)
AddAIGoal(3, "Deathmatch", 100)
SetTeamAsFriend(ATT,3)
SetTeamAsFriend(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(3,DEF)



-- Level Stats
ClearWalkers()
AddWalkerType(0, 0) -- special -> droidekas
AddWalkerType(1, 0) -- 1x2 (1 pair of legs)
AddWalkerType(2, 0) -- 2x2 (2 pairs of legs)
AddWalkerType(3, 0) -- 3x2 (3 pairs of legs)

local weaponCnt = 1024
SetMemoryPoolSize("Aimer", 75)
SetMemoryPoolSize("AmmoCounter", weaponCnt)
SetMemoryPoolSize("BaseHint", 1024)
SetMemoryPoolSize("EnergyBar", weaponCnt)
SetMemoryPoolSize("EntityCloth", 32)
SetMemoryPoolSize("EntityFlyer", 32)
SetMemoryPoolSize("EntityHover", 32)
SetMemoryPoolSize("EntityLight", 200)
SetMemoryPoolSize("EntitySoundStream", 4)
SetMemoryPoolSize("EntitySoundStatic", 32)
SetMemoryPoolSize("MountedTurret", 32)
SetMemoryPoolSize("Navigator", 128)
SetMemoryPoolSize("Obstacle", 1024)
SetMemoryPoolSize("PathNode", 1024)
SetMemoryPoolSize("SoundSpaceRegion", 64)
SetMemoryPoolSize("TreeGridStack", 1024)
SetMemoryPoolSize("UnitAgent", 128)
SetMemoryPoolSize("UnitController", 128)
SetMemoryPoolSize("Weapon", weaponCnt)

SetSpawnDelay(10.0, 0.25)
ReadDataFile("dc:LC1\\LC1.lvl", "LC1_free")
SetDenseEnvironment("false")


-- Sound Stats



OpenAudioStream("sound\\global.lvl", "gcw_music")
OpenAudioStream("sound\\tat.lvl", "tat2")
OpenAudioStream("sound\\tat.lvl", "tat2")
-- OpenAudioStream("sound\\global.lvl", "global_vo_quick")
-- OpenAudioStream("sound\\global.lvl", "global_vo_slow")


SetAmbientMusic(ALL, 1.0, "all_tat_amb_start", 0,1)
SetAmbientMusic(ALL, 0.8, "all_tat_amb_middle", 1,1)
SetAmbientMusic(ALL, 0.2, "all_tat_amb_end", 2,1)
SetAmbientMusic(IMP, 1.0, "imp_tat_amb_start", 0,1)
SetAmbientMusic(IMP, 0.8, "imp_tat_amb_middle", 1,1)
SetAmbientMusic(IMP, 0.2, "imp_tat_amb_end", 2,1)

SetVictoryMusic(ALL, "all_tat_amb_victory")
SetDefeatMusic (ALL, "all_tat_amb_defeat")
SetVictoryMusic(IMP, "imp_tat_amb_victory")
SetDefeatMusic (IMP, "imp_tat_amb_defeat")

SetSoundEffect("ScopeDisplayZoomIn", "binocularzoomin")
SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
--SetSoundEffect("WeaponUnableSelect", "com_weap_inf_weaponchange_null")
--SetSoundEffect("WeaponModeUnableSelect", "com_weap_inf_modechange_null")
SetSoundEffect("SpawnDisplayUnitChange", "shell_select_unit")
SetSoundEffect("SpawnDisplayUnitAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
SetSoundEffect("SpawnDisplayBack", "shell_menu_exit")

-- Camera Stats
--Tat2 Mos Eisley
AddCameraShot(0.974338, -0.222180, 0.035172, 0.008020, -82.664650, 23.668301, 43.955681);

end
mission.req:
Hidden/Spoiler:
ucft
{
REQN
{
"config"
"ingame_movies"
}

REQN
{
"script"
"setup_teams"
"gametype_conquest"
"gametype_capture"
"Objective"
"MultiObjectiveContainer"
"ObjectiveCTF"
"ObjectiveAssault"
"ObjectiveSpaceAssault"
"ObjectiveConquest"
"ObjectiveTDM"
"ObjectiveOneFlagCTF"
"SoundEvent_ctf"
"ObjectiveGoto"
"LinkedShields"
"LinkedDestroyables"
"LinkedTurrets"
"Ambush"
"PlayMovieWithTransition"
}

REQN
{
"lvl"
"LC1g_con"
"LC1c_con"
"LC1a_con"
"LC1a_free"
}
}
LC1a_free.req:
Hidden/Spoiler:
ucft
{
REQN
{
"script"
"LC1a_free"
}
}
addme.lua:
Hidden/Spoiler:
--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
-- recursively merges the second given table into the first given table
function MergeTables( mission, newFlags )
--for each table entry,
local array = type({})
for key,value in pairs(newFlags) do
--check for nested tables
if type(value) == array then
--mission must have this key as a table too
if type(mission[key]) ~= array then
mission[key] = {}
end
--merge these two tables recursively
MergeTables(mission[key], value)
else
--the key is a simple variable, so simply store it
mission[key] = value
end
end
end

--Search through the missionlist to find a map that matches mapName,
--then insert the new flags into said entry.
--Use this when you know the map already exists, but this content patch is just
--adding new gamemodes (otherwise you should just add whole new entries to the missionlist)
function AddNewGameModes(missionList, mapName, newFlags)
for i, mission in missionList do
if mission.mapluafile == mapName then
MergeTables(mission, newFlags)
end
end
end

--insert totally new maps here:
local sp_n = 0
local mp_n = 0
sp_n = table.getn(sp_missionselect_listbox_contents)

sp_missionselect_listbox_contents[sp_n+1] = { red = 255, blue = 255, green = 255, isModLevel = 1, mapluafile = "LC1%s_%s", era_a = 1, mode_con_a = 1, mode_free_a = 1, change = { era_a ={ name="Grand Theft Auto IV", icon2="4" }}}
mp_n = table.getn(mp_missionselect_listbox_contents)
mp_missionselect_listbox_contents[mp_n+1] = sp_missionselect_listbox_contents[sp_n+1]

-- associate this mission name with the current downloadable content directory
-- (this tells the engine which maps are downloaded, so you need to include all new mission lua's here)
-- first arg: mapluafile from above
-- second arg: mission script name
-- third arg: level memory modifier. the arg to LuaScript.cpp: DEFAULT_MODEL_MEMORY_PLUS(x)

AddDownloadableContent("LC1","LC1a_con",4)
AddDownloadableContent("LC1","LC1a_free",4)
-- all done
newEntry = nil
n = nil

-- Now load our core.lvl into the shell to add our localize keys
ReadDataFile("..\\..\\addon\\LC1\\data\\_LVL_PC\\core.lvl")
ReadDataFile("..\\..\\addon\\LC1\\data\\_LVL_PC\\logo.lvl")
It is possible to name your new gamemode "free" or only hunt, con, xl, eli...?
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: Problems with adding a custom game mode.

Post by razac920 »

I assume you have the v1.3 patch, right? You need that. In Star Wars Battlefront II\GameData\addon\AAA-v1.3patch\docs you should see a text file called changelog - shell.lvl.txt, which tells you what game modes and eras are supported:
Hidden/Spoiler:
Added support for game mode: tdm
Added support for game mode: xl
Added support for game mode: obj
Added support for game mode: uber
Added support for game mode: bf1
Added support for game mode: holo
Added support for game mode: ord66
Added support for game mode: dm
Added support for game mode: space
Added support for game mode: c1
Added support for game mode: c2
Added support for game mode: c3
Added support for game mode: c4
Added support for game mode: hctf
Added support for game mode: vhcon
Added support for game mode: vhtdm
Added support for game mode: vhctf
Added support for game mode: avh
Added support for game mode: lms
Added support for game mode: vh
Added support for game mode: race
Added support for game mode: koh
Added support for game mode: tdf
Added support for game mode: surv
Added support for game mode: rpg
Added support for game mode: wav
Added support for game mode: ctrl
Added support for game mode: seige
Added support for game mode: siege
Added support for game mode: jhu
Added support for game mode: wea
Added support for game mode: ins
Added support for era: a
Added support for era: b
Added support for era: d
Added support for era: e
Added support for era: f
Added support for era: h
Added support for era: i
Added support for era: j
Added support for era: k
Added support for era: l
Added support for era: m
Added support for era: n
Added support for era: o
Added support for era: p
Added support for era: q
Added support for era: r
Added support for era: s
Added support for era: t
Added support for era: u
Added support for era: v
Added support for era: w
Added support for era: x
Added support for era: y
Added support for era: z
Added support for era: 1
Added support for era: 2
thelegend
Sith
Sith
Posts: 1433
Joined: Thu Jan 23, 2014 6:01 am
Projects :: Star Wars - Battlefront III Legacy
Games I'm Playing :: Swbf GTA CoD LoL KH
xbox live or psn: El_Fabricio#
Location: Right behind you :)

Re: Problems with adding a custom game mode.

Post by thelegend »

Ah ok. Thank you. I have fixed that then I have used the hunt mode as base mode. Thank you.
Post Reply