How to adjust TDM limit [solved]

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
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

How to adjust TDM limit [solved]

Post by Anakin »

Hi,

i just wanted to know how to adjust the TDM limit. At the moment it's somthing about 180. I want it to be something about 50.
It wouldn't be a problem for me to hardcode it. But i want to be still able to adjust the limit with the games settings. Can someone tell me how to do it??
I changed the victory condition to this:

Code: Select all

local scorelimit = ScriptCB_GetHuntScoreLimit()
if ( self.isCelebrityDeathmatch ) then
	scorelimit = ScriptCB_GetAssaultScoreLimit() - 130
elseif ( self.isUberMode ) then
	scorelimit = ScriptCB_GetUberScoreLimit()
end
It works, but it shows the wrong limit. So i wanted to do something like that too, but it won't work, because the function does not get the limit, but an 2.
Hidden/Spoiler:
[code]
--
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

ScriptCB_DoFile("Objective")

--=============================
-- ObjectiveTDM
-- Handles the logic for a team deathmatch game
-- Aaaactually, this has morphed into the Hunt gametype (at the last minute, hence the lack of name-change), but only in multiplayer/instant-action mode
--=============================
ObjectiveTDM = Objective:New
{
-- external values
pointsPerKillATT = 1,
pointsPerKillDEF = 1,
pointsPerTeamKill = -1,

isCelebrityDeathmatch = false, -- exactly what it sounds like.
isUberMode = false, -- ditto
uberScoreLimit = 400, -- score limit for, get this, uber mode
}

function ObjectiveTDM:GetGameTimeLimit()
if ( self.isCelebrityDeathmatch or self.isUberMode) then
return 0
else
return ScriptCB_GetHuntMaxTimeLimit()
end
end

function ObjectiveTDM:GameOptionsTimeLimitUp()
local team1pts = GetTeamPoints(1)
local team2pts = GetTeamPoints(2)
if ( team1pts > team2pts ) then
MissionVictory(1)
elseif ( team1pts < team2pts ) then
MissionVictory(2)
else
--tied, so victory for both
MissionVictory({1,2})
end
end

function ObjectiveTDM:Start()
if ( self.isCelebrityDeathmatch == true ) then
ScriptCB_SetNumBots(ScriptCB_GetASSNumBots())
end

--===============================
-- Initialization logic
--===============================
--initialize the base objective data first
Objective.Start(self)

if self.multiplayerRules then
ShowTeamPoints(self.teamATT, true)
ShowTeamPoints(self.teamDEF, true)

SetReinforcementCount(self.teamATT, -1)
SetReinforcementCount(self.teamDEF, -1)

SetTeamPoints(self.teamATT, 0)
SetTeamPoints(self.teamDEF, 0)
if ( self.isCelebrityDeathmatch ) then
ScriptCB_ShowHuntScoreLimit(2)
elseif ( self.isUberMode ) then
ScriptCB_ShowHuntScoreLimit(3)
ScriptCB_SetUberScoreLimit(self.uberScoreLimit)
else
ScriptCB_ShowHuntScoreLimit(1)
end
end


--set AI goals
self.AIGoals = {}
if self.AIGoalWeight > 0.0 then
table.insert(self.AIGoals, AddAIGoal(self.teamATT, "Deathmatch", 100*self.AIGoalWeight))
table.insert(self.AIGoals, AddAIGoal(self.teamDEF, "Deathmatch", 100*self.AIGoalWeight))
end

--=======================================
-- Event responses
--=======================================

--when used in multiplayer, TDM will count points upwards until a score limit is reached
if self.multiplayerRules then
local eventResponseCharacterDeath = OnCharacterDeath(
function(character, killer)
if not killer then return end --no points for suicides

local victimTeam = GetCharacterTeam(character)
local killerTeam = GetCharacterTeam(killer)

if victimTeam == killerTeam then
AddTeamPoints(killerTeam, self.pointsPerTeamKill)
return -- negative points for killing guys on your team
end

if killerTeam == self.teamATT then
AddTeamPoints(killerTeam, self.pointsPerKillATT)
elseif killerTeam == self.teamDEF then
AddTeamPoints(killerTeam, self.pointsPerKillDEF)
end

local scorelimit = ScriptCB_GetHuntScoreLimit()
if ( self.isCelebrityDeathmatch ) then
scorelimit = ScriptCB_GetAssaultScoreLimit()
elseif ( self.isUberMode ) then
scorelimit = ScriptCB_GetUberScoreLimit()
end

if GetTeamPoints(killerTeam) >= scorelimit then
self:Complete(killerTeam)
ReleaseCharacterDeath(eventResponseCharacterDeath)
end
end
)
end

end
[/code]
Last edited by Anakin on Mon Mar 02, 2015 1:07 pm, edited 1 time in total.
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: How to adjust TDM limit

Post by razac920 »

As you can see in the ObjectiveTDM, Ubermode is much easier to set. So make your ObjectiveTDM variable isUberMode = true, and set uberScoreLimit = [whatever you want]
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: How to adjust TDM limit

Post by Anakin »

actually i don't wanted to change all scripts again. And if i make an ubermode you can not adjust the limit with the assault limit in the settings. So i'd prefere an offset solution.
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: How to adjust TDM limit

Post by razac920 »

You can have the ubermode score limit depend on the assault limit in the settings. Let me just understand what it is that you want. You have many different map/game mode scripts that you don't want to modify? And so you just want to modify the ObjectiveTDM file directly? And what score limit do you want to display? (GetAssaultScoreLimit - 130)? --> This would range from 20 to 170 (a BIG range), with a default of 50. How about (GetAssaultScoreLimit)/3 instead? That would range from 50 to 100, with a default of 60?
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: How to adjust TDM limit

Post by Anakin »

/3 would be fine, too. Not sure if 60 for default is maybe a bit too much. But you understood everything right.
razac920
2nd Lieutenant
2nd Lieutenant
Posts: 365
Joined: Sun Jan 16, 2011 12:42 am

Re: How to adjust TDM limit

Post by razac920 »

Okay, cool. Based on your first coding attempt, I'm assuming that in all of your scripts, your objective has isCelebrityDeathmatch = true.

In this case, just start with the default ObjectiveTDM and change

Code: Select all

      if ( self.isCelebrityDeathmatch ) then
         ScriptCB_ShowHuntScoreLimit(2)
      elseif ( self.isUberMode ) then
         ScriptCB_ShowHuntScoreLimit(3)
         ScriptCB_SetUberScoreLimit(self.uberScoreLimit)
      else
         ScriptCB_ShowHuntScoreLimit(1)
      end
   end
to

Code: Select all

      if ( self.isCelebrityDeathmatch ) then
         ScriptCB_ShowHuntScoreLimit(3)
         ScriptCB_SetUberScoreLimit([your formula here, e.g. ScriptCB_GetAssaultScoreLimit()/3])
      elseif ( self.isUberMode ) then
         ScriptCB_ShowHuntScoreLimit(3)
         ScriptCB_SetUberScoreLimit(self.uberScoreLimit)
      else
         ScriptCB_ShowHuntScoreLimit(1)
      end
   end
and

Code: Select all

            local scorelimit = ScriptCB_GetHuntScoreLimit()
            if ( self.isCelebrityDeathmatch ) then
               scorelimit = ScriptCB_GetAssaultScoreLimit()
            elseif ( self.isUberMode ) then
               scorelimit = ScriptCB_GetUberScoreLimit()
            end
to

Code: Select all

            local scorelimit = ScriptCB_GetHuntScoreLimit()
            if ( self.isCelebrityDeathmatch ) then
               scorelimit = ScriptCB_GetUberScoreLimit()
            elseif ( self.isUberMode ) then
               scorelimit = ScriptCB_GetUberScoreLimit()
            end
User avatar
AnthonyBF2
Sith
Sith
Posts: 1255
Joined: Wed Aug 21, 2013 3:55 pm
Projects :: PS2+PSP Overhaul

Re: How to adjust TDM limit

Post by AnthonyBF2 »

I was messing around with a custom shell.lvl recently and found the part of code where you can make the game options higher or lower, hero timer, conquest reinforcements, etc.

Sadly, it involves making a new shell, which will replace the shell.lvl (if you have 1.3 patch, probably not smart to replace it. :| )

How ever making it is simple.
Copy Shell folder from assets and past it in data_abc
Then in data_abc\shell\scripts edit ifs_instant_options.lua

Scroll down shortly to this
Hidden/Spoiler:
local HEROPoints = {low = 1, high = 50, increment = 1, default = 10}
local HEROTimer = {low = 0, high = 120, increment = 5, default = 60}
-- mult = reinforcements
local CONMult = {low = 10, high = 500, increment = 10} -- inc 10
local CONTimer = {low = 0, high = 60, increment = 5} -- off, then 5 to 60
local CTFScore = {low = 1, high = 15, increment = 1}
local CTFTimer = {low = 0, high = 60, increment = 5} -- off, then 5 to 60
--local ELIMult = {low = 50, high = 300}
--local ELITimer = {low = 0, high = 300}
local HUNScore = {low = 50, high = 150, increment = 5} -- inc 5
local HUNTimer = {low = 0, high = 60, increment = 5} -- off, then 5 to 60
local ASSScore = {low = 150, high = 300, increment = 5} -- inc 5
As long as you can understand English, you should be able to understand what does what.
Increment determines how many times the score will multiply when you adjust the ingame slider.
If increment is 1, you will change the score 1,2,3,4,5,6,7,8,9
If increment is 10 you will adjust score 10,20,30,40,50 etc.

When you munge, select Shell. Replace shell.lvl in your main game's _lvl_pc with your new one.

I tried very hard to hex edit different things to the existing shell.lvl but every time I changed something, it broke the game options (could not click those buttons)
For now, we're stuck with replacing the file.
User avatar
Anakin
Master of the Force
Master of the Force
Posts: 4817
Joined: Sat Sep 19, 2009 11:37 am
Projects :: RC Side Mod - Remastered - SWBF3 Legacy
Location: Mos Espa (germany)

Re: How to adjust TDM limit

Post by Anakin »

No you could make a wrapper ;)
Maybe with an custom script, or you do it the way i did with the background images. Only overwrite the custom parts. It should also work to just add the option you like. But for more infos about it you should contact Zerted. He is an expert in these things

But i'm sure razac920's idea will do.


==EDIT==

@razac920: worked.
Post Reply