Adding a timer to a map

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
jedimaster745
First Lance Corporal
First Lance Corporal
Posts: 136
Joined: Sun Sep 07, 2008 5:05 pm

Adding a timer to a map

Post by jedimaster745 »

how to i add an automatic timer to conquest mode for my map? if its possible, please tell me. thanks
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: Adding a timer to a map

Post by [RDH]Zerted »

A timer to do what? The scripting guide documentation has info on timers.
User avatar
jedimaster745
First Lance Corporal
First Lance Corporal
Posts: 136
Joined: Sun Sep 07, 2008 5:05 pm

Re: Adding a timer to a map

Post by jedimaster745 »

a timer as in like, a countdown until the next map starts. like in hunt where you can choose how long you want the played map to last until the next map starts.
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: Adding a timer to a map

Post by elfie »

jedimaster745 wrote:a timer as in like, a countdown until the next map starts. like in hunt where you can choose how long you want the played map to last until the next map starts.
I put a timer in one of my maps. I don't know what you mean by a countdown though. If you mean timer like the timer tells you how much time is left in the map then that is done through the lua. I did it to my map, so I know it is possible. There is a topic on it in this forum so use the search function.

EDIT: I found it. It was in the ObjectiveTDM.lua I think. Here it is if you want to look at it:
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 960
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) >= 250 then
self:Complete(killerTeam)
ReleaseCharacterDeath(eventResponseCharacterDeath)
end
end
)
end

end
Post Reply