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

Members Online

»
0 Active | 261 Guests
Online:

LATEST FORUM THREADS

»
New BF2 Mod
BF2 General

Tutorials

»
CoDUO Mapping
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
Boats in MP
Versions: You must be logged in to view history.

How to create a more realistic boat movement and add clips.

By <|WHC|>Grassy

By using the method in this tutorial you can have a moving boat where players can interact with it.
Most of the boat models don't have colmaps so they are not solid to players, which means they have to be either out
of reach of players or clips added to them. But what if the model moves? That's where this little script comes in.
It links the clips to the model so they follow it's movements. The script with this tutorial was made to try and imitate
random movement as a real boat would do on the water, it's as close as you could get without adding a rolling action
into the equation, but that was a bit beyond my scripting abilities. Maybe Version 2 will be out soon with this added.

Ok lets get to it.

In game screen shot:

Step 1:

Select your boat model you wish to use and position it on the water, make it a script_model then give it these keys and values

Key: targetname Value: jetty_boat

Step 2:

Select the texture "clip nosight" and make multiple brushes sized and shaped to fit the boat. In this example I have done the top of the bow, a base in the cockpit and four sides to stop players from walking off the boat. Once you have all the brushes located and fitting nicely select them all and right click on the 2D grid and select script_brushmodel, then while they are still all selected hit N and give them a targetname.

Key: targetname Value: boat_clip

Step 3:

That's all there is for the mapping part, now for a little addition to your map gsc. You can copy paste the script below or download the archive that contains a pk3 ready to go and a raw [download here].map file to load into the editor.

Here is the map gsc used for this tutorial. Notice I have added some water sounds to complete the scene :) That will be another tutorial coming soon on how to add randomized sounds and effects.

main() {
// lets play some background sounds
//ambientPlay("ambient_mp_brecourt");

mapsmp_load::main();

game["allies"] = "russian";
game["axis"] = "german";

game["russian_soldiertype"] = "conscript";
game["russian_soldiervariation"] = "normal";
game["german_soldiertype"] = "wehrmacht";
game["german_soldiervariation"] = "normal";

game["attackers"] = "allies";
game["defenders"] = "axis";

thread do_jettyboat();
thread add_water_sounds();

}



do_jettyboat() {

level.jettyboat = getent ("jetty_boat", "targetname"); //boat at jetty
org = (level.jettyboat.origin);

//if there are clips lets grab them and link them to the boat
clip = getentarray ("boat_clip", "targetname");

if(isdefined(clip)) {
for (i=0;i
clip[i] linkto(level.jettyboat);
}
}

if(isdefined(level.jettyboat)) {

while(1) {

// Speed of the Bobbing - Higer the Number in the ( ) = Slower Bobbing
timer = randomfloat (2) + 1;

//set up a random deviation distance
deviation = randomfloat (4) + 1;

//move the boat up, random distance from original origin, random speed, random wait
level.jettyboat moveto (org + (0,0,deviation), timer, timer*0.5, timer*0.5);

//wait a random time
wait (timer);

//reset deviation to zero then subtract the variable deviation so it will be a negative value of the up movement
devdown = 0 - deviation;

//move the boat down, random distance from original origin, random speed, random wait
level.jettyboat moveto (org + (0,0,devdown), timer, timer*0.5, timer*0.5);

//wait a random time
wait (timer);
}
}
}


add_water_sounds() {
ent0 = getent("water0", "targetname");
ent1 = getent("water1", "targetname");

if(isDefined(ent0))
ent0 playloopsound("water1");

if(isDefined(ent1))
ent1 playloopsound("water1");
}

//end of script

Well that's all folks, I hope you get a chance to make use of this in one your maps sometime.

Regards Grassy

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

»