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

Members Online

»
0 Active | 120 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 4
Category: CoD4 MP Mapping
CoD 4 mapping and level design for multiplayer.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: How to- explosive_models
kmabigtime
General Member
Since: Jan 23, 2008
Posts: 162
Last: Apr 22, 2008
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Sunday, Apr. 20, 2008 05:31 am
I wanted to make fire extinguishers & propane tanks into explosives, so this is what I came up with..If u need to have the model clipped then you will need to make it a prefab, if no clip is nessessary, then just adding the model to your map will work..

To make the prefab: Open radiant to a new map, add the model you wish to use, make it a script_model with key: targetname, value: explodable_model & check the the 2 no shadow boxes..Unselect it.
Then clip it & make the clip a script_brushmodel & I check the dyna path box..Unselect it.
Now you need select the model first, then the clip & press W..
Make sure you line align the blue box of the model to (0,0,0) on the grid, then save in your prefab folder...

If no clip is nessessary (as in something small, like the fire extinguisher), just add the model directly to your map, make it a script_model with key: targetname, value: explodable_model.

Now here is the script to make it work:
main()
{
models = getentarray("explodable_model", "targetname");
if (models.size > 0)
{
level.breakables_fx["explode"] = loadfx( "explosions/grenadeexp_metal" );
}

level.barrelExpSound = "explo_metal_rand";

for(i = 0; i < models.size; i++)
{
models thread explodable_model_think();
}
}

explodable_model_think()
{
//targeted brushmodels take priority over proximity based breakables - nate
if (isdefined(self.target))
{
targ = getent(self.target,"targetname");
if(targ.classname == "script_brushmodel")
{
self.remove = targ;
}
}
accumulate = 40;
threshold = 0;
dmg = 0;

self setcandamage(true);
while(1)
{
self waittill("damage", amount, other);
if (amount >= threshold)
{
dmg += amount;
if (dmg >= accumulate)
{
self thread explodable_model_explode();
}
}
}
}

explodable_model_explode()
{
Self = getentarray("explodable_model", "targetname");

if (isdefined (self.remove))
{
self.remove delete();
}

if(isdefined(self))
{
origin = self getorigin();
range = 200;
maxdamage = 200;
mindamage = 1;

self playsound (level.barrelExpSound);
playfx(level.breakables_fx["explode"], origin);
radiusDamage(origin, range, maxdamage, mindamage);

self delete();
}

}


The maxdamage, range, & type of grenade blast used for the explosion can be adjusted to whatever you want...

I hope this is useful...

 
kmabigtime aka [aSu]BigTime! (asuclan.com)




edited on Apr. 20, 2008 01:48 am by kmabigtime
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: CoD4 MP Mapping
Posted: Monday, Apr. 21, 2008 05:46 pm
You script probably should look like
Code:
models thread [i] explodable_model_think();


But to be sure repost your code using the code box

Code:
[code] stuff here [ /code]


edited on Apr. 21, 2008 01:47 pm by Rasta
Share |
kmabigtime
General Member
Since: Jan 23, 2008
Posts: 162
Last: Apr 22, 2008
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Monday, Apr. 21, 2008 05:59 pm
Yes, I noticed that..will do..

edited on Apr. 21, 2008 02:00 pm by kmabigtime
Share |
kmabigtime
General Member
Since: Jan 23, 2008
Posts: 162
Last: Apr 22, 2008
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Monday, Apr. 21, 2008 08:18 pm
I wanted to make fire extinguishers & propane tanks into explosives, so this is what I came up with..If u need to have the model clipped then you will need to make it a prefab, if no clip is nessessary, then just adding the model to your map will work..

To make the prefab: Open radiant to a new map, add the model you wish to use, make it a script_model with key: targetname, value: explodable_model & check the the 2 no shadow boxes..Unselect it.
Then clip it & make the clip a script_brushmodel & I check the dyna path box..Unselect it.
Now you need select the model first, then the clip & press W..
Make sure you line align the blue box of the model to (0,0,0) on the grid, then save in your prefab folder...

If no clip is nessessary (as in something small, like the fire extinguisher), just add the model directly to your map, make it a script_model with key: targetname, value: explodable_model.

Now here is the script to make it work:
Code:
main()
{
models = getentarray("explodable_model", "targetname");
if (models.size > 0)
{
level.breakables_fx["explode"] = loadfx( "explosions/grenadeexp_metal" );
}

level.barrelExpSound = "explo_metal_rand";

for(i = 0; i < models.size; i++)
{
models[i] thread explodable_model_think();
} 
}

explodable_model_think()
{
//targeted brushmodels take priority over proximity based breakables - nate
if (isdefined(self.target))
{
targ = getent(self.target,"targetname");
if(targ.classname == "script_brushmodel")
{
self.remove = targ;
}
}
accumulate = 40;
threshold = 0;
dmg = 0;

self setcandamage(true);
while(1)
{
self waittill("damage", amount, other);
if (amount >= threshold)
{
dmg += amount;
if (dmg >= accumulate)
{
self thread explodable_model_explode();
}
}
}
}

explodable_model_explode()
{ 
Self = getentarray("explodable_model", "targetname");

if (isdefined (self.remove))
{
self.remove delete();
} 

if(isdefined(self))
{
origin = self getorigin();
range = 200;
maxdamage = 200;
mindamage = 1;

self playsound (level.barrelExpSound);
playfx(level.breakables_fx["explode"], origin);
radiusDamage(origin, range, maxdamage, mindamage);

self delete();
} 

}


The maxdamage, range, & type of grenade blast used for the explosion can be adjusted to whatever you want...

I hope this is useful...


kmabigtime aka [aSu]BigTime! (asuclan.com)


edited on Apr. 21, 2008 04:19 pm by kmabigtime
Share |
HarkoninVSC
General Member
Since: Jan 25, 2008
Posts: 294
Last: Apr 24, 2008
[view latest posts]
Level 5
Category: CoD4 MP Mapping
Posted: Monday, Apr. 21, 2008 09:23 pm
Also if you want interchangeable FX I would use this entry;

Code:

if(isdefined(self.script_fxid) self.fx = loadfx =(self.script_fxid);


instead of

Code:

level.breakables_fx["explode"] = loadfx( "explosions/grenadeexp_metal" );


and add a key/value of;
script_fxid/fxname

You can use the same concept for the sound.
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Monday, Apr. 21, 2008 09:26 pm
if(isdefined(self.script_fxid) self.fx = loadfx =(self.script_fxid);

wont work
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Monday, Apr. 21, 2008 09:37 pm
Code:
<br />
main()<br />
{<br />
	level.fx_barrel_explode = loadfx("explosions/grenadeexp_metal");<br />
<br />
	models = getentarray("explodable_model", "targetname");<br />
	for(i=0;i<models.size;i++)<br />
		models[i] thread explodable_model_think();<br />
}<br />
<br />
explodable_model_think()<br />
{<br />
//targeted brushmodels take priority over proximity based breakables - nate<br />
	targ = undefined;<br />
<br />
	if (isdefined(self.target))<br />
	{<br />
		targ = getent(self.target,"targetname");<br />
		if(targ.classname == "script_brushmodel")<br />
			self.remove = targ;<br />
	}<br />
<br />
	self setcandamage(true);<br />
	self.maxhealth = 80;<br />
	self.health = self.maxhealth;<br />
	while(1)<br />
	{<br />
		self waittill("damage", amount, other);<br />
		if(self.health <= 0)<br />
			break;<br />
	}<br />
	self thread explodable_model_explode();<br />
}<br />
<br />
explodable_model_explode()<br />
{<br />
	if(isdefined(self.remove))<br />
		self.remove delete();<br />
<br />
	range = 200;<br />
	maxdamage = 200;<br />
	mindamage = 1;<br />
<br />
	self playsound("explo_metal_rand");<br />
	playfx(level.fx_barrel_explode, self.origin);<br />
	radiusDamage(self.origin, range, maxdamage, mindamage);<br />
<br />
	self notSolid();<br />
	self setContents(0);<br />
	self hide();<br />
	wait 5; // so the sound finishes<br />
	self delete();<br />
}<br />
Share |
HarkoninVSC
General Member
Since: Jan 25, 2008
Posts: 294
Last: Apr 24, 2008
[view latest posts]
Level 5
Category: CoD4 MP Mapping
Posted: Monday, Apr. 21, 2008 10:16 pm
Darn typos!

Code:

if(isdefined(self.script_fxid) self.fx = loadfx(self.script_fxid);


Code:

playfx(self.fx, self.origin);


edited on Apr. 21, 2008 06:19 pm by HarkoninVSC
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: CoD4 MP Mapping
Posted: Tuesday, Apr. 22, 2008 06:23 am
kmabigtime, how would you like me to post up the tutorial? shall i use your original post or change the code for the updated versions (with permission of there authors obviously)
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Tuesday, Apr. 22, 2008 06:41 am
oh lol, didnt realize it was a tut, though he wanted some help on it

you dont need to tick DYNAMICPATH for the brushmodel (never used it, no idea what it does)

and only have NO_STATIC_SHOW ticked for the script_model, that way players that have shadows on will see a shadow
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»