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

Members Online

»
0 Active | 102 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
Previous Page
subscribe
Author Topic: Destructible custom car
Larrabee
General Member
Since: Feb 5, 2010
Posts: 113
Last: Aug 23, 2012
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Wednesday, Aug. 25, 2010 11:28 am
Quote:
And yes, I need help with testing it, thanks for volunteering. But only if you can play it with more than one people (on LAN for example, with some of your friends)


man I'm sorry, most of my firends don't play online (I'm 49) but Im on some sniper sites and might be able to get someone there to connect to a game I could host. Need to start testing my map online anyways.. hollar and let me know!
Share |
cskiller86
General Member
Since: Nov 23, 2009
Posts: 528
Last: Oct 25, 2011
[view latest posts]
Level 6
Category: CoD4 MP Mapping
Posted: Monday, Nov. 29, 2010 08:40 am
Okay, I finally finished my custom car. It now has an interior, LODs and a destroyed version.



As you can see from the video, there are still some problems.
First, the bullet decals still don't work as they should. As a matter of fact, bullet decals don't work on any of my custom models.
Second, the shadows on the car look really bad, pixelated or something.
Third, the second car I placed in the map doesn't receive any illumination. It's not completely dark, but I don't know what's wrong. I'll try moving it around.

Also, there is a problem with the scripts... or maybe not. I've played the map with bots (Pezbot), and they are not affected by the explosion, nor do they damage the car when they shoot it.
Are the bots not counted as players or is my script wrong ?
Code:
main()
{
	rmpfx = loadfx ("explosions/vehicle_explosion_pickuptruck");
	rmptrigs = getEntArray("rmp_dmg","targetname");
	for(k=0;k<rmptrigs.size;k++)
		rmptrigs[k] thread dormp(k, rmpfx);
}

dormp(rmpnumber, rmpfx)
{
	level waittill("connected", player);

	players = getEntArray("player", "classname");
	rmpcar = getEnt("rmp"+(rmpnumber+1),"targetname");
	rmpd = getEnt("rmpdestroyed"+(rmpnumber+1),"targetname");
	rmptrig = getEntArray("rmp_dmg","targetname");

	eInflictor = self;
	eAttacker = self;
	iDamage = 1000;
	iDFlags = 0;
	sMeansOfDeath = "MOD_EXPLOSIVE";
	sWeapon = "destructible_car";
	vPoint = ( self.origin + (0,0,-1) );
	vDir = vectornormalize( self.origin - vPoint );
	sHitLoc = "none";
	psOffsetTime = 0;

	rmptotaldamage = 0;
	rmptargetdamage=100;
	rmpbroken=0;

	rmpd notsolid();
	rmpd hide();

	rmpcar show();

	for(i=0; i<players.size;i++)
	{
		players[i].playerdamage = 0;
		level endon("disconnect");
		while(!rmpbroken)
		{	
			self waittill("damage", amount, attacker, direction_vec, point, type);
			if (players[i] == attacker)
			{
				eInflictor = players[i];
				eAttacker = players[i];
				if (type == "MOD_RIFLE_BULLET" || type == "MOD_PISTOL_BULLET" || type == "MOD_MELEE" )
				amount = 3;
				players[i].playerdamage += amount;
				iprintln (players[i].name + " shot car number " + (rmpnumber+1) + ", dealing " + amount + " dmg, for a total of " + players[i].playerdamage + " dmg");
				dist = Distance(players[i].origin, rmpcar.origin);
				iprintln ("Damage type: " + type);
				iprintln ("Current distance: " + dist);
				rmptotaldamage+=amount;
				iprintln ("Total damage: " + rmptotaldamage);
				if(rmptotaldamage>rmptargetdamage)
				{
					rmpbroken=1;
					if (dist>=700)
						iDamage = 0;
					if (dist>=500 && dist<700)
						iDamage = 25;
					if (dist>=300 && dist<500)
						iDamage = 50;
					if (dist<300)
						iDamage = 500;
					players[i] finishPlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
				}
			}
		}
	}
   	self playsound("glass_break");
	PlayFX(rmpfx, self.origin );
	rmpd show();
	rmpcar delete();
	self delete();
}

As you can see from the video, the debug text appears when I shoot the car, but nothing happens when the bots shoot it.

I kept my original script because the game doesn't care who did the most damage, but who did the last.
Now, I have to add the health drain function, the fire FX when the car is low on health and also to award the player with the kill(s) if the car he destroyed kills another player(s).
Share |
tschiggen
General Member
Since: Oct 19, 2010
Posts: 122
Last: Feb 16, 2012
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Monday, Nov. 29, 2010 11:14 am
it looks really good
Share |
zeroy
General Member
Since: Nov 26, 2007
Posts: 1060
Last: Mar 12, 2014
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Monday, Nov. 29, 2010 11:29 am
cskiller86 writes...
Quote:
As a matter of fact, bullet decals don't work on any of my custom models.


This is just a material properties thing - what settings did you select in Assman when creating the material? Should be Model phong - Metal

cskiller86 writes...
Quote:

Second, the shadows on the car look really bad, pixelated or something.


Not a problem with your custom model, the shadows are not related to importing models or anything...

cskiller86 writes...
Quote:

Third, the second car I placed in the map doesn't receive any illumination. It's not completely dark, but I don't know what's wrong. I'll try moving it around.


One of the problem in COD4 when compiling reflection is that no destructable can be in the map... Place it somewhere else or place a light source right above it may fix this?

cskiller86 writes...
Quote:

Also, there is a problem with the scripts... or maybe not. I've played the map with bots (Pezbot), and they are not affected by the explosion, nor do they damage the car when they shoot it.
Are the bots not counted as players or is my script wrong ?


Why did you script this destructible car when COD4 already has the code for all this? Its not all simple but basically all you need done here is to mod the _destructible_types.gsc to add a new type (this is where you set the "parts" which for you is just 1 full model and then 1 destroyed) and then create a new mp_destructibles Prefab with clips and the following:

Quote:

"destructible_type" "your_type"
"targetname" "destructible"
"origin" "0.0 0.0 0.0"
"model" "your_model"
"classname" "script_model"


If you send me the models i can have a go.

Share |
cskiller86
General Member
Since: Nov 23, 2009
Posts: 528
Last: Oct 25, 2011
[view latest posts]
Level 6
Category: CoD4 MP Mapping
Posted: Tuesday, Nov. 30, 2010 07:29 am
Thanks for the replies, guys.

Yes, the car's body material is model phong - metal and the windows are model phong - glass.
However, the materials were exported as Lambert from Maya (in the *.model_export). Can that be a problem ?

I haven't compiled reflections in ages. Actually I only compiled them once in the beginning, long before I had this car in my map.
I'll recompile reflections without the car and see what happens.

Well, CoD4's destructible car script uses the model's tags to do certain things. For example, the hood that flies in the air when the car explodes, or the side mirrors that fall off when shot, or the windows that break. It is a pretty complex script.
So I chose to start from scratch mainly because I don't know how these tags work and how to create them.
Also, I've learned quite a few things about scripting and the way the game works by doing this. So, I think it was a good choice.

Thanks for the answers, zeroy.

LE: I took a look at the _destructible_types.gsc and it probably isn't so complicated to add a new type.
But first, I want to try and finish what I've started, and prove to myself that I can do it. If that fails, I will try it this way.
Share |
cskiller86
General Member
Since: Nov 23, 2009
Posts: 528
Last: Oct 25, 2011
[view latest posts]
Level 6
Category: CoD4 MP Mapping
Posted: Friday, Dec. 3, 2010 11:11 am
OK, I think I just hit a major problem in my endeavor.
It seems that the FXs are played on the location of the car tags.
For example, if a car's health is low enough smoke will appear at the hood, then fire. These FXs are played on a tag (called "tag_hood_fx"). This means that the FX will play on that spot on the car, no matter how the car is positioned or rotated.

Since my car doesn't have tags, I thought that I could play the FX on a certain spot depending on the car's origin, like so
Code:
PlayFX(fxname, car.origin + (15,0,0));
This would play the FX 15 units away (on the X axis) from the car's center; let's say that this is where the hood is.
However, if the car is rotated 90 degrees then I would have to play the FX at 15 units away on the Y axis (otherwise the FX will play on the side of the car, in mid-air).

The question is: is there a way to determine how the car is positioned ?

Or even better, has anyone placed tags on a model ? Is the tag the same thing as a joint in Maya ?

Hopefully someone will answer this and give me some good news. Thanks.
Share |
_INSANE_
General Member
Since: Nov 7, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 MP Mapping
Posted: Friday, Dec. 3, 2010 09:12 pm
Use vector_scale along with anglesToForward, anglesToUp, or anglesToRight.

If you need to go back, down, or left... just turn the number negative.

Code:
PlayFX(fxname, car.origin + maps\mp\_utility::vector_scale(anglesToForward(car.angles), 50));
Share |
cskiller86
General Member
Since: Nov 23, 2009
Posts: 528
Last: Oct 25, 2011
[view latest posts]
Level 6
Category: CoD4 MP Mapping
Posted: Sunday, Dec. 5, 2010 01:13 pm
Thanks, that works.

But I also have an FX that needs to have the same angles as the car. Is there any way to change the angles of an FX based on the angles of the car ?

With static FXs, I use something like this in raw/maps/createfx/mp_map_fx.gsc
Code:
ent = maps\mp\_utility::createOneshotEffect( "heli_smoke" );
ent.v[ "origin" ] = ( -149, -781.5, 124 );
ent.v[ "angles" ] = ( 270, 0, 0 );
ent.v[ "fxid" ] = "heli_smoke";
ent.v[ "delay" ] = -15;
ent.v[ "soundalias" ] = "fire_metal_large";
So I can set the angles I want. However, this isn't dynamic. Once set, the angles of the FX never change.

In my destructible script, I'm loading and playing the FX like this
Code:
fordfxfire = loadfx ("fire/bhd_fordfxfire_one");
PlayFX(fordfxfire, fordd.origin + maps\mp\_utility::vector_scale(anglesToRight(fordd.angles), 20) + maps\mp\_utility::vector_scale(anglesToUp(fordd.angles), 10));
So I tried using fordfxfire.angles = fordd.angles. I also tried spawning a script_origin and linking it to the FX. But I get the message that "int is not a field object", probably because fordfxfire is an FX ID, and not an entity.

Is there a way to dynamically change the FX angle ?

Also, is there a way to stop a looping FX ? When the car reaches 50 health, I made it so black smoke comes out from under the hood. But I cannot stop it, even if the car explodes.
I can't delete the FX itself because it's not an entity. I cannot link the FX to something else and delete or hide that something.
Any thoughts ?
Share |
Restricted Access Topic is Locked
Page
Previous 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

»