2009
Each state can have any number of incoming and outgoing transitions.
Specify different transition conditions for each to create as complex a
state diagram as necessary.
Next, use the State Transition dialog to define a conditional for each
transition.
15 Right-click a transition line.
16 In the
State Transition dialog on page 4861, enter the name of the transition
condition, and then click the Edit MAXScript button.
17 Use the MAXScript editor window to enter or load a script that defines
the condition or conditions under which the transition is to occur.
Typically, this is a function that tests a condition and returns 1 (if true)
or 0 (if false).
NOTE See this topic in the online User Reference for sample MAXScript code
for this function.
■ fn - What follows is a MAXScript function.
■ test1 - The function name; this should also appear in the Transition
dialog, as the transition condition. This function is executed first
when the transition is tested. The script may contain any number of
additional functions to be called from within a function in the script.
■ del - Refers to the delegate to which the script is currently being
applied. The transition script is executed once per frame for each
delegate/team member the cognitive controller is assigned to. Thus,
if you use "del" in the script rather than the name of a specific delegate,
all delegates to which the cognitive controller is assigned are tested.
■ t - The current time (frame number) in the simulation.
■ del.simpos.x - The delegate's current position on the X-axis. The special
function "simpos" is used to determine a delegate position during a
simulation solution. This is necessary because delegate positions aren't
available to MAXScript using the standard "[node].pos" function during
a simulation.
■ del.duration - The number of frames the delegate has been in the
current state.
You can see a complete list of delegate-specific parameters that can
be checked in the script by opening a MAXScript Listener window
(press function key F11) and entering:
4792 | Chapter 17 character studio