Remaining in a space for a certain time triggers something to happen?

G

Grape

Guest
Hiya, I would like to make an anti-camping feature in a Half Life 2 ctf map that I like. What I want to do is define regions that keep track of how long each player inside it has been there. When a certain amount of time has passed, 20 seconds or so, I want to do something to the camping player, say spawn a headcrab in the rafters overhead him or slap that player 25hp.

Can you please give me some idea of how to create a region like that? I'm pretty good with programming because I'm a third-year software engineering student, so go ahead and spout technobabble, please.

Herr Grape
 
I don't know much code-specific technobabble, but I'd guess you could accomplish it something like:

have 2 trigger_presence entities set in a series. The first detects the presence of a particular team within a defined area, and cues up the second trigger_presence to activate 20 seconds later. If -when the 2nd trigger activates- there are enemies (still) in the area, a punishment is dealt out.

Obviously this is exploitable, you'd have to move out of the spawn every 20 seconds for a brief moment. But the spawnkillers wouldn't know that, so it would probably work.
 
trigger_multiple with it's OnStartTouch output firing an info_timer that outputs every second to incrementally increase a math_counter.
Have the trigger_multiple's OnEndTouch output stop the info_timer and reset the math_counter.

Give the math_counter a maximum value of 20, and have it's OnHitMax output trigger your trap.
 
trigger_multiple with it's OnStartTouch output firing an info_timer that outputs every second to incrementally increase a math_counter.
Have the trigger_multiple's OnEndTouch output stop the info_timer and reset the math_counter.

Give the math_counter a maximum value of 20, and have it's OnHitMax output trigger your trap.

Why not just have the timer fire every 20 seconds and then the timer itself dishses out the penalty? And tigger just enables and disables the timer.

Spawing headcrabs is not a good solution though since the AI is not all that good with multiplayer (read: it doesn't work). But how about enabling a push or a teleport that forces all players somewhere else in this map?
 
The type of punishment couold be anything from a team#1-only 'killbox' that deals 15 damage per second (enough to allow a spawncamper to repent and retreat to outside the spawn) while "Don't spawncamp" appears on the screen.

Or a gun that fires at the player (like in DoD).

Or a teleport that returns team#1 players to their spawn and forces them to retread the whole of the map.
 
I'm not sure how they did it, but here's an idea.

I was playing on a CS server, and whenever i got into a camping spot it said "No Camping!" on the screen and my weapon was unequipped and thrown away.
 
That sounds like a server modification. I don't think that's possible as part of the map scripting it would have to be in the client or server-side code (or part of an addon that modifies those codes).
 
It could be possible with map scripting although it's just way way to compilivated so I think they did it with a server plugin.
 
I don't know of a default entity that unequips weapons in multiplayer (sure there's one used in singleplayer, but I'm not sure if it would work for multiplayer). Therefore it would require a new entity or new parameters for an existing entity, which would effectively mean a modification of the game code before it could be achieved in the map editor.
 
I'm thinking possibly firing a command to the !activator entity somehow. Possibly a weaponstrip entity for each player somwhow so that each player can be stripped of their weapons. Problem is that that only strips the weapons, nothing is left on the ground.

I don't know. Much easier server-side I guess.
 
Back
Top