Call of Duty 4: Bobbing Models: Difference between revisions

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
(New page: Image:Nutshell.png This tutorial shows how to create 'bobbing' models in water to give a floating movement impression. I got the script from a COD2 tutorials by ''BR3NT'' == In Radia...)
 
Line 19: Line 19:
obj2 = getent("bobbing_obj2","targetname"); // Get the name of the script_model
obj2 = getent("bobbing_obj2","targetname"); // Get the name of the script_model


wait (randomfloat (1.5)); // Generate a random Number of Seconds Between Bobbings
wait (randomfloat (1.5)); // Generate a random Number of Seconds Between Bobbings


org1 = (-83, -895, 688); // Define Origin or Location of Your Boat/script_model
org1 = (-83, -895, 688); // Define Origin or Location of Your Boat/script_model
org2 = (29, -897.1, 683); // Define Origin or Location of Your Boat/script_model
org2 = (29, -897.1, 683); // Define Origin or Location of Your Boat/script_model
timer = 1; // Speed of the Bobbing - Higer Number Slower Bobbing
timer = 1; // Speed of the Bobbing - Higer Number Slower Bobbing


while (1)
while (1)

Revision as of 17:19, 16 October 2008

This tutorial shows how to create 'bobbing' models in water to give a floating movement impression. I got the script from a COD2 tutorials by BR3NT


In Radiant

In Script

  • Create a new file under /raw/maps/mp/ called _bobbing_obj.gsc and have the following in:
main()
{
  thread bobbing_think();

bobbing_think()
{
	obj1 = getent("bobbing_obj","targetname"); 	// Get the name of the script_model
	obj2 = getent("bobbing_obj2","targetname"); // Get the name of the script_model

	wait (randomfloat (1.5)); // Generate a random Number of Seconds Between Bobbings

	org1 = (-83, -895, 688); // Define Origin or Location of Your Boat/script_model
	org2 = (29, -897.1, 683); // Define Origin or Location of Your Boat/script_model
	timer = 1; // Speed of the Bobbing - Higer Number Slower Bobbing

	while (1)
	{
		obj1 moveto (org1 + (0,0,2), timer, timer*0.5, timer*0.5); // 2 is the number of units to go Above Original Location
		obj2 moveto (org2 + (0,0,-1), timer, timer*0.5, timer*0.5);
		wait (timer);
		obj1 moveto (org1 + (0,0,-2), timer, timer*0.5, timer*0.5); // 2 is the number of units to go Below Original Location
		obj2 moveto (org2 + (0,0,1), timer, timer*0.5, timer*0.5);
		wait (timer);
	}
}

In your main mp GSC, after maps\mp\_load::main(); add this line:

maps\mp\_bobbing_obj::main();

Now, add this to your Zone File:

rawfile,maps/mp/_bobbing_obj.gsc

Compile and test!


--Zeroy. 14:18, 16 October 2008 (UTC)