Page 1 of 1

Remove the hunt timer

Posted: Tue Nov 17, 2009 6:07 pm
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:

Re: Remove the hunt timer

Posted: Tue Nov 17, 2009 7:21 pm
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.

Re: Remove the hunt timer

Posted: Tue Nov 17, 2009 10:09 pm
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...

Re: Remove the hunt timer

Posted: Wed Nov 18, 2009 8:37 pm
by Maveritchell
Why not just change the length of the hunt timer?

Re: Remove the hunt timer

Posted: Wed Nov 18, 2009 10:24 pm
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?

Re: Remove the hunt timer

Posted: Wed Nov 18, 2009 10:55 pm
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?).

Re: Remove the hunt timer

Posted: Wed Nov 18, 2009 11:43 pm
by myers73
i havnt spent that much time looking at timers, how would you make it so the team with the most points wins?

Re: Remove the hunt timer

Posted: Thu Nov 19, 2009 8:24 am
by Teancum
ObjectiveTDM.lua handles that for you. As far as putting it into a custom script, I'd look at that lua.

Re: Remove the hunt timer

Posted: Thu Nov 19, 2009 4:10 pm
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..