PDA

View Full Version : [TUTORIAL] the TF_GAMERULES entity


spaceweasels
11-21-2007, 10:28 AM
Inspired by Logo's tutorial here (http://tf2maps.net/showthread.php?t=144), I decided to explore a bit more on an aspect of TF2 that most don't realize exist.

http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/tf_gamerules1.jpg

http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/tf_gamerules2.jpg
This is the spawn message for a team. You could say "you are now defending" or "you are offensive... to smell!". For example:
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/tf_gamerules0.jpg
VALVe had some preset messages, but you can type in your own.

spaceweasels
11-21-2007, 10:28 AM
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/tf_gamerules3.jpg
Setting attacking or defending won't really affect the scoring of your map. You still need to setup CP or CTF entities properly. What this does however, is change the icon to either a shield or a sword. Here I set red to offensive and gave them a goal string:
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/tf_gamerules6.jpg

http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/tf_gamerules4.jpg
You can manipulate respawn times with this output. Not only in the logic_auto entity, but anything. For instance, if you using a team_round_timer, as the clock winds down, you can have the respawn time shrink. I beleive there is also a similiar output called addredteamrespawnwavetime, but I'll have to test it.

http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/tf_gamerules5.jpg
Logo already discussed this. This should be added. This doesn't work with the team_round_timer, this is for when the server itself reaches it's map rotation time limit.

There might be more setting out there. I'll see if I can find anything more and add it here.

Snipergen
11-21-2007, 10:46 AM
this is awesome

what font is this too? :p

kudos!

spaceweasels
11-21-2007, 10:55 AM
I used two fonts. The bold face font is TF2BUILD, the smaller font is TF2professor. You can get those fonts (and others) in your \team fortress2\tf\resource folder.

Logo
11-21-2007, 10:59 AM
space do you actually type the quotes (" ") when you put in the game objective directions? I tried using that entity before but didn't see the message come up. Granted I didn't play around with it too long though.

Alexforcefive
11-21-2007, 11:18 AM
I'm voting spaceweasels for member of the month!

spaceweasels
11-21-2007, 11:28 AM
Nope, no quotes. Just type the message in directly. Try to avoid using special characters, such as backslashes, forwardslash, $, #, %, quotes and semicolon. Any of those could be misconstrued by the game engine to be an instruction.


edit:

This is what my final logic_auto entity looked like:
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/tf_gamerules8.jpg

A Boojum Snark
11-21-2007, 12:59 PM
Furthermore, do not EVER put a double-mark quote (" as opposed to a ') in any field in Hammer. The VMF structure uses them and if one shows up in the wrong place Hammer will be unable to load the file and you'll have to go in with a text editor and take it out manually.

and this is very good! I had been wondering how I'd set the message given when you spawn but hadn't looked into it yet. All I've done with this thing so far is remove the respawn time while I'm ingame looking at my map and dying a lot :P

Novacane
11-21-2007, 08:16 PM
Awesome dude. Was wondering where that entity was :D Some great work.

TheBladeRoden
11-21-2007, 08:45 PM
This could be useful

ThatGuy
11-22-2007, 02:24 AM
doesn't setstalemateontimelimit automatically end the map ? and not go in sudden death?

S.E.A.L.#555
11-22-2007, 02:41 AM
Nice one! .

spaceweasels
11-22-2007, 10:03 AM
doesn't setstalemateontimelimit automatically end the map ? and not go in sudden death?

Yes, your right. Sudden death is handled by other entities. The setstalemateontimelimit give you the stalemate ending.

It was the only one I wasn't able to test. :p

die_angel
11-28-2007, 12:43 AM
That's great is there any way to change stuffs like each team's flag skin or, if it gives a point on cap or not?

die_angel
11-29-2007, 09:00 AM
There are two more by the way:

input: AddRedTeamRespawnWaveTime
input: AddBlueTeamRespawnWaveTime

richard_cabeza
01-07-2008, 10:59 PM
Great info.

DrHaphazard
01-08-2008, 02:29 AM
Very nice info indeed, I was wondering though if the link to Logo's post that spaceweasel mentions will ever work. If not could someone summarise what logo had to say?

A Boojum Snark
01-08-2008, 02:33 AM
Only reason it doesn't work is because the address of the forums has changed since... http://tf2maps.net/showthread.php?t=144 Thread ID is still the same thing.

DrHaphazard
01-08-2008, 02:38 AM
Ah, thanks for the quick reply snark!

DrHaphazard
01-08-2008, 04:48 PM
Just curious btw, how did you figure out what commands could be given using this tf_gamerules entity?

Somehow i doubt you randomly typed in SetBlueTeamGoalString to see what it would do =P

A Boojum Snark
01-08-2008, 08:14 PM
The ent_fire command lets you send inputs to any named entity, or entity class that exists in the map. It has the command auto-complete function Steam has so nicely provided, where after you've typed in the name/class of an entity, all valid inputs are listed to scroll through.

DrHaphazard
01-08-2008, 11:27 PM
Interesting, thanks again for your response snark!

MacBeth [O.C.Reg]
01-13-2008, 06:42 PM
Very useful info - one thing though:

Does the TF_GAMERULES entity relate to the victory/defeat message at the end of a round? I have created a customised control point based map (a central point that is unlocked - or relocked - per team, on a timer modified by how many of the surrounding points each team holds... the details of which are a topic for another tutorial perhaps...)

The problem I have is that when one team successfully captures the central point and thus wins the round, the message displayed in the 'Victory' HUD says e.g. 'RED successfully defended until time ran out' instead of '...captured all the control points'. This happens even if one team does capture *all* the points - which is not actually necessary for victory as only the central point needs to be captured, and can be unlocked with only one of the surrounding points.

I have set both teams to Attack (with custom messages as described above)

Is there a way to customise the victory message in a similar way?

YM
01-14-2008, 03:30 PM
I don't seem to be able to get this to work at all.
http://img228.imageshack.us/img228/9219/tfgamerulesft4.jpg
Thats what I've got in my logic_auto, what am I doing wrong?

MacBeth [O.C.Reg]
01-15-2008, 07:49 AM
You might need to refresh your TF2 content before it will work - I was having the problem where taunt anims, spy cloaking and sniping were malfunctioning when I tested maps, and the answer to that was to delete my Team Fortress 2 folder within the steamapps directory (having backed up my custom content - maps, textures, config etc.) and then run the game which does a fresh install from the .gcf.

This fixed the glitches, and appeared to have the side effect of bringing up the GoalString messages too. Give it a go, can't hurt (as long as you back up your custom content!)

YM
01-15-2008, 08:01 AM
ok, so where is the achievements and player stats stored? don't want to loose those.

Intraman
01-15-2008, 10:25 AM
you won't. I've had to do it a number of times and things like stats and such are not effected.

[SKC]S3r3nad3
01-16-2008, 10:48 PM
Thanks weasel!

Axl
08-03-2008, 07:26 PM
Quick question

Does anyone know if there's a server command for SetStalemateOnTimelimit or am I gonna have to ent ed every cp and ctf map I want to end with timelimit?

I know of mp_stalmate_enabled but that only applies to round times.

Anyone know?

Nineaxis
08-03-2008, 10:18 PM
ok, so where is the achievements and player stats stored? don't want to loose those.
Every time you die your stats are sent to Valve's master servers which record it and make your 640927 healing points needed for an ubersaw permanent.

suzzanuzza
05-30-2009, 12:45 PM
if tf_gamerules is automatically spawned where is it? i cant find it.

A Boojum Snark
05-30-2009, 12:58 PM
It's not placed in your VMF. It's generated when the map is run in the game if there wasn't already one there. (same thing happens with timers)

Penguin
06-01-2009, 04:05 PM
http://img35.imageshack.us/img35/3826/tfgr.png

This used to work. As of my last compile, it does not.

Any particular reason, or does the game jst hat eme?

[O]
01-16-2012, 01:20 AM
five questions:

1- so tf_gamerles requires a logic_auto to provide it input for onmapspawn?

2- is logic_auto also automatically created and hidden in the map like tf_gamerules?

3- can a map run without a logic_auto? i dont believe i ever placed one

4- how can i check if i have already placed these two entities before? i dont want to double up on them and cause conflicts.

5- is there any other entity that controls spawn time?

Ravidge
01-16-2012, 02:58 AM
Answer to all your questions: tf_gamerules has been added as an actual entity now.
This thread is from 2007. It's thread number 149, meaning it's old as old can be. The information here is not relevant anymore.

For better info
https://developer.valvesoftware.com/wiki/Tf_gamerules

English Mobster
01-16-2012, 05:48 AM
1. It doesn't require it to come from a logic_auto, to my knowledge, but that's typically the best place for it.
2. No, it is not. You have to place it.
3. Yes, but things will be screwy. What a logic_auto does is load up everything you want your map to do before it spawns any players whatsoever. For example, changing respawn times (by default it's set to 10 for both teams), saying who is on offense versus who is on defense, getting something to begin moving the moment the map starts, etc.
4. In Hammer, up top (by File, Edit, etc.), there's a dropdown called "Map." Click on it and hit "Entity Report." This will tell you the names of every entity on your map, listed in alphabetical order by type (so all of your trigger_hurts would be grouped together with trigger_multiples below and trigger_gravities above). Use this to find your logic_auto and/or tf_gamerules, then you can either double-click on it or click and go View -> Center 3D Views on Selection.
5. Not to my knowledge.