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

Members Online

»
0 Active | 7 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 SP Mapping
CoD 4 mapping and level design for single player.
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: Moving vehicles with collmaps
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD4 SP Mapping
Posted: Friday, Feb. 26, 2010 03:45 am
Hi, everyone, I decided to work on the project Heroes 7 part 3 again. I decided to stop doing the stuff that I cannot do. There is one thing I need that requires help. I don't see a topic on this, so I have to make one. Everyone knows there is no collmaps for vehicles in cod4. I know that you need to use clips to make collmaps. The thing is, I want a moving vehicle but even it has no collmaps. When the vehicle stops there are no collmaps because originally the vehicle doesn't have one. I don't want to make a long clip for the path of the vehicle. Is there some way to use a vehicle that has collmaps already? Maybe using a prefab as a moving vehicle?

Thanks.
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD4 SP Mapping
Posted: Friday, Feb. 26, 2010 05:38 am
A similar question to this was posted already and I answered it. I'll repeat my answer:

Surround your tank model with clip brushes. Via code, locate the clips which surround your tank model and link them to the tank with the Linkto() function. Then, when you move your tank model, the clips move with it.

This is a technique I used with a COD2 mod I made over 4 years ago, and currently with my multiplayer Team Assault gametype for COD4, where I locate the clips surrounding the koth prefabs and use them to provide collision for the Team Assault objective models (that way Team Assault is compatable with any map, and the objective models are still solid).

This is a basic code to do it:

Code:
	{
		// find all level entities	
		ents = getentarray();
		
		//find all clip brushes
		clips = getentarray( "script_brushmodel", "classname" );
		for( i=0; i < ents.size; i++ )
		{
			//identify the tank model
			if( ents[i].model == "tank_model" )
			{
				tank = ents[i];
				
				//measure the distance between the tank model and any clips less than 65 units
				for( j=0; j < clips.size; j++ )
				{
					if( distance( clips[j].origin, tank.origin ) <= 65 )
						clips[j] LinkTo( tank ); // link to the tank model
				}
			}
		}
	}


Where "tank_model" is the name of your tank xmodel.

Once you've located any clip brushes which are less than 65 units to the tank model, they will be your clip brushes surrounding the tank. Link them to the tank and now, if you use the moveto() function on the tank, the clips will move with it.
Share |
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD4 SP Mapping
Posted: Friday, Feb. 26, 2010 08:22 pm
Thanks, I should have paid attention in the cod2 forum section.

Anyway, you mentioned the clip. The clip brushes need to be less than 65 units to the tank. Well, I would just create a large clip that surrounds the tank.

I am pretty sure that I can give a targetname to the clip. So I can use clip = getent("clip","targetname");. Your script is still good, but I am just narrowing it down a bit.

Also, you used the code:

ents = getentarray();

Well, I may have other entities in game so telling the game that line might not be a good idea at all. No offense, it is just I see it.

Because I am using the clip that surrounds the tank, I don't think this code applies:

Code:

//measure the distance between the tank model and any clips less than 65 units 				
for( j=0; j < clips.size; j++ ) 				{ 					
if( distance( clips[j].origin, tank.origin ) <= 65 ) 						
clips[j] LinkTo( tank ); // link to the tank model 				} 			
} 		
} 	
}


Maybe the first part before the linking will not work.

I am not saying your script is bad, I am just trying to check which ever will not make the script work.

Anyway, thanks. Hope to see some responses. :D


edited on Feb. 26, 2010 03:22 pm by sam_fisher3000
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Friday, Feb. 26, 2010 11:56 pm
This is pretty simple i have done this already in a test map. what you can do is this:


copy the clips from the vehicle of your choice from the "cod4/collmaps" folder into your map.

Place an additional brush with the texture of "origin" with the clips. Preferably where the blue box is for your vehicle.

Now select the origin brush and your clips and turn them into script_brushmodels.

Give them w/e targetname you want.

Give your vehicle a targetname of your choice.

make sure your clips are somewhere where the player cant reach within the map.

save and compile bsp.

in your script link your script_brushmodel to thel vehicle. It should look like this:

Code:

    vehicle_clips = getent( "clips","targetname" );// these are your clips with the "origin" texture  brush
    vehicle = getent( "car1", "targetname" );//your vehicle
   vehicle_clips linkto( vehicle, "tag_origin", (0,0,0), (0,0,0) );// we are telling the clips to link to the origin of the vehicle


and thats it. Your vehicle no matter where it moves will have collision :D.


Now if you want to make it kill the player because he touches the vehicle before it stops moving, then you would have to follow almost the same steps as the collision but instead of having collision you would have a trigger covering the vehicle. A new "origin" brush would have to be also added and place in there. Then you would select those 2 and turn them into a trigger_multiple.

Then give them key/values of ur choice. compile bsp.

Then in yoiur script link it to the vehicle like the collision but give ur trigger a thread to call upon. So that it will dodamage to the player, in case the player triggers it before the vehicle stops moving.

So it would look like this:

Code:

veh_col()
{
    vehicle_clips = getent( "clips","targetname" );
    vehicle = getent( "car1", "targetname" );
   vehicle_clips linkto( vehicle, "tag_origin", (0,0,0), (0,0,0) );

  vehicle_trigger = getent( "car_trigger", "targetname" );
  vehicle_trigger linkto( vehicle, "tag_origin", ( 0, 0, 0 ), ( 0, 0, 0 ) );
  vehicle_trigger thread death_upon_touching();

   flag_wait( "delete_trigger" );//i put a flag here because i believe eventually you will want to get rid of the vehicle_trigger after a certain event. Just set the flag whenever you want to get rid of the trigger.

    vehicle_trigger delete();// trigger being deleted after the flag is set.
}

death_upon_touching()
{
    self waittill( "trigger" );
    self dodamage( level.player.health + 300, level.player.origin );
}



I hope this helps you a lot. Sorry if its alot but i hope it helps. [thumbs_up]

edited on Feb. 27, 2010 12:37 am by voidsource
Share |
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD4 SP Mapping
Posted: Saturday, Feb. 27, 2010 03:25 am
Thanks! Although, there were a lot of details, it is pretty useful information. However, I don't need anything this advance unfortunately. I am just using a regular Humvee model that an AI would drive and stop.

Quote:
Place an additional brush with the texture of "origin" with the clips. Preferably where the blue box is for your vehicle.


There is a texture with an origin? I got to see this. Blue box?

Quote:
vehicle_clips = getent( "clips","targetname" );// these are your clips with the "origin" texture brush


I am pretty sure it is getentarray, not getent.


The rest is pretty advanced and is unnecessary for now. I will keep it for future reference. :D

BTW, can you or anybody create a tutorial on flags. I have tried using it but it turns out to be more complicated than I thought, even though u showed me how to use it before. Also, how about animation tutorial, a more specific one. I am just saying that having these tutorials, it would make life a whole lot easier. Just a thought.

Thanks again! [thumbs_up]

edited on Feb. 26, 2010 10:26 pm by sam_fisher3000
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Saturday, Feb. 27, 2010 05:35 am
yes there is a texture with the word "origin" on it.

Textures > tools

its in a orange color.

Quote:

Preferably where the blue box is for your vehicle.


I meant that when u place your clips around the vehicle to cover the vehicle, you should put your origin brush in the blue box of the vehicle ( aka the vehicle origin ) this way u know that when you link the clip to the vehicle everything will be in place and the clips will not be too far to the right, left, up or down.

Quote:

I am pretty sure it is getentarray, not getent.


nope. its getent, because everything is one big piece. I should know i did an entire building and 3 floors on it shows up and watnot. But i dont think that u would get an error with getentarray.
as for flags it is pretty easy. Heres a small example:

Flags are use to notify the script of certain actions or scenes to proceed or come to a halt until an event has been completed or cleared. A flag will carry a string. All flags MUST be initiated before they are set or on wait. Most of the time they are init within the " Main() " function before anything in the game starts up. So the way things go is as follow:

flag_init( "string" ); ---> flag_wait( "string" ); ----> flag_set( "string" );

there is also a flag_clear( "string" ); which is kinda like clearing the flag....think of it as deleting the flag.

flag_wait and flag_set can be place on any thread in your scripts.

so if you have a flag_wait on "thread2();" anything in the script beyond the " flag_wait( "string" ); " will not proceed unless " flag_set( "string" ); " is called. Like mentioned before, it can be called from any other thread in your scripts. So heres an example of how it would work

Code:


main()
{
.....script stuff before the _load.....

    flag_init( "car_bomb" );//our string is "car_bomb" but it can be whatever you want it to be. remember that spaces must be replace with an under score ( " _ " )

.....script continues.....

}

thread_1()
{
  .....script stuff......
   flag_wait( "car_bomb" );//nothing beyond this will happen until we set the flag of the same string. or we use flag_clear( "car_bomb" ); anywhere else on the script.

....stuff to happen after the flag has be set....

}

thread_2()
{

  .....script stuff.....

  flag_set( "car_bomb" );// we  finally set the flag and thus  thread_1 can proceed beyond its flag_wait

....more script stuff.
}



I hope this has helped cleared up about flags.

Share |
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD4 SP Mapping
Posted: Monday, Mar. 1, 2010 08:36 pm
Thanks, however, I just think there may be one problem with the clips. If AI needs to get in or out, wouldn't the clip block them and preventing them from moving, since it is a clip that blocks? Just wondering.

Thanks for the little flag tutorial. With your permission, I can post it on the tutorial section. I can change up a few things.

I got the animation to work. YAY! I just need to focus on player animations and other AI animations.

Do you guys know how to keep the actor as just one character? What I mean is that the game always have random characters. For the Marines, you can see more than one type of characters. You can see one wearing the goggle, one that has goggle on the helmet, and one that doesn't have goggles at all. I just want to know how to keep it as just one character throughout the entire map.

Anyway, thanks guys! I will try out what demonseed and voidsource said. More help is appreciated.

P.S. I don't ask this enough, but please! I need helpers! I need people to help me! I can work on this map myself but I need to lighten the load. Please, if you can find the time!



edited on Mar. 1, 2010 04:24 pm by sam_fisher3000
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Tuesday, Mar. 2, 2010 12:21 am
Quote:

hanks for the little flag tutorial. With your permission, I can post it on the tutorial section


Sure but on one condition. That i approve the stuff your gonna say on the final post. Just to make sure things are super clear.

Share |
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD4 SP Mapping
Posted: Wednesday, Mar. 3, 2010 08:17 pm
I will make the tutorial when I am actually available. I am very busy with school at the moment. Anyway, just want to restate what I was saying.

Quote:
Do you guys know how to keep the actor as just one character? What I mean is that the game always have random characters. For the Marines, you can see more than one type of characters. You can see one wearing the goggle, one that has goggle on the helmet, and one that doesn't have goggles at all. I just want to know how to keep it as just one character throughout the entire map.

Anyway, thanks guys! I will try out what demonseed and voidsource said. More help is appreciated.

P.S. I don't ask this enough, but please! I need helpers! I need people to help me! I can work on this map myself but I need to lighten the load. Please, if you can find the time!


I don't think anybody noticed this.
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD4 SP Mapping
Posted: Thursday, Mar. 4, 2010 03:32 pm
Quote:

Do you guys know how to keep the actor as just one character?


take a look at the source files for the "parking_lot" sp map. Its from pinedsman ( sorry if i mispelled it ). He specifically gave the character a certain look and watnot. Maybe you can apply the same rules into your map.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 SP 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

»