2009

Once you've executed this assignment, you can obtain a list of the
atmospheric's properties by entering this command in the MAXScript Listener:
ShowProperties atmos_fog
Also, the third line in the sample script isn't necessary for the cognitive
controller; it simply prints the result of the test in the Listener window for
debugging purposes.
Testing Another Delegate's Behavior
You might want to determine in a transition script which behavior is currently
influencing a certain delegate. Crowd provides a MAXScript-based method
for doing this. You can even check whether a particular delegate is specified
as a target within that behavior. An example would be a cocktail party scene
in which Betty avoids Harry if Harry is seeking Sally. But if Harry is avoiding
Sally, then Betty will seek Harry.
The following example script is taken from the sample file party.max, which
you can find in the Biped download available on
http://www.autodesk.com/3dsmax8-docsthis page, under 3ds Max 8 Tutorials
Scene and Support Files > Specialized. The scene uses a more complex scenario
than the example described in the previous paragraph. Following is an
overview, but to fully understand the setup, you should examine the scene.
Study, in particular, the behavior assignments and cognitive controllers, which
use a total of eight different transition scripts.
Six delegates are confined in a "room" defined by four grids, using a Wall Repel
behavior. Delegates 1, 2, 3, and 5 simply wander at random during the
simulation. However, delegate 4 uses a cognitive controller (cc1) that tells it
to start wandering, and then switch to one of three Avoid behaviors if members
of one of three arbitrary pairs of delegates come within 50 units of each other.
Each of the Avoid behaviors targets a different group of three delegates, two
of which include delegate 2. Delegate 6 is assigned a second cognitive controller
(cc2) that uses the following script to tell it to switch to an Avoid behavior if
delegate 4 is avoiding delegate 2. The heart of the script is this line in function
transfunc4:
NOTE See the online User Reference for this sample code.
Load the file, press F11 to open the Listener window, and then solve. The
Listener window displays a message whenever delegate 4 is found to be
avoiding delegate 2.
You can use this script as is in your own simulations to check for whether one
delegate is avoiding a second by substituting the delegates' names in the above
Crowd Animation User Interface | 4863