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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: driving halftracks in mp!
aufklarer
General Member
Since: Sep 4, 2005
Posts: 83
Last: Jul 3, 2006
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, Jun. 18, 2006 09:26 am
hey i was looking for new ideas for making maps, and i was wondering since it was possible to have planes fly by. if it was possible to have halfttacks driving slowly on a map, and if possible to be able to sit in them... my idea it to make a map where you simulate an armored attack, so you have 5 or 6 halftacks driving toward the enemy tenches in an open field, and the players could sit in them and shoot from there, or walk behind them. if this could work it would be awesome not?

can someone tell me how to do this? thanks!!
Share |
kav
General Member
Since: Apr 26, 2006
Posts: 24
Last: Jun 28, 2006
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Jun. 18, 2006 10:44 am
im no expert to scripting but i have got flying stukas to work in my map therefore i think u should deffinatly be able to get them to move however i dont think u can sit in them. try just following the flying stukas tutorial and replace with halftrack models good luck
Share |
aufklarer
General Member
Since: Sep 4, 2005
Posts: 83
Last: Jul 3, 2006
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, Jun. 18, 2006 10:55 am
i know there are halftracks with open doors, but those dont drive i think, maybe i can get players to jump in them from a ramp that is at spawn, next to each halftrack...
Share |
aufklarer
General Member
Since: Sep 4, 2005
Posts: 83
Last: Jul 3, 2006
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, Jun. 18, 2006 12:43 pm
well i followed the stuke tutorial, but i have some issues. i placed a scriptmodel of a xmodel/vehicle_mg_halftrack_woodland on my map and gave it sript origins like in tut. i also gave it a targetname of "sdkfz1" but its hard to get the .gsc file right.

here is the stuka .gsc:

main()
{

level thread planes();
}

planes()
{
level.PlaneSpeed = 3.5;

stuka1 = getent ("stuka1","targetname");


temp = getent (stuka1.target,"targetname");
stuka1.dest = temp.origin;
stuka1.start = stuka1.origin;
stuka1 hide();

wait 2;

while (1)
{
stuka1 thread plane_flyby("stuka_flyby");
wait .15;

wait 60;
}
}


plane_flyby(sound)
{
// If you specified a sound to play then play it
if (isdefined (sound))
self playsound (sound);

wait 15;

self show();

self moveto(self.dest, level.PlaneSpeed, 0.1, 0.1);

wait level.PlaneSpeed;

self hide();
self.origin = self.start;
}

the problem is to get it to work for my halftrack, does anyone know what i have to change? i also called the .gsc file "tanks.gsc" instead of "planes.gsc"
and in my "mapname.gsc" i added this line:"maps\mp\tanks::main(); " instead of "maps\mp\planes::main(); "
Share |
Tridon
General Member
Since: Jan 25, 2006
Posts: 232
Last: Nov 28, 2010
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Jun. 18, 2006 08:48 pm
Your mapname.gsc looks fine and this is how I did it with the Opel trucks:
Code:
main() 
{ 

level thread trucks(); 
} 

trucks() 
{ 
level.TruckSpeed = 6.5; 

opel1 = getent ("opel1","targetname"); 

temp = getent (opel1.target,"targetname"); 
opel1.dest = temp.origin; 
opel1.start = opel1 .origin; 
opel1 hide(); 

wait 2; 

while (1) 
{ 
opel1 thread truck_driveby("opel1_driveby"); 
wait 30;
} 
} 


truck_driveby(sound) 
{ 
// If you specified a sound to play then play it 
if (isdefined (sound)) 
self playsound (sound); 

wait 15; 

self show(); 

self moveto(self.dest, level.TruckSpeed, 0.1, 0.1); 

wait level.TruckSpeed; 

self hide(); 
self.origin = self.start; 
}

I named mine trucks.gsc. You can compare the plane.gsc to my .gsc to see what changes I made and substitute yours in. It will only travel in a straight line from a-->b, so make sure your surface is flat. What I noticed though is, even if the model is solid with a collmap, it isn't so once it's a scrpit_model. I could walk right through my truck model, vehicle_opel_blitz_woodland_static, which also has a collmap. I tested it by adding it a misc_model to my map and it was solid, but as a script_model, it's not.
Share |
103kill
General Member
Since: Dec 2, 2004
Posts: 82
Last: Jun 24, 2009
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Jun. 19, 2006 05:31 am
I had encountered this problem before back in CoD. What I did was to model the sp version of vehicle nodes with script_models to make a path for the vehicle.

What I did with a halftrack (it worked pretty well) was to make a script_model halftrack and a script_brushmodel out of clip and an origin brush that matched that of the halftrack. I connected the brushmodel to the script_model, then the script_model to the first origin, then each origin to the next.

Here's a picture of the map setup



In the top right (not supposed to be raised, I just moved it up to show the linking - make sure you match up the brushmodel and script_model origins exactly) is the script_brushmodel, its target is the script_model under it, and that targets the script_model "path nodes" along the road, which are pointed to each other in the turns.

Here's the script:

Code:
main()
{
	level thread vehicles_start();
}

// *********************************************************
// Overall setup for one vehicle:
// 1 script_brushmodel clip connected to
// 1 script_model vehicle, which is connected to
// the first script_origin pathnode, which is
// connected to more of them and so on and so forth...
//
// the script_noteworthys of the script_origins must match
// the targetname of the script_brushmodel, and make sure
// to put the origin brush of your script_brushmodel on the
// origin of the script_model
//
// finally, in order to make turns, each script_origin must
// be angled in the direction of the next one, and the first node
// in the path must be directly in front of the vehicle (no turns yet)
//
// This script is designed for multiple vehicles with 
// multiple speeds
// *********************************************************


vehicles_start()
{
	halftrack_clip = getent("halftrack", "targetname"); //a brushmodel clip
	halftrack_clip thread init(10, 1); // 1st # = speed, 2nd # = turning speed

	// use the above 2 lines or the format below as an example for adding more vehicles
	//
	// [script name for vehicle] = getent([script_brushmodel targtname], "targetname");
	// [script name for vehicle] thread init([speed], [turning speed]);
}

init(speed, rotatespeed)
{

	drivenodes = getentarray(self.targetname, "script_noteworthy"); // here we are using script_origins just like vehicle nodes
	self thread drive(speed, rotatespeed, drivenodes); // remember, self is still the clip here

}

drive(speed, rotatespeed, drivenodes) // drivenodes is the # of nodes or, subsequently, for loops
{
	
	temp = getent(self.target, "targetname"); // the vehicle
	vehicle = getent(self.target, "targetname");

	for(i=1; i<drivenodes.size; i++)
		{
			temp2 = getent(temp.target, "targetname"); 	 // the next node in the path
			
			// start move
			self moveto(temp2.origin, speed, .2, .2); 	 // the clip
			vehicle moveto(temp2.origin, speed, .2, .2);     // the vehicle
			wait speed; 					 //give the game time to catch up
			// end move
			
			// determine if rotating is necessary
			if (self.angles != temp2.angles) 
			{
				// start rotate
				self rotateto(temp2.angles, rotatespeed, .1, .1);
				vehicle rotateto(temp2.angles, rotatespeed, .1, .1);
				wait rotatespeed;
				// end rotate
			}

			temp = temp2;	 //leapfrog the node

		}
}


You can call it from mapname.gsc

Hope that helps

Cheers
Share |
aufklarer
General Member
Since: Sep 4, 2005
Posts: 83
Last: Jul 3, 2006
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Jun. 19, 2006 08:28 am
cool, thanks alot guys for the precious info, so when using halftracks you have to call the .gsc, halftracks.gsc? i called mine tanks.gsc, that prob why it didnt work... also if players sit in, or on the moving brushes, will they be steady or will it be shaky like when u jumped on the hood of a moving jeep in uo? because i want players to be able to shoot... and i guess its not possible to place a mg42 on top of the halftrack, and that moves along with it? thank you!!
Share |
aufklarer
General Member
Since: Sep 4, 2005
Posts: 83
Last: Jul 3, 2006
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Jun. 19, 2006 11:07 am
here is my halftracks.gsc file, i used tridons file as an example, but when i load my map to see if it works, it crashes...
and for 103kill's method, if i leave the back of the scrip_brushmodel open then players could jump inside from behind, through the doors, this could be a sollution for not having ramps next to the halftrack, not?


main()
{

level thread halftracks();
}

halftracks()
{
level.halftrackSpeed = 6.5;

sdkfz1 = getent ("sdkfz1","targetname");

temp = getent (sdkfz1.target,"targetname");
sdkfz1.dest = temp.origin;
sdkfz1.start = sdkfz1 .origin;
sdkfz1 hide();

wait 2;

while (1)
{
sdkfz1 thread tank_move("tank_01_move");
wait 30;
}
}


tank_move(sound)
{
// If you specified a sound to play then play it
if (isdefined (sound))
self playsound (sound);

wait 15;

self show();

self moveto(self.dest, level.halftrackSpeed, 0.1, 0.1);

wait level.halftrackSpeed;

self hide();
self.origin = self.start;
}

my targetname is "sdkfz1", and the sound i want for it is "tank_01_move" did i do something wrong?
Share |
Slipknot14
General Member
Since: Feb 23, 2005
Posts: 109
Last: Sep 4, 2012
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Monday, Jun. 19, 2006 01:00 pm
I think I find an easier way to move the vehicles. I can't test it because I'm not at my computer[biggrin].
So: Make a simple script_model for vehicle(I don't know the models name but there is some models that's wheels moving, use that!!! I see them on a multi player map) then press N: targetname:movingveh
Then Make the vehicle of metal clip. And right click>script>brushmodel, then press N: targetname:movingvehclip
The map is ready.
Now the script, something like this:

main()
{

level thread movingvehicle();
level thread movingvehicleclip();
}

movingvehicle()
{
vehicle1 = getent ("movingveh ", "targetname”);
while (1)
{
vehicle1 movez[!or something other axis!] (x, x, x, x);
vehicle1 waittill ("movedone”);
wait (4);
vehicle1 movez[!or something other axis!] (y, y, y, y,);
vehicle1 waittill ("movedone”);
//and more, more moving if you need
}
}


movingvehicleclip()
{
vehicle1clip = getent ("movingvehclip ", "targetname”);
while (1)
{
vehicle1clip movez[!or something other axis!] (x, x, x, x);
vehicle1clip waittill ("movedone”);
wait (4);
vehicle1clip movez[!or something other axis!] (y, y, y, y,);
vehicle1clip waittill ("movedone”);
//and more, more moving if you need
}
}

You need to give the same coordinates for the clip. And if you need MG for it you can Make a new thread with the MG's script model.
You can make rotatings and sound effects for this. I think it's work:)
Share |
aufklarer
General Member
Since: Sep 4, 2005
Posts: 83
Last: Jul 3, 2006
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, Jun. 19, 2006 07:55 pm
thanks slipknot, i tried your method, but when i load the map cod2 crashes, am i supposed to enter coordinates where you placed the x x x x and y y y y?

Quote:
vehicle1 movez[!or something other axis!] (x, x, x, x);
vehicle1 waittill ("movedone”);
wait (4);
vehicle1 movez[!or something other axis!] (y, y, y, y,);
vehicle1 waittill ("movedone”);
//and more, more moving if you need
}
}
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

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

»