Changes in hunt script [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
elfie
Field Commander
Field Commander
Posts: 931
Joined: Fri Jan 25, 2008 8:26 pm
Games I'm Playing :: no games
xbox live or psn: no live
Location: Coruscant, Jedi Temple
Contact:

Changes in hunt script [Solved]

Post by elfie »

Does anyone know how to change the timer and amount of kills needed for victory for the hunt script?
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: changes in hunt script

Post by [RDH]Zerted »

in data_XXX/Common/scripts/ObjectiveTDM.lua

Line 27: Change the return statement to return your time limit
Line 110: Change scorelimit to the score limit you want, then you can delete lines 103 through 108

Save and munge your map.
User avatar
elfie
Field Commander
Field Commander
Posts: 931
Joined: Fri Jan 25, 2008 8:26 pm
Games I'm Playing :: no games
xbox live or psn: no live
Location: Coruscant, Jedi Temple
Contact:

Re: changes in hunt script

Post by elfie »

I did what you said, Zerted, but it didn't work. It crashed actually.
Hidden/Spoiler:
C:\BF2\ToolsFL\Bin\luac.exe: cannot read ..\..\common\scripts\Copy: No such file or directory
ERROR[scriptmunge scripts\Copy of ObjectiveTDM.lua]:Could not read input file.ERROR[scriptmunge scripts\Copy of ObjectiveTDM.lua]:Could not read input file. [continuing]
C:\BF2\ToolsFL\Bin\luac.exe: ..\..\common\scripts\ObjectiveTDM.lua:27: `end' expected (to close `if' at line 24) near `ScriptCB_GetHuntMaxTimeLimit'
ERROR[scriptmunge scripts\ObjectiveTDM.lua]:Could not read input file.ERROR[scriptmunge scripts\ObjectiveTDM.lua]:Could not read input file. [continuing]
4 Errors 0 Warnings
Hidden/Spoiler:
--
-- 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,

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 15 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 return end --no points for killing guys on your team

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

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

end
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: changes in hunt script

Post by Maveritchell »

elfie wrote:I did what you said, Zerted, but it didn't work. It crashed actually.
Only because you didn't technically do what he said. On line 27 you should be replacing

Code: Select all

return ScriptCB_GetHuntMaxTimeLimit()
with

Code: Select all

return 15
. You shouldn't be just adding the time before the ScriptCB.

Also, are you entirely sure you want your hunt mode to be fifteen seconds long?
User avatar
elfie
Field Commander
Field Commander
Posts: 931
Joined: Fri Jan 25, 2008 8:26 pm
Games I'm Playing :: no games
xbox live or psn: no live
Location: Coruscant, Jedi Temple
Contact:

Re: changes in hunt script

Post by elfie »

oh it is in seconds? I thought that meant minutes!
And thanks for pointing that out, Mav about the changing that line thing it worked.
Post Reply