Game Development Reference
In-Depth Information
n endTurn() Ends the current turn in a turn-based diagram.
n activate(parameter) Deactivates the current artificial player and activates the
one identified by the parameter instead.
n deactivate() Deactivates the artificial player.
NOTE When a
diagram uses color-
coding, the artificial
players may be color-
coded as well. in that
case, an artificial player
can fire only nodes
that are the same color
as itself.
Artificial players can also be used in a turn-based diagram (see the section “Time
Modes” in Chapter 5 for a discussion of turn-based diagrams). However, in that
case, their behavior changes a little. Most importantly, in a turn-based diagram, the
artificial player has a number of actions that indicate how many times it will fire
during a turn. When it has multiple actions per turn, these actions are executed at
one-second intervals.
special Values in conditions
if statements in a script allow you to use the following special values:
random generates a random real number between 0 and 1. it is useful to create an
action that has a particular chance of occurring. For example, in the script  if(random 
< 0.25) ire(A) , action a will have a 25% chance of firing. The random number gener-
ated can be used like any other value in a condition. For example, the script if(random 
* 100 > Resources) ire(Produce) means that the chance of firing the Produce node
is inversely proportional to the number of resources in the resources pool. The more
resources there are, the smaller the chance that the condition will succeed; if there are
100 resources, it will never succeed, and the artificial player will never fire the Produce
node. This is useful for creating an artificial player that fires the Produce node only
when it detects that it needs more resources.
pregen0 … pregen9 are ten special values that hold random values between 0 and 1.
however, in contrast to the random value, these values are filled only once when the
diagram starts and do not change while it plays.
actions indicates the number of times the artificial player has fired.
steps indicates the number of time steps that have been executed by the diagram.
actionsOfCommand indicates the number of times the command after the if statement
has been executed.
actionsPerStep indicates the number of times the artificial player has fired during the
current time step.
 
Search WWH ::




Custom Search