team with most kills win at end of round?


(WAR potatoes) #1

hey. I’ve been mapping for some time now and i was wondering how you could make it so the team who has the most kills win the round. i’ve done some searching and saw that it was impossible to keep tracks of kills but only of spawns, via scriptblocks that run each time the spawn entity is being triggered. here is something i tought of…


game_manager
{
	spawn
	{
		//stuff...
		globalaccum 0 set 0 //allied spawn counter
		globalaccum 1 set 0 //axis spawn counter
		//other stuff...
	}

	trigger timelimit_hit
	{
		trigger self check_axiswin
		trigger self check_allieswin
		trigger self check_draw
	}
	
	trigger check_axiswin	
	{
		globalaccum 1 abort_if_greater_than globalaccum 0
		wm_setwinner 0
		wait 500
		wm_endround
	}

	trigger check_allieswin
	{
		globalaccum 0 abort_if_greater_than globalaccum 1
		wm_setwinner 1
		wait 500
		wm_endround
	}

	trigger check_draw
	{
		globalaccum 0 abort_if_greater_than globalaccum 1
		globalaccum 1 abort_if_greater_than globalaccum 0
		wm_setwinner -1
		wait 500
		wm_endround
	}

}

altough im pretty sure this is valid, i’m still unsure on the “globalaccum X abort_if_greater_than globalaccum Y” because i’ve always seen a number after the “abort_if…”. can someone tell me if this would work? i guess nothing prevents it to do but we never know.

also, i’d like to know how is it possible to record the number of spawns… i am guessing it is something like this?


trigger spawnscriptname
{
	globalacum 0/1 inc 1
}

thanks for replying :slight_smile:


(sQynor) #2

It’s suppose to be Globalaccum <number of the accum> abort_if_greater_than <a number>

An accum is nothing more than a 32bit register or sumthn.

I never tried if u could really count to that. but you can increase your Accums by doing

Globalaccum <number> <with how much>

say:

Globalaccum 0 inc 1

Everytime it reads this sentence it will increase the bitset of Globalaccum 0 by 1.

Now let’s say… what would happen if people will kill others more than 32 times ?

Globalaccum trigger_if_equal 32 <scriptname> <triggername>

Then it would trigger when the next time it reaches 32.

Then you could make a Globalaccum 3 and make it so when it reaches 32…that he goes into counting the Globalaccum 3 :>

I g2g to school now… but i’ll see if i can help you with the spawning trigger :>

( Then again… if people do a selfkill… then the other team wins too fast right ? xD )

EDIT: if you want to know stuff about scripting… look here -> http://games.chruker.dk/enemy_territory/scripting_reference.php


(SPU9) #3

btw winning by lesser deaths/selfkills is for a small 1v1 or 2v2 map better ;D just my opinion (otherwise you can kill the opponent and selfkill afterwards to spawn with full hp…)

and sorry cant help you with that script ;(


(Zer0Cool) #4

it was impossible to keep tracks of kills but only of spawns, via scriptblocks that run each time the spawn entity is being triggered

where do you have seen this? how do you want to run a script by spawning players?


(stealth6) #5

I asked the same qustion a long time ago :smiley:
yes you can only count people spawning, I never figured out how to do it in radiant but the script would be something like this:

allies spawn
globalaccum 1 inc 1

axis spawn
globalaccum 1 inc -1

at the end of the map:
globalaccum 1 abort_if_greater_than 0
allies win

globalaccum 1 abort_if_less_than 0
axis win

globalaccum 1 abort_if_not_equal 0
draw

this would basically work, for the spawns, but ofc if somebody does selfkill it also counts and if somebody connects to the game it also coutns as a kill, so in some cases it will be unfair…

if you want a scoreboard aswell, then put your thinking cap on because that is a bitch to make :smiley:
I just finished 1 that counts to 999 1000 = win


(Zer0Cool) #6

i tested this script before i wrote my last reply and it didnt work for me.


(WAR potatoes) #7

[QUOTE=stealth6;177329]I asked the same qustion a long time ago :smiley:
yes you can only count people spawning, I never figured out how to do it in radiant but the script would be something like this:

allies spawn
globalaccum 1 inc 1

axis spawn
globalaccum 1 inc -1

at the end of the map:
globalaccum 1 abort_if_greater_than 0
allies win

globalaccum 1 abort_if_less_than 0
axis win

globalaccum 1 abort_if_not_equal 0
draw

this would basically work, for the spawns, but ofc if somebody does selfkill it also counts and if somebody connects to the game it also coutns as a kill, so in some cases it will be unfair…

if you want a scoreboard aswell, then put your thinking cap on because that is a bitch to make :smiley:
I just finished 1 that counts to 999 1000 = win[/QUOTE]

wow, exactly what i was looking for. thanks a lot :smiley:
now i’d just like to know if my script to inc the gaccums via the spawn is correct, i’m guessing yes but if you could tell me if it is it would be awesome.


(sQynor) #8

Another idea could be:

Make 2 trigger_multiple with target_script_Triggers.

1 trigger_multiple per team.

When people spawn trigger gets activated. make a checker. that checks every second if players are still there.

The player who is gone first will get no points. and the players who’s in the trigger _multiple gets 10 points.

Then a trigger_hurt will kill the remaining player. BUT it will not count as a score for the other player.

That way everyone gets a fresh respawn. otherwise. you would have something like 1 vs 1. 1 player kill the other, has 40 hp left. then he dies. then the other has 60 hp. and so on…

I have to go to school now. but i’ll try if i can make u a little example (prefab or something )


(Wezelkrozum) #9

I think it’s smart to use the spawncounter. If you killed a player of the other team he will respawn and your team get 1 point. If you kill yourself the other team get a point. Only one thing, you mustn’t count the first spawn (first 5 seconds or something like that).


(WAR potatoes) #10

[QUOTE=sQynor;177352]Another idea could be:

Make 2 trigger_multiple with target_script_Triggers.

1 trigger_multiple per team.

When people spawn trigger gets activated. make a checker. that checks every second if players are still there.

The player who is gone first will get no points. and the players who’s in the trigger _multiple gets 10 points.

Then a trigger_hurt will kill the remaining player. BUT it will not count as a score for the other player.

That way everyone gets a fresh respawn. otherwise. you would have something like 1 vs 1. 1 player kill the other, has 40 hp left. then he dies. then the other has 60 hp. and so on…

I have to go to school now. but i’ll try if i can make u a little example (prefab or something )[/QUOTE]

No need to make a prefab, i know that it’s how it was done in et_headshot, but the map i’m making is deffinately not of the arena style, so i won’t do it (but thanks for help)


(isbowhten) #11

isnT there any way to use the death event executed when players die?
i think i tried everything… i gave the spawns, the spectator-spawn, the worldspawn a scriptname but always it hadnt been right… but players do execute a death event


(WAR potatoes) #12

yep, but it looks like you can’t treat it via scripting. i tried to target the spawns with a target_script_trigger (or somthing like that) and to make them run the script in the activate event but it dosen’t work (i had replaced the gaccum inc by a wm_announce)

EDIT:

Its working. I’ve made the spawns target the target_script_trigger that ran the scriptblocks (and also fixed stealth6’s script which had, no offense, a few errors…). THanks for the help everyone


(Cambodunum) #13

awesome … is there any chance to “take a look” at your working script War Potatoes ? … ok thats a lie i wanna borrow it xD

greetz Cambo