Ending a Storyworld Based on Conditions

You have the ability to track the progress of your storyworld using
Fate. Here's how. Suppose your storyworld is a training storyworld that focuses on teaching the player to increase other Actors' willingness to take on and complete challenging tasks (their Timid_Confident values). Let's assume that you want the storyworld to end after the player through leadership and encouragement increases the average Actor confidence level to 0.4 or more.

First, create a new
Verb called "calculate confidence." In the Properties box, make the Audience for this Verb Under the Hood. Make the preparation time 10 storymoments. Uncheck the box labeled "occupies DirObject."

Now go to once upon a time. Under the
Role for Fate, the AssumeRoleIf script should look like this:

calculate confidence: Fate: AssumeRoleIf:
     AND
          PermitFateToReact
          AreSameActor
              
ReactingActor
               Fate

This simply says that Fate is the only one who can use this Role.

Now remove your first
Verb as an Option and add calculate confidence. Also add penultimate Verb as an Option.

(Note that, if this were a working storyworld, you would also need a separate
Role here for the Protagonist. You would need to hook that Role up to a set of Verbs that would allow the player to try different tactics in engaging with the non-human Actors in your storyworld, which would lead to their losing or gaining confidence. We're not going to bother with this step—just pretend that those Verbs are all there and would gradually change all the Actors' Timid_Confidence Core Traits as the player played the storyworld.)

Recall that we said we want
Fate to continue allowing the player to play this training storyworld until the other Actors' average Timid_Confidence reaches an average of greater than 0.4. This means that Fate will allow the storyworld to continue to run, as long as the average Timid_Confidence of the non-player Actors is less than or equal to 0.4. Once it exceeds that, Fate will end the storyworld. Here's what you have to do to make that happen.

For the penultimate
Verb Option, here is the DirObject Acceptable script:

AreSameActor
    
CandidateActor
     Protagonist


The Inclination script is this:

Actor@Average of:
     NOT
          AreSameActor
              
CandidateActor
               Protagonist

     Timid_Confident of:
          CandidateActor

This script calculates the average Timid_Confident value for all Actors except the Protagonist.

The
calculate confidence Inclination script is this:

0.4

Remember, the Story Engine will compare the
Inclination of penultimate Verb with the Inclination for calculate confidence, and will choose the higher value. This is why we set an Inclination for calculate confidence of 0.4— so that the Story Engine continues to calculate confidence until the average Timid_Confident exceeds it. (Also remember that Actor@Average is a BNumber that can range from nearly -1 to nearly +1, so 0.4 is a pretty high confidence level.)

The
Verb once upon a time always kicks off a storyworld. With this Role for Fate, you have now set things up so that, if the Actors' average confidence is greater than 0.4 at the storyworld start, it will end right away. Otherwise, Fate will wait ten moments and then perform the Verb calculate confidence. But since we haven't given Fate anything to do once it reaches the Verb calculate confidence, we need to create a Role for Fate there as well.

Copy
Fate's Role under once upon a time, go to calculate confidence, and paste the Role there.

By doing this, you have set up a monitoring loop for
Fate. Every ten storymoments, Fate has to decide what to do: calculate confidence again, or end the storyworld? If the average confidence level of all Actors except the player stays at 0.4 or below, Fate will wait ten more minutes, and calculate confidence again. If the average Actor confidence exceeds 0.4, Fate chooses penultimate Verb instead, and the storyworld ends.

(Incidentally, you'll also need to be sure to set the
Actors' Timid_Confidence Traits so that they average out below 0.4, for this to work. To test whether the script works, though, you can always set the Actors' Timid_Confidences above 0.4, and see if the storyworld ends right away. Or simply use Scriptalyzer to simulate the same effect.)


Unique Characteristics of Fate

Because the Story Engine treats
Fate differently than it does the other Actors in your storyworld, there are some things you need to know, if you build Verbs using Fate.

First,
Fate does not react to Verbs under normal circumstances. The Story Engine prohibits this. To get Fate to react, you must circumvent the normal circumstances. To accomplish this, use the special-purpose Operator PermitFateToReact in the Verb's AssumeRoleIf script. This temporarily disables the constraint so that Fate can react. Next, you must specify that Fate is the Actor you want. To get Fate to do something, the AssumeRoleIf script must have this:

AND
     PermitFateToReact
     AreSameActor:
         
Fate
          ReactingActor

(Yeah, it's kinda dumb, to have to tell the Engine twice. We promise, we'll build a smarter tool for the next version of SWAT.)

Next, since
Fate is everywhere at once, you will not get a good result if you try to make Fate the subject of the system Verbs depart for and arrive at.

Finally, because the Story Engine ignores
Fate for non-special Verbs, it will do you no good to designate Fate as the DirObject or other XxActor in a WordSocket. The Engine will studiously ignore you if you do. The good news is, you don't need to put Fate into a WordSocket. If a Verb triggers and you've given Fate a Role in response to that Verb, Fate will always react, as long as you include the AssumeRoleIf script shown above.


Previous tutorial:  Who's Fate? (part 1)                                                                                                 Next tutorial:  Poison



SWAT TUTORIAL
Who's Fate? (part 2)