Remove the hunt timer

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
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Remove the hunt timer

Post by General_Nate »

Ok, I want to have a timer for my hunt mode, but I don't want it to be the hunt timer. (Woah, that sounded weird.) Like, I want my own timer, and not the one that is there by default, the one which you can change in the map select screen.

Here is my script:
Hidden/Spoiler:
function ScriptPostLoad()

timeoutTimer = CreateTimer("timeout")
SetTimerValue(timeoutTimer, 600)
ShowTimer(timeoutTimer)
StartTimer("timeout")

OnTimerElapse(
function(timer)
MissionVictory(ALL)
ShowTimer(true)
DestroyTimer(timer)
end,
timeoutTimer
)
--Thanks Myers73 for the timer code! :mrgreen:


KillObject("Fence3")

hunt = ObjectiveTDM:New{teamATT = 1, teamDEF = 2, pointsPerKillATT = 100, pointsPerKillDEF = 3, textATT =

"game.modes.hunt", textDEF = "game.modes.hunt2", multiplayerRules = true}



hunt.OnStart = function(self)
AddAIGoal(ATT, "Deathmatch", 1000)
AddAIGoal(DEF, "Deathmatch", 1000)
end

hunt:Start()

OnObjectKill(
function(object, killer)
local name = GetEntityName(object)
print("OnObjectKill():",name)
if name == "panel" then
KillObject("Fence4")
end
end
)

OnObjectKill(
function(object, killer)
local name = GetEntityName(object)
print("OnObjectKill():",name)
if name == "panel2" then
PlayAnimation("slide")
end
end
)
end
I tried removing this bit:
Hidden/Spoiler:
hunt = ObjectiveTDM:New{teamATT = 1, teamDEF = 2, pointsPerKillATT = 1, pointsPerKillDEF = 3, textATT = "game.modes.hunt", textDEF = "game.modes.hunt2", multiplayerRules = true}
But then realized that that was the most STUPID this I could have done. :roll: Unless of course that IS what I'm supposed to remove, then it's super smart!

So that's what I'm trying to do.

This probably has the most simple answer, but you all know my mind is the most simple. [humor/] :P

Help would be appreciated! :thumbs:
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Remove the hunt timer

Post by Fiodis »

I'm none too clear on it, but I think that if you just put your own timer in it will use that by default.
User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Re: Remove the hunt timer

Post by General_Nate »

No. Ok, well, yeah, but only once you delete this bit:
I tried removing this bit:
Hidden/Spoiler:
hunt = ObjectiveTDM:New{teamATT = 1, teamDEF = 2, pointsPerKillATT = 1, pointsPerKillDEF = 3, textATT = "game.modes.hunt", textDEF = "game.modes.hunt2", multiplayerRules = true}
But then realized that that was the most STUPID this I could have done. Unless of course that IS what I'm supposed to remove, then it's super smart!
Once I took out that, the timer was my own, but no AI spawned! :lol: So, it has to be in that bit of code, somewhere...
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Remove the hunt timer

Post by Maveritchell »

Why not just change the length of the hunt timer?
User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Re: Remove the hunt timer

Post by General_Nate »

Maveritchell wrote:Why not just change the length of the hunt timer?
In the preferences menu in BFII? No, I don't want people to change it.

Or do you mean via LUA? If so, how?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Remove the hunt timer

Post by Maveritchell »

You can edit the function that sets the time limit in the Objective TDM script:

Code: Select all

function ObjectiveTDM:GetGameTimeLimit()
	if ( self.isCelebrityDeathmatch or self.isUberMode) then
		return 0
	else
		return ScriptCB_GetHuntMaxTimeLimit()
	end
end
Or you can simply set it up as a hero assault (i.e. add in the "isCelebrityDeathmatch" line in the TDM setup as seen in regular HA scripts) and then create your own victory condition with your own timer, which is exactly what you originally tried, but it will have the notable benefit of not crashing your map.

I think your original code needs work, though, because right now the attacking team will always win regardless of points/reinforcements (or maybe that's what you want?).
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: Remove the hunt timer

Post by myers73 »

i havnt spent that much time looking at timers, how would you make it so the team with the most points wins?
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Remove the hunt timer

Post by Teancum »

ObjectiveTDM.lua handles that for you. As far as putting it into a custom script, I'd look at that lua.
User avatar
eliminator
Second Lance Corporal
Second Lance Corporal
Posts: 118
Joined: Wed Aug 19, 2009 3:39 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Germany

Re: Remove the hunt timer

Post by eliminator »

Hidden/Spoiler:
hunt = ObjectiveTDM:New{teamATT = 1, teamDEF = 2, pointsPerKillATT = 1, pointsPerKillDEF = 1, textATT = "game.modes.hunt", textDEF = "game.modes.hunt2", multiplayerRules = true, isCelebrityDeathmatch = true}
only add the red one..
Post Reply