timelimit_hit


(Loffy) #1

Hi!
Have you worked with the script command timelimit_hit?
I working on a ctf map, and I wonder if this command can be used in the map.
I was planning to have set_winner and endround when one of the teams capture the flag ten times. But, what if the teams are even? And they never reach ten captures?
:open_mouth:
Perhaps timelimit_hit can be used, to trigger a comparasion? Which team has to most captures at full time? I’ll use accum’s for that. (And if it is even, let the next scoring team win.)
I guess timelimit_hit is a part of the game_manager routine?
// Loffy


(G0-Gerbil) #2

Ah sod it, I’d just typed out a lengthy reply and for the third time in a row the kitten stood on the keyboard and killed it.

All I will say for now, cos I really can’t be arsed to type it out a fourth time, is take a look into the script for bk_forest for RTCW, it had something like what you want, given that I’ve never seen this timelimit hit command you mention. What official map script have you seen it in?


(Drakir) #3
	trigger timelimit_hit
	{
		trigger end_boom_north check_0
		trigger end_boom_south check_1
	}

This part is from oasis.script

This is a trigger that autotriggers in game_manager when timelimit is hit, i used it in 2hide to fire of the cannon at the end of the game.

Use the global_accum for the counting of caps the just set the winner to the team who has the highest number.


(G0-Gerbil) #4

wooo cool, never noticed that before, cheers :smiley:


(Chruker) #5

How would you compare two counters using the different accum commands thats available?


(chavo_one) #6

Great question. Maybe there is a simpler solution, but this is what I came up with.

Have three globalaccums. One to keep track of the number of allies caps, one to keep track of the number of axis caps, and one to decide who wins if the time ends. So the third globalaccum is only used if the timelimit_hit function is called.


globalaccum 1 set 0   //axis counter
globalaccum 2 set 0   //allied counter
globalaccum 3 set 10  //timelimit winner counter

globalaccum 3 would start at 10. That way a value of 10 will mean the teams are even, a value less than 10 will mean the axis are winning, and a value greater than 10 will mean the allies are winning. I know there is a “accum X inc 1”, but I don’t think there is a “accum X dec 1”. So assuming there is no “dec” command…


trigger axis_capture_flag
{
    globalaccum 1 inc 1
    globalaccum 3 trigger_if_equal 19 counter set_18
    globalaccum 3 trigger_if_equal 18 counter set_17
    globalaccum 3 trigger_if_equal 17 counter set_16
    globalaccum 3 trigger_if_equal 16 counter set_15
    globalaccum 3 trigger_if_equal 15 counter set_14
    globalaccum 3 trigger_if_equal 14 counter set_13
    globalaccum 3 trigger_if_equal 13 counter set_12
    globalaccum 3 trigger_if_equal 12 counter set_11
    globalaccum 3 trigger_if_equal 11 counter set_10
    globalaccum 3 trigger_if_equal 10 counter set_9
    globalaccum 3 trigger_if_equal 9 counter set_8
    globalaccum 3 trigger_if_equal 8 counter set_7
    globalaccum 3 trigger_if_equal 7 counter set_6
    globalaccum 3 trigger_if_equal 6 counter set_5
    globalaccum 3 trigger_if_equal 5 counter set_4
    globalaccum 3 trigger_if_equal 4 counter set_3
    globalaccum 3 trigger_if_equal 3 counter set_2
    globalaccum 3 trigger_if_equal 2 counter set_1
    globalaccum 3 trigger_if_equal 1 counter set_0
}

trigger allied_capture_flag
{
    globalaccum 2 inc 1
    globalaccum 3 trigger_if_equal 19 counter set_20
    globalaccum 3 trigger_if_equal 18 counter set_19
    globalaccum 3 trigger_if_equal 17 counter set_18
    globalaccum 3 trigger_if_equal 16 counter set_17
    globalaccum 3 trigger_if_equal 15 counter set_16
    globalaccum 3 trigger_if_equal 14 counter set_15
    globalaccum 3 trigger_if_equal 13 counter set_14
    globalaccum 3 trigger_if_equal 12 counter set_13
    globalaccum 3 trigger_if_equal 11 counter set_12
    globalaccum 3 trigger_if_equal 10 counter set_11
    globalaccum 3 trigger_if_equal 9 counter set_10
    globalaccum 3 trigger_if_equal 8 counter set_9
    globalaccum 3 trigger_if_equal 7 counter set_8
    globalaccum 3 trigger_if_equal 6 counter set_7
    globalaccum 3 trigger_if_equal 5 counter set_6
    globalaccum 3 trigger_if_equal 4 counter set_5
    globalaccum 3 trigger_if_equal 3 counter set_4
    globalaccum 3 trigger_if_equal 2 counter set_3
    globalaccum 3 trigger_if_equal 1 counter set_2
}

counter
{
    trigger set_0
    {
        globalaccum 3 set 0
    }
    trigger set_1
    {
        globalaccum 3 set 1
    }
    trigger set_2
    {
        globalaccum 3 set 2
    }
    trigger set_3
    {
        globalaccum 3 set 3
    }
    trigger set_4
    {
        globalaccum 3 set 4
    }
    trigger set_5
    {
        globalaccum 3 set 5
    }
  .
  .
  .

    trigger set_20
    {
        globalaccum 3 set 20
    }

Then if the timelimit_hit function is called, it would call two functions that check to see which team won.


trigger timelimit_hit
{
    trigger end_axis_win check
    trigger end_allied_win check  
}

end_axis_win
{
    trigger check
    {
        globalaccum 3 abort_if_greater_than 9
        wm_announce "axis win"
    }
}

end_allied_win
{
    trigger check
    {
        globalaccum 3 abort_if_less_than 11
        wm_announce "allies win"
    }
}

I hope there are no typos, and feel free to point at the inevitable logic flaws. :slight_smile:


(G0-Gerbil) #7

You can just use inc with a negative number.

So what I’d do is this:

accum 1 set 0 – running total of caps

if axis captures a flag, then:

accum 1 inc 1

if allies captures a flag, then:

accum 1 inc -1

So now, if accum 1 > 0 then axis has more flags.
If accum 1 < 0 then allies have more flags.
If it’s 0, then of course they have the same number of flags.


(Loffy) #8

thx all. chavo and gerbil, ur defintiely on to somethng there.
Loffy


(Drakir) #9

I have a 1 globalaccum thingy for ya Loffy, thought this up last nite, just havent had time to post it yet.

cap_axis // trigger this when axis caps.
{
	globalaccum 1 inc 100
}


cap_allies // trigger this when allies caps.
{
	globalaccum 1 inc 1
}


deciede_leader // trigger this each time a flag is capped.
{
	// Check if axis leads
	globalaccum 1 trigger_if_equal 100 set_leader axis_winner
	globalaccum 1 trigger_if_equal 200 set_leader axis_winner
	globalaccum 1 trigger_if_equal 201 set_leader axis_winner
	globalaccum 1 trigger_if_equal 300 set_leader axis_winner
	globalaccum 1 trigger_if_equal 301 set_leader axis_winner
	globalaccum 1 trigger_if_equal 302 set_leader axis_winner
	globalaccum 1 trigger_if_equal 400 set_leader axis_winner
	globalaccum 1 trigger_if_equal 401 set_leader axis_winner
	globalaccum 1 trigger_if_equal 402 set_leader axis_winner
	globalaccum 1 trigger_if_equal 403 set_leader axis_winner
	globalaccum 1 trigger_if_equal 500 set_leader axis_winner
	globalaccum 1 trigger_if_equal 501 set_leader axis_winner
	globalaccum 1 trigger_if_equal 502 set_leader axis_winner
	globalaccum 1 trigger_if_equal 503 set_leader axis_winner
	globalaccum 1 trigger_if_equal 504 set_leader axis_winner
	globalaccum 1 trigger_if_equal 600 set_leader axis_winner
	globalaccum 1 trigger_if_equal 601 set_leader axis_winner
	globalaccum 1 trigger_if_equal 602 set_leader axis_winner
	globalaccum 1 trigger_if_equal 603 set_leader axis_winner
	globalaccum 1 trigger_if_equal 604 set_leader axis_winner
	globalaccum 1 trigger_if_equal 605 set_leader axis_winner
	globalaccum 1 trigger_if_equal 700 set_leader axis_winner
	globalaccum 1 trigger_if_equal 701 set_leader axis_winner
	globalaccum 1 trigger_if_equal 702 set_leader axis_winner
	globalaccum 1 trigger_if_equal 703 set_leader axis_winner
	globalaccum 1 trigger_if_equal 704 set_leader axis_winner
	globalaccum 1 trigger_if_equal 705 set_leader axis_winner
	globalaccum 1 trigger_if_equal 706 set_leader axis_winner
	globalaccum 1 trigger_if_equal 800 set_leader axis_winner
	globalaccum 1 trigger_if_equal 801 set_leader axis_winner
	globalaccum 1 trigger_if_equal 802 set_leader axis_winner
	globalaccum 1 trigger_if_equal 803 set_leader axis_winner
	globalaccum 1 trigger_if_equal 804 set_leader axis_winner
	globalaccum 1 trigger_if_equal 805 set_leader axis_winner
	globalaccum 1 trigger_if_equal 806 set_leader axis_winner
	globalaccum 1 trigger_if_equal 807 set_leader axis_winner
	globalaccum 1 trigger_if_equal 900 set_leader axis_winner
	globalaccum 1 trigger_if_equal 901 set_leader axis_winner
	globalaccum 1 trigger_if_equal 902 set_leader axis_winner
	globalaccum 1 trigger_if_equal 903 set_leader axis_winner
	globalaccum 1 trigger_if_equal 904 set_leader axis_winner
	globalaccum 1 trigger_if_equal 905 set_leader axis_winner
	globalaccum 1 trigger_if_equal 906 set_leader axis_winner
	globalaccum 1 trigger_if_equal 907 set_leader axis_winner
	globalaccum 1 trigger_if_equal 908 set_leader axis_winner

	// Check if Allies Leads
	globalaccum 1 trigger_if_equal 1 set_leader allies_winner
	globalaccum 1 trigger_if_equal 102 set_leader allies_winner
	globalaccum 1 trigger_if_equal 103 set_leader allies_winner
	globalaccum 1 trigger_if_equal 103 set_leader allies_winner
	globalaccum 1 trigger_if_equal 203 set_leader allies_winner
	globalaccum 1 trigger_if_equal 104 set_leader allies_winner
	globalaccum 1 trigger_if_equal 204 set_leader allies_winner
	globalaccum 1 trigger_if_equal 304 set_leader allies_winner
	globalaccum 1 trigger_if_equal 105 set_leader allies_winner
	globalaccum 1 trigger_if_equal 205 set_leader allies_winner
	globalaccum 1 trigger_if_equal 305 set_leader allies_winner
	globalaccum 1 trigger_if_equal 405 set_leader allies_winner
	globalaccum 1 trigger_if_equal 106 set_leader allies_winner
	globalaccum 1 trigger_if_equal 206 set_leader allies_winner
	globalaccum 1 trigger_if_equal 306 set_leader allies_winner
	globalaccum 1 trigger_if_equal 406 set_leader allies_winner
	globalaccum 1 trigger_if_equal 506 set_leader allies_winner
	globalaccum 1 trigger_if_equal 107 set_leader allies_winner
	globalaccum 1 trigger_if_equal 207 set_leader allies_winner
	globalaccum 1 trigger_if_equal 307 set_leader allies_winner
	globalaccum 1 trigger_if_equal 407 set_leader allies_winner
	globalaccum 1 trigger_if_equal 507 set_leader allies_winner
	globalaccum 1 trigger_if_equal 607 set_leader allies_winner
	globalaccum 1 trigger_if_equal 108 set_leader allies_winner
	globalaccum 1 trigger_if_equal 208 set_leader allies_winner
	globalaccum 1 trigger_if_equal 308 set_leader allies_winner
	globalaccum 1 trigger_if_equal 408 set_leader allies_winner
	globalaccum 1 trigger_if_equal 508 set_leader allies_winner
	globalaccum 1 trigger_if_equal 608 set_leader allies_winner
	globalaccum 1 trigger_if_equal 708 set_leader allies_winner
	globalaccum 1 trigger_if_equal 109 set_leader allies_winner
	globalaccum 1 trigger_if_equal 209 set_leader allies_winner
	globalaccum 1 trigger_if_equal 309 set_leader allies_winner
	globalaccum 1 trigger_if_equal 409 set_leader allies_winner
	globalaccum 1 trigger_if_equal 509 set_leader allies_winner
	globalaccum 1 trigger_if_equal 609 set_leader allies_winner
	globalaccum 1 trigger_if_equal 709 set_leader allies_winner
	globalaccum 1 trigger_if_equal 809 set_leader allies_winner

	// Check if game is tied
	globalaccum 1 trigger_if_equal 0 set_leader equal_winner
	globalaccum 1 trigger_if_equal 101 set_leader equal_winner
	globalaccum 1 trigger_if_equal 202 set_leader equal_winner
	globalaccum 1 trigger_if_equal 303 set_leader equal_winner
	globalaccum 1 trigger_if_equal 404 set_leader equal_winner
	globalaccum 1 trigger_if_equal 505 set_leader equal_winner
	globalaccum 1 trigger_if_equal 606 set_leader equal_winner
	globalaccum 1 trigger_if_equal 707 set_leader equal_winner
	globalaccum 1 trigger_if_equal 808 set_leader equal_winner
	globalaccum 1 trigger_if_equal 909 set_leader equal_winner
}


set_leader // this sets the proper winner on time expiration
{
	axis_winner // Winner on expiration of round timer (0=Axis, 1=Allies -1=Overtime)
  		{
		wm_setwinner	0
		}

	allies_winner // Winner on expiration of round timer (0=Axis, 1=Allies -1=Overtime)
  		{
		wm_setwinner	1
		}

	equal_winner // Winner on expiration of round timer (0=Axis, 1=Allies -1=Overtime)
 		{
		wm_setwinner	-1
		}
}

timelimit_hit
{
	//start overtime procedure. Remove all current flags. 
	//Spawn a new one for each team, the first to cap wins.
	trigger overtime
	{
	} 
}

Never mind the placement of the different stuff…just made em so that u can understand the thought of it.

Evevery time a team caps u increase the globalaccum by either 1 or 100 depending on what team that caps. Then u check what team that has most caps and set the time expiration winner.

If the game is tied, well u can either do as i thought of and spawn a new flag in sudden death mode or just end the game and call it even.


(Loffy) #10

D!
Impressive idea. I think it would work.
(I like the idea with 1 and 100 inc. Where did you get that idea? Are you a math genius?)
Here’s the problem part: “If the game is tied, well u can either do as i thought of and spawn a new flag in sudden death mode or just end the game and call it even.”
Spawn new flags is no probl. I can have a special, “sudden death”-flag, hidden (behind a script_mover) and un-hide it when timelimit is hit. Each team get such a flag. Then who ever caps first wins. But whatabout the flags that the teams are carrying at the moment of timelimit hit? How do I rip those flags out of their hands?
Remember, team_ctf_redflag (and _blueflag) cannot have targetnames. So, I cannot target them in a script, and do a setstate invisible.
(Or, perhaps I can use the “remove” command? Have to try it!)
And this design you talk about, “just end the game and call it even.”, Im not sure how to do that, technically. If game ends and it is setwinner -1, will not the map continue, with the clock at 0.00 ?
Well, thanks anyway. And thanks for the alfatesting you did the other day. I appreciate that you took time off from 2Hide and Navarone to run around and steal flags with me.
Must continue now, and try these new script ideas.
Later!
// Loffy


(Drakir) #11

I really dunno what would happen if you have set_winner -1 and then call in the wm_endround command.


(digibob) #12

Uh… just do what gerbil suggested, that’s alot of effort for something which can be done alot simpler.


(Drakir) #13

Uh… just do what gerbil suggested, that’s alot of effort for something which can be done alot simpler.

True, just wanted to share the idea i had.


(G0-Gerbil) #14

Yeah but it’s kind of not going to work.
Say there’s a tough fight over 1 flag and it gets alternatively captures 30 or so times. You’d have to extend your script indefinately (certainly more than the 9 captures overall in a match you allow for here).
Now of course, you’d also run into a problem if allies captured 100 times, because that would then equal 1 axis win. Of course, you could make it + 10000 instead, but then you’d have to keep on extending the checking :slight_smile:


(Drakir) #15

Yeah well i have talked to Loffy and the plan is to have 10 flags, if 1 team caps number 10 they win. So the idea would work!


(G0-Gerbil) #16

Well erm what if one team re-takes a flag?
Even with 1 flag you can have multiple captures, unless it’s a true ‘once a flag is captured no-one can ever get it again’. But then, you’d run into problems because some flags will always be nearer one side’s spawn than the other and as such might as well be omitted since it’s only the flags roughly equidistant from each other that might be fought over.

And to be honest, if it IS ‘once a flag is captured it stays captured’ then you aren’t likely to run into the timelimit anyway because it’s so easy for all the flags to get captured at which point it’s game over.


(Drakir) #17

Well in ET there is only team_CTF_xxxflag and when that is capped it kinda goes away so u have to have a number of flags invis and then make the next vis when the other is capped sofar as i know.

About not running into a equal score, well that all depends on the maps design dont it?


(Loffy) #18

And you cant have them invisible and then make them appear suddenly, via the script command setstate default, because they cannot have targetnames. (When they dont have targetnames I cannot call/target them.)
I can use the command “remove” at spawn (for the team_ctf_redflag and _blueflag) but then how do I call them back?
So, my solution is to have flag 2-9 hidden (script_mover), and have them appear one by one as the flags are captured.
Axis flag 2 appears (from behind a script_mover) only after axis flag 1 is stolen and captured by the allies, flag 3 when flag 2 i captured and so on.
// Loffy


(G0-Gerbil) #19

I obviously missed something in this thread, given Drakir’s and Loffy’s most recent replies, so after a re-read…

I think I was getting confused in CTF terminology. Whenever someone says ‘ctf’ I always think of something along the lines of destruction from RTCW, but I realise that I’m probably wrong here.

So would I be right in saying that each team has a flag, which the other team must capture and transport back to their base (at which point a fresh flag appears at the enemy’s end again), and first to 10 of these capturtes wins?

If so, I wouldn’t use flags at all, just use multiple objectives (like the gold in goldrush), and setstate invisible the pickup point each time an objective is picked up, then setstate default it again when the objective is either returned or dropped off.

Or am I getting the wrong end of the stick again (the errrr… stick, it like has 3 ends or something ummmm).


(Loffy) #20

hi!
I talking about cft the Unreal Tournament or Quake 2 way. (if it is right or wrong to try to make such a map for ET is another debate.) my problem is to get this to work in ET.
Each team has a base and a home flag. If they steal the enemy’s flag and take it back home they score. I was planning to have 10 captures = victory. Whenever the flag is dropped (for example, if the flag carrier - for some odd reason - gets crushed under a gigant Crucher, and it stays on the ground for 30 seconds, the flag gets automatically returned. A team mate can try to pick it up before those 30 sec are up. If an enemy picks it up, it gets returned to its original place.
The stuff above works in both RtCW, ET and UT and Quake 2. This next thing doesnt work in RtCW and ET:
In UT and quake 2, when blue flag is stolen by the red team and taken back to the red team’s base, the red team gets a score AND the blue flag is returned to its original place. Ready to be captured again.
In Wolf I have found that the flag is not returned once it is stolen, taken to home base and thus captured. The team gets an increased score yes, but the flag… it’s gone.

So, I will have ten team_ctf_redspawn in the Axis base. The first one is out in the open. The rest are indiviually hidden behind script_movers. The first flag is ready to be stolen by the sneaky Allied Forces at game start. Once the allies have taken it to their base, they get 1 point and the second Axis flag is un-hidden - the script_mover that covers the second Axis flag is setstate invisible.
When 2nd Axis flag is stolen and captured by the Allies, then the 3rd Axis flag is un-hidden.

Phew, nine “boxes” in each base, hiding flags. Messy base - dirty mapping.

// L.