Call of Duty 5: SP Tutorial Flare Initiation

From COD Modding & Mapping Wiki
Revision as of 02:22, 23 August 2009 by Zeroy (talk | contribs) (New page: ==Flare Initiation== The cool flare effect is accomplished by using the built-in flare system. The effect works best for a map which is set at night. '''A modified version of _flare.gsc i...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Flare Initiation

The cool flare effect is accomplished by using the built-in flare system. The effect works best for a map which is set at night.

A modified version of _flare.gsc is provided for your use in the example_ambush.zip archive, as the default one is not as modder friendly.

The flares use the vehicle system, so we'll set the flare up much like we would set up a vehicle.

To add the flare, follow the steps below:

1. Add a script_vehicle to the map. When you add the script_vehicle it will want a model. Select the model 'tag_origin'.
Add the following key value pairs:
Key: vehicletype
Value: flare
Key: script_vehiclestartmove
Value: This can be any integer value
Key: script_vehiclespawngroup
Value: This can be any integer value
Key: targetname
Value: This can be any name you wish. (I use "flare" in the example map).

***The values for both script_vehiclestartmove and script_vehiclespawngroup should be the same!***

2. Now create the flare spline/path by using vehicle nodes. The placement and use of vehicle nodes is a bit beyond the scope of this document, so if you are unfamiliar with how to place the vehicle nodes then you'll need to learn how. Feel free to use the example_map however you see fit. You can steal the flare & path directly from the map if you wish, or you can disect it and figure it out for yourself, (my recommendation!).


3. After you've created the path for the flare to travel on, you'll want to designate two points on the vehicle path for special use. The first one is when the flare will activate and the next one is when the flare will start to fade out. In the example map I've designated the node at the top of the flare’s arc as the point in which it will activate.


Select the desired node on your flare path that you wish the flare to 'activate' and enter the following key value pair:
Key: script_noteworthy
Value: flare_intro_node


4. Next, we need to set the node at which the flare will start to fade out. (in my example it's the second-to-last node in the path).


Select the desired node on your flare path that you wish the flare to start fading out and enter the following key vaule pair:
Key: script_noteworthy
Value: flare_fade_node
The next step is to create the flare's "sun" direction. The flare manipulates the sun in order to achieve its effect, so the next step is important or the shadows and lighting created by the flare won't match up to the flare's direction of travel.


5. Create a script_origin in the map and place it so that if you drew a straight line from the script_origin to the flare that it would indicate the direction that the flare should cast its shadows when it activates. (see pic below):


File:Image007.png

6. Now we have to link everything together:
a. Select the script_origin and then the flare vehicle and press W to target the script_origin to the flare
b. Select the flare vehicle and then the first vehicle node on your vehicle spline and press W to target the flare to the node.
c. Select the script_origin and give it the following key value pair:
Key: script_linkname
Value: can be any value (I've used "flare_sun_dir" in my example)
d. Select the flare vehicle and give it the following key value pair:
Key: script_linkto
Value: can be any value (I've used "flare_sun_dir" in my example)

***the script_linkto and script_linkname values must be identical!***


Okay, so the Radiant setup is done now. Next we'll move on to setting up the script and the level zone_source files.

7. The last step is to make sure you've got all the required elements in your level zone file, (.csv), and your level script file, (.gsc).
Put the following line into the .csv file. The flares.csv file is included for you in this example and includes all the assets you need to make the flares work like it does in the example map.
include,flares
Add the following line of script to your level script BEFORE the call to _load::main()
maps\_flare::main_alt( "tag_origin", undefined, "white" );
To launch the flare, call the following block of script when you want the flare to launch. Replace <targetname> with the targetname you provided for your flare in step 1.
level thread maps\_flare::flare_from_targetname( "<targetname>", 1, .7, 1, ( 0.8, 0.82, 1 ) );
level thread wait_for_bloom();
Here is the script for the wait_for_bloom function, which you'll need to place in the script:
/*------------------------------------
Flare Bloom/Whiteout
------------------------------------*/
wait_for_bloom()
{
	flag_wait( "flare_start_setting_sundir" ); 
  	VisionSetNaked( "mak_flare", 0.1 ); 
	wait(.25);
 	 VisionSetNaked( "mak", .5 );
}


I hope that this has been helpful for the people who wish to use some of these mechanics and systems that we've added to World at War. It was fun making this tutorial and I'm hoping that I'll have time to make some more in the near future. I’ve left a few things unexplained on purpose... I am a big believer in learning by example!

Feel free to contact me at: [email protected]

- Chris P