Exploding Barrel Logic tutorial

pur3r4ge

Newbie
Joined
Aug 30, 2004
Messages
187
Reaction score
0
I've picked apart the respawning barrel logic system from DM_Lockdown, since it seems as if many people are having problems. This will prevent you barrels from losing their "burn before exploding" behavior after respawning.

First of all, your going to need the following entities:

1) logic_auto
-this is for the initial spawn of the barrels

2) math_counter
-this keeps track of how many you've blown up

3) point_template
-when it's time to respawn, this says what to spawn

4) prop_physics_respawnable
-these are your barrels themselves

Once you've created the logic_auto, add the following output:

OnMapSpawn target entities named exploding_barrels_template via this input ForceSpawn after a delay in seconds of 0.00

Check the "remove on fire" flag

Next is the math_counter

Name it exploding_barrels_counter
initial value: 0
Minimum legal value: 0
Maximum legal value: this is the total number of barrels in the map. In the sample map, there are six barrels, so I used 6 for this value. (once you've created your barrels, you can count the number of exploding_barrels on the input list for the counter to get this number as well)

It needs 2 outputs.
OnHitMax target exploding_barrels_counter SetValue with an override of 0 after a dalay of 0
OnHitMax target exploding_barrels_template ForceSpawn after a delay of 30

Now we move on the the point_template

Name it exploding_barrels_template
set keyvalue Template 1 to exploding_barrels

Check the flag: Preserve entity names

Last is the barrels themselves. I'd create one, then copy it throughout your level.

Name: exploding_barrels (they are all named this)
world model: models/props_c17/oildrum001_explosive.mdl
respawn time: 30 seconds

add the following output:
OnBreak target exploding_barrels_counter via input Add a parameter override of 1 after a delay of 0

Make sure the only flag checked is "start asleep" (you'll need to position the model directly on the floor)

You can check out a sample map here:

Right click and "save target as":
Barrel Logic sample

Feel free to post corrections. This is really pushing the limit of my understanding of hammer's I/O system ;)
 
Hi, thanks for doing this, however I have a problem with it.

I copied the barrels in place of mine from your map, with the logic and counter, however the first respawn works fine, second one they just explode, tird respawn spawns 3 barrels for each barrel spawned thats been destroyed (so two lots of respawn in a set of 3 barrels, 3 barrels for each barrel destroyed)

It got to the point where there was nearly 4000 barrels on the map, they kept respawning 3 for every destroyed (as in nearly 400 barrels a time) every half a second like a barrel fountain.

Any ideas on whats happening?

Thanks.
 
That's the problem I had when I ripped the system out of lockdown for use in mine.
 
Did you remember to adjust the math_counter to reflect the total number of barrels in the map?
 
Of course. It all works really well for a while, then it just goes horribly, horribly wrong.
 
Hell, I have no idea then. Like I said, I basically just plucked it out of lockdown exactly, and in the sample it works. Sorry I couldn't be more help.
 
I noticed that in Lockdown, the counters are set to 30 seconds, but the barrels are set to 60. However, in your example map, some barrels are set to 30 and some to -1. Maybe that's the problem?
 
Good job "catching" me. I wouldn't have bothered posting this had I known there was another tutorial, which also just put together the info from dm_lockdown. At the time I wrote it, I had looked, and did not find any tutorials covering this.

I don't know when the tutorial was made, but it was last modified on 12/24, almost 2 weeks after my post.

Just because something exists elsewhere on the internet based on a sample map released by Valve doesn't mean the content was plagerized. Accusing someone of a crime of this nature is extremely bad form, particularly when they were just going out of their way to try and post some helpful information.

/edit: OK, it was made 12/10. It's still 2 people independently reaching the same conclusion based on what Valve had in lockdown.
 
its not a big deal. didn't mean to strike a nerve. speaking of nerves. gotta get a root canal tomorrow. shit!
 
wow kool tutorial on that link. ive been to and it works gr8....for one barrel.

but wot happens when u want more then 1.

i copy + pasted to create another one from the 1 that works fine but it doesnt show up visable on the map?

ive got the low thingy set on 2 but still doesnt work?

wot is werid about it is its showing up but invisable lol.

so basicly im only seeing 1 any ideas?
 
anyone :(

i sent the person who made the tutorial an e-mail but no response as of yet.

or can somone point me in the direction of another one that actually works? im sure ive done summit wrong.

better yet if somone could wip up a basic room with several barrels in i could take a look how u did it :p
 
all you have to do is copy and paste the 5 barrells and the other entities from the sample map. and then make copies of barrells if you want more. thats all you need to do
 
Wouldn't you also need to adjust the math counter to match your total number of barrels?
 
well yes its easy enough to say that, but what happens when u cant open the sample map file type in hammer :p

ive kinda semi got it working now anyways. 1 barrel works but the others kinda fade in when u approche them and then fade out again when you through them lol.

its a kinda kool effect think ill just leave it the way it is. thanx anyways.
 
sounds like you set their fade distances to something other then -1 and 0
 
yeah the dude sent me an e-mail it was fadeding distances that i needed to adjust.

works fine now.

thanx for the replys.
 
Ive been following the method (copy-pasted from sample map into my map, and reviewed all settings alongside the tutorial) and I've been getting the mass-spawning problem. The math-counter is set to 8, the exact number of barrels, but they begin to multiply after a few deaths, as well as blow up instantly instead of catching fire first.

Help is appreciated. Only hours left to mail this map.
 
are you sure you don't have duplicates of any of the 3 entities that make the barrel logic work? copying and pasting the 3 entities and barrels should be enough.
 
I found that I have 2 Logic_Auto and 4 Logic_Relays in my map.

The reason is that I have some of them setup as part of a Combine barrier (those plasma-wall thingies).

Is it wrong to have more than one of these in my map?
 
Sorry to dig up a very old thread, but for those who have problems with the barrels continually spawning (infinitely) after the point_template spawns them for a second time, have you tried setting the barrel respawn time to something really long? Like 999999 (0 doesn't work). When recreated the set-up from Lockdown into my map, they kept spawning, and what I think happens is this:

The first template spawns on map spawn, no problem. However, since the barrels are prop_physics_respawnable, they're told after they break to respawn. So, you blow them up, and they set off whatever delay they have to respawn themselves. However, they also tell the point_template to spawn an entire new set. So, now we've got the original set respawning and a new set about to spawn. The new template spawns, you blow them up, then they tell themselves to respawn after a certain amount of time. By this time, the original template set has respawned (not a new template), and eventually you've got two whole sets of barrels. Now, what usually happens is people want to blow them up, no? So they blow most (if not all) of them. Now, the first two templates have been destroyed, and they're telling themselves to respawn every 30 (or so) seconds, and one of them tells the point_template to spawn another set. Each time a new template is spawned, it can spawn a potentially infinite number of barrels, because they respawn every 30 (or whatever) seconds. So eventually they will multiply and multiply... causing the 4000+ barrels that some people get. Now there's only 2 solutions I've found: 1. Somehow force the players to stop blowing up the barrels (unlikely), or 2. Set the barrels to respawn in like 4 hours. (One could try using regular prop_physics as the template, but I haven't tried it yet).

This is the only logical explanation I can think of. Hope it makes sense.
 
Hmm... it makes sense, yeah... Thanks for digging it up; I've been leaving explosive barrels out of my map since I can't figure them out.
-
The only thing I wonder is, how did Valve do it in Lockdown without any problems?

There has to be a perfect way to do it... lockdown is a map like any other, and the barrels appear to work fine there, without any tweaks.
-
And a question: will it use up any bandwidth to have the barrels wait 4 hours to respawn? What I mean is, will the barrels begin to lag the server as it has to keep track of more and more barrels that are waiting to spawn?

Or does the server keep track of dead barrels and respawn times by itself, without any Net Transfer?
 
Mmm k that was kind of pointless. You don't need respawnables at all. Just regular prop_physics...
 
The dm_lockdown barrels are prop_physics_respawnable.

Are you saying that it will still work with just regular prop_physics? At least for those people who have the mass-respawn problem?
 
Back
Top