Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 74 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page Next Page
subscribe
Author Topic: [TUTORIAL] exploding barrels - FlesyM's way
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 9, 2006 09:25 pm
@ average
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)

@andylegate
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 ! [thumbs_up]
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.

@average (again)
yes he could do that, but doing different behavior for barrels then would mean producing different code for all different types.
Share |
Mystic
General Member
Since: Apr 10, 2004
Posts: 6147
Last: Apr 15, 2018
[view latest posts]
Level 10
Forum Moderator
Im a fan of MODSonair
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 9, 2006 09:35 pm
I have made the topic sticky untill an admin decides whether to add it to the tutorials or another moderator decides to make the topic un sticky.

Nice work.
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Sunday, Jul. 9, 2006 09:41 pm
Rasta writes...
Quote:
I have made the topic sticky untill an admin decides whether to add it to the tutorials or another moderator decides to make the topic un sticky.

Nice work.

thx bud ! [thumbs_up]
Share |
King_Dingeling
General Member
Since: Nov 21, 2005
Posts: 55
Last: Nov 27, 2008
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Monday, Jul. 10, 2006 10:08 am
Damn thats great
YOU ARE THA SH**


edited on Jul. 10, 2006 06:17 am by King_Dingeling
Share |
veef
General Member
Since: Apr 25, 2006
Posts: 1258
Last: Aug 29, 2006
[view latest posts]
Level 8
Category: CoD2 MP Mapping
Posted: Tuesday, Jul. 11, 2006 12:36 am
Rasta writes...
Quote:
I have made the topic sticky untill an admin decides whether to add it to the tutorials or another moderator decides to make the topic un sticky.

Nice work.
I will leave it stuck but i vote for addition to the tutorials.
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Thursday, Aug. 3, 2006 02:14 am
here's a little update. if an admin could edit my first post, it would be cool. I've found a way to make a barrel prefab instead of having to redo the clip and trigger each time you want a new barrel. it also prevents from having to remember how many barrels there is a the map when you are adding a new one... (that was a huge bummer). all in all, I think it simplifies this.

aight the script itself stays the same. it's the radiant work that changes :

-----------------------
RADIANT WORK

- start a new .map, this will become the barrel prefab, so save accordingly in the map_source/prefabs folder.

- make a script_model with the xmodel of any barrel you wish to use. do not give it a targetname.

- make a trigger_damage that surrounds the barrel closely. tick the box "MELEE_NO" so it doesn't work by bashing the barrel (obviously). enter the following value :

"targetname" "barrel_trig"

- select the trigger first then the barrel. press 'w' (to merge entities). if you've done it correctly, the barrel will have "auto1" has a targetname and the trigger will have "auto1" has a target. you will also see a red line in 3d window indicating that the targetting works correctly.

- make a script_brushmodel out of a clip brush that surrounds the barrel (same size of the trigger) and an origin brush that has its origin coincide with the origin of the script_model (the blue box at the bottow). this is to prevent player to walk thought the barrel. similarly to the trigger, enter the following value :

"targetname" "barrel_clip"

- exactly like the trigger select the brushmodel first (alt+shift) and then the barrel. press 'w'. the brushmodel now targets the barrel just like the trigger does.

- save that .map. whenever you want a barrel in your map, insert this prefab in. (r-click 2d window - misc/prefab)

and that's it for radiant. copy as many barrel prefabs as you wish. try putting them close to each other for cool effects.
------------

the rest of the tut is the same
[thumbs_up]
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Thursday, Aug. 3, 2006 03:46 am
here's the exploding barrel prefab (if you don't feel like making your own).
LINK

so all you need is this prefab and the script file. [tongue]

-----
to be quite honest I was surprised this is actually working ... I thought at first that there would a prob because all barrels have the same targetname. meaning all triggers and clips targets all barrels in the map. normal behavior should be : shout one barrel, they all explode. but it works ... i dumped a few prefabs in a test map and it works. the only way I could explain that is that the compile of prefabs is a lot more than I first thought. it seems that many identical entities in map are unique if contained in a prefab at compile... so even tho one trigger targets in theory all entities named "auto1" in the map, those contained in a prefab will target the one inside the same prefab only... as if the compiler actually makes the difference between prefab and map entities ?

I don't know about you ... but to me that opens a WHOLE LOT of scripting possibilities. for instance, that would make rotating doors and scripted breaking windows that much more easy to do.

edited on Aug. 3, 2006 12:09 am by FlesyM

edited on Aug. 3, 2006 12:13 am by FlesyM
Share |
Filbert
General Member
Since: Jan 24, 2005
Posts: 869
Last: Oct 21, 2009
[view latest posts]
Level 7
MODSCON
Category: CoD2 MP Mapping
Posted: Thursday, Aug. 3, 2006 05:05 am
FlesyM writes...
Quote:
to be quite honest I was surprised this is actually working ... I thought at first that there would a prob because all barrels have the same targetname. meaning all triggers and clips targets all barrels in the map. normal behavior should be : shout one barrel, they all explode. but it works ... i dumped a few prefabs in a test map and it works...so even tho one trigger targets in theory all entities named "auto1" in the map, those contained in a prefab will target the one inside the same prefab only... as if the compiler actually makes the difference between prefab and map entities ?


Are you sure it isn't changing the "auto1" to "auto2" and so on, I know it does that if you copy them without making a prefab.
Share |
FlesyM
General Member
Since: Jul 24, 2005
Posts: 399
Last: Jan 24, 2008
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Thursday, Aug. 3, 2006 05:42 am
no because all reference the same .map. it has to do with the prefab system.
Share |
MistaObvious
General Member
Since: Jul 5, 2006
Posts: 26
Last: Aug 3, 2006
[view latest posts]
Level 2
Category: CoD2 MP Mapping
Posted: Thursday, Aug. 3, 2006 01:33 pm
Haven't had a chance to try this yet, but this will save a bunch of time for me and the guys in my clan who're mapping actively. Thanks a bunch for the update!
Share |
Restricted Access Topic is Locked
Page
Previous Page Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»