yes the idea could easily be applied to anything else. now I'm guessing the effects and sound will need to be changed accordingly, but all the code should stay similar. It would be easier, cuz almost the same, for another model. I'm thinking a vehicle model for instance, where there's intact and destroyed versions of them. like a jeep that's catching fire under gun fire to later explode. (I'm thinking of doing one like that myself ...) to only thing to change from the code is to change the model associated with the script_model to the destroyed one, instead of "removing" them from the map like I did for barrels.
I'm guessing that could work for a script_brushmodel too (the sky is the limit really). it would be little tougher in radiant tho cuz you'll need to produce both the intact and destroyed of the brushmodel. but then ... is it logic for a wall to break down under pistol fire ?? you can develop some neat ideas with trigger_damage true ... rasta had a great similar idea in his own project (Here
lol that's great. under fire, barrels takes some time to explode (to give players a chance to get out of the way) but if a barrel got hit by a nade, it's only 2 secondes till it blows. but dude, the code is there for you to modify if you wish so. so if you really want to surprise him, knock yourself out !
my code is not really commented ... so here's a little help on where to find things to modify:
- barrel respawn time : in barrelThink() - wait(120). that's 2 mins till respawn.
- damage till fire : in barrelThink() - if (self.accDamage > 80 ...). that's 80 of damage accumulation till fire
- damage till explosion : in barrelThink() - if (self.accDamage > 200 ...). that's 200 of damage accumulation till explosion
- self damage while in fire : in barrelFireDamage() - self.trig notify ("damage", 10);. that's 10 of damage each 1-3 seconds
- find fire efx in barrelFire()
- damage to other barrels when exploding : first for() of barrelExplode. you have to understand what is mathematical normalisation to understand how much damage it gives to other barrels.
- radius damage at explosion : radiusDamage(self.origin + (0,0,12), 400, 200, 30); at the end of barrelExplode(). 400 = radius, 200 = max damage (at radius = 0), 30 = min damage (at radius = max). this radius damage is somewhat bigger than of a nade.
yes he could do that, but doing different behavior for barrels then would mean producing different code for all different types.