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

Members Online

»
0 Active | 9 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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 subscribe
Author Topic: Explodable Tanker
Vistrum
General Member
Since: Jan 2, 2007
Posts: 146
Last: Mar 12, 2010
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Thursday, May. 29, 2008 12:26 am
I have used the tutorial for explosive models to create this...

Now the only problem I have is I would like to replace the exploded tanker with a new model..

Code:

main()
{
models = getentarray("explodable_truck", "targetname");
if (models.size > 0)
{
level.breakables_fx["explode"] = loadfx( "explosions/tanker_explosion" );
}

level.barrelExpSound = "explo_metal_rand";

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

explodable_truck_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_truck_explode();
}
}
}
}

explodable_truck_explode()
{ 
Self = getentarray("explodable_truck", "targetname");

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

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

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


self delete();
} 



I've tried using

Code:

self setmodel("vehicle_tanker_truck_d");


and even adding a script_origin to place the destroyed model after the tanker is exploded...


Any help that you can offer would be greatly appreciated!
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD4 MP Mapping
Posted: Thursday, May. 29, 2008 03:42 pm
Do you get an error message or something?
In the first script my guess is the truck simply disappears.
Where did you place that second script part in your script?


Setmodel should work, as far as I know.
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: Thursday, May. 29, 2008 05:28 pm
Would you not find it easier to use script_exploders to create this effect? then just script the fx.

Much easier.
Share |
Vistrum
General Member
Since: Jan 2, 2007
Posts: 146
Last: Mar 12, 2010
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Thursday, May. 29, 2008 11:17 pm
Well the thing is, Setmodel doesnt work unless you have something like:

Code:

self setmodel("vehicle_tanker_truck_d");


Unless you include "self", CoD4 gets a script compile error saying "unknown function: setmodel"

So I tried scripting it in like this:

Code:

other = getentarray("exploded_truck", "targetname"); //This being the script_origin

//And then at the end right after "self delete();"

other setmodel("vehicle_tanker_truck_d");


but when I set it up this way, CoD4 says:

"Array is not an entity"


Final code looked something similar to this:


main()
{
models = getentarray("explodable_truck", "targetname");
if (models.size > 0)
{
level.breakables_fx["explode"] = loadfx( "explosions/tanker_explosion" );
}

level.barrelExpSound = "explo_metal_rand";

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

explodable_truck_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_truck_explode();
}
}
}
}

explodable_truck_explode()
{
Self = getentarray("explodable_truck", "targetname");
other = getentarray("exploded_truck", "targetname");

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

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

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


self delete();
other setmodel("vehicle_tanker_truck_d");
}







Rasta, I really don't know. I havent really looked at script_exploders yet... But, I figure that I need to improve my scripting skills, so I'm going to try to get this working. If it doesnt, I'll look into script_exploders.
Share |
COLMAC
General Member
Since: Sep 15, 2006
Posts: 914
Last: Jan 27, 2012
[view latest posts]
Level 7
Category: CoD4 MP Mapping
Posted: Thursday, May. 29, 2008 11:34 pm
did you put the vehicle_tanker_truck_d in the map, as a script_model to your truck that your blowing up ?
Share |
Vistrum
General Member
Since: Jan 2, 2007
Posts: 146
Last: Mar 12, 2010
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Friday, May. 30, 2008 12:39 am
No I did not...

Though, in the exploding barrels script you dont have to place the barrel pieces in the map in order for them to load, all you have to do is include it in your map's .csv file. I figured I'm doing something very similar with this, so it should work the same way.
Share |
marcp22
General Member
Since: May 14, 2005
Posts: 76
Last: Jul 15, 2008
[view latest posts]
Level 3
Category: CoD4 MP Mapping
Posted: Friday, May. 30, 2008 04:23 am
see if this works

Code:
main()
{
PreCacheModel("vehicle_tanker_truck_d");

models = getentarray("explodable_truck", "targetname");
if (models.size > 0)
{
level.breakables_fx["explode"] = loadfx( "explosions/tanker_explosion" );
}

level.barrelExpSound = "explo_metal_rand";

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

explodable_truck_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_truck_explode();
}
}
}
}

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

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

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


self setmodel("vehicle_tanker_truck_d");
} 


edited on May. 30, 2008 12:24 am by marcp22
Share |
Restricted Access Topic is Locked 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

»