Page 1 of 1

Changes in hunt script [Solved]

Posted: Sun Jun 15, 2008 5:04 pm
by elfie
Does anyone know how to change the timer and amount of kills needed for victory for the hunt script?

Re: changes in hunt script

Posted: Mon Jun 16, 2008 10:32 pm
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.

Re: changes in hunt script

Posted: Tue Jun 17, 2008 8:22 am
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

Re: changes in hunt script

Posted: Tue Jun 17, 2008 1:36 pm
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?

Re: changes in hunt script

Posted: Tue Jun 17, 2008 1:53 pm
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.