Im going to go through your code and add explanations in bold beneath each section/line.
main()
{
maps\mp\_load::main();
This is used to load some of the stock cod effects, e.g minefields
maps\mp\map_efx::main();
This will look for a file in the maps/mp folder called map_efx
thread boatbobbing();
This will load the thread called boatbobbing
}
boatbobbing()
Boatbobbing thread starts here
{
boat = getent("boat","targetname");
Gets the script_brushmodel w/ targetname "boat"
wait (randomfloat (1.5));
Generates a number between 0 and 1.5 and waits that time
org = (-64, 96, 72);
This is the origin of you script_brushmodel
timer = 3;
Speed of the bobbing cycle
while (1)
This will create a looping script
{
boat moveto (org + (0,0,500), timer, timer*0.5, timer*0.5);
This will move the boat on the z axis by 500
timer = time it takes, timer*0.5 = acceleration and decceleration
wait (timer);
Wait the length of time specified by "timer"
boat moveto (org + (0,0,-500), timer, timer*0.5, timer*0.5);
Same as above, but downwards 500
wait (timer);
Same as above
}
}
End of boatbobbing
This is where things go wrong
thread boatbobbing2();
This should be at the top of the script, inside the main() section
}
boatbobbing()
Typo, this wil certainly cause errors, change to boatbobbing2()
{
boat2 = getent("boat","targetname"); // Get the name of the script_model
wait (randomfloat (1.5)); // Generate a random Number of Seconds Between Bobbings
org = (-64, 96, 72); // Define Origin or Location of Your Boat/script_model
timer = 3; // Speed of the Bobbing - Higer Number Slower Bobbing
while (1)
{
boat2 moveto (org + (300,0,0), timer, timer*0.5, timer*0.5); // 2 is the number of units to go Above Original Location
wait (timer);
boat2 moveto (org + (-300,0,0), timer, timer*0.5, timer*0.5); // 2 is the number of units to go Below Original Location
wait (timer);
}
}
Problems are...
maps\mp\map_efx::main();
^What is that? Do you have a file called "map_efx" as this would cause errors.
Same targetname.
boat2 = getent("boat","targetname");
you cannot use 2 different names for the same targetname.
Basically, this script is telling "boat" to do 2 different things at the same time.
If you have another boat, change the targetname to "boat2"
and change the line above to
boat2 = getent("boat2","targetname");
you will also need to change the origin of the 2nd boat
org = (-64, 96, 72);
A final script should look something like this.
Code: Select all
main()
{
maps\mp\_load::main();
thread boatbobbing();
thread boatbobbing2();
}
boatbobbing()
{
boat = getent("boat","targetname");
wait (randomfloat (1.5));
org = (-64, 96, 72);
timer = 3;
while (1)
{
boat moveto (org + (0,0,500), timer, timer*0.5, timer*0.5);
wait (timer);
boat moveto (org + (0,0,-500), timer, timer*0.5, timer*0.5);
wait (timer);
}
}
boatbobbing2()
{
boat2 = getent("boat2","targetname");
wait (randomfloat (1.5));
org = (-##, ##, ##);
timer = 3;
while (1)
{
boat2 moveto (org + (300,0,0), timer, timer*0.5, timer*0.5);
wait (timer);
boat2 moveto (org + (-300,0,0), timer, timer*0.5, timer*0.5);
wait (timer);
}
}