"How do I...?"

From ADRIFT 5 Manual Wiki
Jump to: navigation, search

Create a locked door that can be opened with a key?

  • Make sure the two rooms that will be connected by the door are created and connected.
  • Create a group of type location and make the two rooms part of this group. This will allow you to make the door visible from the locations at each side of the door.
  • Create a new object of type dynamic - This is your key.
  • Create a new object of type static - This is your door.
    • Select Location Group from the Location of Object dropdown.
    • Select the door location group from the At Location Group dropdown.
    • Select the following properties for your door:
      • Object can be opened and closed (Selecting this allows you to select the next two dependant properties).
      • Open status - Leave as open for now.
      • Object can be locked (This adds Locked to the Open Status selections, and the Key for lock property).
      • Change Open status to locked.
      • Select your key object from the Key for lock dropdown.
  • Edit one of your door locations and select the Directions tab.
  • Add a new restriction to the direction that leads to the otherside of the door. Make this restriction:
    • Object - your door - must - be in state - open
    • Depending on your settings this restriction may be copied to the second location. If not duplicate the restriction in the second location.
  • The door will now block progress unless it is open.

Create a torch that will run out of batteries?

This really needs integer properties to work, so will do a writeup once that's done. It could be done using a variable of course...

Create a dark room that the player needs a light source to see?

Add any rooms that would be dark without a light source to the location group Dark Locations.

Add any objects that are light sources to the object group Light Sources.

The Dark Locations group should override the short location description, and the tasks should prevent looking and examining things whilst in a dark location without a light source.

Make a lift platform rise up out of reach when i pull a lever

  • Create a static object in a room to represent the platform or elevator, and make it a container or surface so it can hold other objects.
    • Press the 'Add new property' button to create an Object Property and make it a state list with two states, eg. 'up' and 'down' and give the property a name eg. 'Lift Position'.
    • Make sure its selected for the lift object and set it to 'down'.
  • Create a Lever as a static object (either in the same room or another location).
  • Create a specific task that overrides 'pull' for your Lever object.
    • If the lever and lift are in the same room then write some text describing the lift going up, otherwise just say 'You hear the sound of machinery operating for a few seconds'
    • Give it a restriction 'Property Lift Position for Object Lift must be Down' and a failure message 'The Lever is already in the pulled position - you could try pushing it'
    • Create an action 'Set Property Lift Position of Object Lift to up'.
  • Do the opposite for a 'push lever' specific task, so when lift is up push lever will bring it down.

Now we need to describe the lift being in two different places, floor level and high in the air, in both the room description and the lift description. In both cases use the default description in the text box to describe the rest of the room, then add two Alternate Descriptions, one with the Restriction 'Property Lift Position for Object Lift must be Down' and describing the lift at ground level, and the other with 'Lift must be up' describing it high in the air and out of reach.

Now we just need to make sure that anything placed on (or in) the lift is out of reach when its raised.

  • Create a new location thats not connected to anywhere else.
  • In the pull lever task add an action to move everything on (or in) the lift to the new location.
  • In the push lever task add an action to move everything in the new location to on (or in) the lift.

Use a button to toggle between two different states

Using the previous example of a lift, rename the Lever to a Button, then change both the push and pull lever tasks to 'press button' tasks. Remove the text from the restrictions on both tasks. When the lift is down, only the task that raises the lift will pass its restriction. When the lift is up, only the task that lowers the lift will pass its restriction.

Create a notebook that the player can write in

  • Create a readable object (both "This object is readable" and "and description when read" selected).
  • Create a text variable called 'T1'
  • Use a "write %text%" general task to add lines to it, with the Set Property action:

Set IconDynamicObject.jpg [notebook] [... and description when read] to x+y [Object1.ReadText & "<br>" & %text%]

Where "Object1" is the key of the notebook object, and must be changed to the actual key of the object you created.

Example: Notepad2.taf

You could also add a restriction that the player must be carrying the notebook to be able to write in it.

Ask the player to enter their gender when the game starts

Set the Player's gender property to "Male", and create a text variable called "NewGender"

Create a system task called "SetGender" that has the restriction [ Variable ][ NewGender ][ must be ][ equal to ][ "female" ]

Add the action [ Set property ][ The Player Character ][ Gender ] to [ Female ]

Create another system task "AutoRun" set to execute "Immediately" with two actions:

[ Set Variable ] [ NewGender ] to [ %PopUpChoice["Are you of the Female gender?", "female", "male"]% ]

[ Execute task ] [ SetGender ]


Switch the player point-of-view between different characters

The player does not need to always control the same character in the game, but can easily be switched to a different character using the following action:

[ Move ] [ Character ] [ The Player Character ] [ to switch places with ] [Character to play as].

Note that [ The Player Character ] (or %Player% if used in a function) will always return the character currently being controlled by the player, whereas Player is the key of the default character that the player starts off controlling when the game starts. So these will be one and the same in most cases, until a "switch places" action is run.

Display on screen the text that the player has typed in?

Say for example when we ASK a character ABOUT a subject, e.g. ASK FRED ABOUT BUSES, if what the player types in does not match the referenced text BUSES, e.g. if the player types in ASK FRED ABOUT CARS, unless the programmer has created a conversation topic with keywords that match that input, the default response from ADRIFT is "Fred doesn't appear to understand you."

At the present moment we are unable to directly edit the default message, however we can use a text override and the %text% function to change the message to one that will display what the player typed in, i.e. "CARS".

The first thing you need to do is open the Text Overrides folder which you will find in the main folders window. Right-click anywhere in the text overrides folder and a menu will appear, left-click on "Add Text Override" at the top and a new text override dialogue box will open. In the top dialogue box you type the text to be replaced, in this case "doesn't appear to understand you." (without the quotes!). Note that we do not specify the character name as we want to use this for all characters. In the bottom dialogue box we will type the text that you want to replace the default text with, e.g. "doesn't know anything about %text%." (again, without the quotes.) You will note that %text% will change colour to green. Lastly, click on the OK button to save the text override.

Now, when the player types in ASK FRED ABOUT CARS, the message that appears will be "Fred doesn't know anything about cars." You can use the %text% function in other ways to display the players input in messages.

Give commands to characters using format "Karen, get me a coffee"

Create a general task as follows:

Command: %character%{,} %text%

Restrictions: The player must have seen referenced character AND The player must be in the same location as referenced character.

Action: Say %text% to referenced character.

Task is repeatable.

To create commands for npc's to follow, you will need to make conversation items for them. Check the box for general commands and leave the rest unchecked. In the command field, type the syntax of the instruction as the player would type it.

For example, "take crate" would be in the command field and in game the player could tell the npc to take the crate by typing "say take crate to robot" or "robot, take crate". While both would work, the latter is more natural and follows the syntax for giving commands to npc's that are used in other games.

Take the player randomly to one of two locations when they leave a room

The player is in a particular location. When they move in a certain direction ("Out" in this example) we want to take them to one location half the time, and a different location the rest of the time.

First setup the OUT direction to take you to the first of the two destinations as normal.

For the second destination, create a specific task which overrides the "Player Movement" task.

Where it says "go to the direction" click on direction and select "Out". It will now say "go to the Out"

For the message to display on completion, put in a message that explains why you suddenly end up at the second location, eg. "You try to go out, but suddenly a swirly vortex grabs you and you find yourself at". (or if you want the two destinations to be equal, just copy the message from "Player Movement")

Add two restrictions, the first a character restriction: [The Player Character][must][be at location][your initial location] The second restriction is an Expression restriction: RAND(0,1)=1

Then you just need to add two actions: Move [the player character] to location (the second destination) Execute task 'Look'

Now, only when you are at [your initial location] and type "Out", half of the time (when RAND(0,1)=1 is true) the specific task will override and take you to the second location. The other half the time the normal player movement will take you to the first location.

Create default conversations that can be shared by several characters

If you have several characters that should respond in the same way to the same questions, then you can either create all of the same topics in every one of those characters, or you can create default topics as follows.

Create a new character and give it a Descriptor/Noun that makes sense in the sentance "[Descriptor] doesn't appear to understand you" for any of the characters that will use it. eg. "she" or "the lawyer".

The proper name can be anything you like, as it wont be displayed in the game, so if its the default conversations for all lawyers then we can call it "Default lawyer conversations".

The conversation page of the character can now be filled in with the conversations that you want to be shared by several characters. Do NOT give this character an introduction or farewell.

For each of these characters, open their conversation page and add a new "Ask" topic at the bottom of the list. The keyword for the topic should be the wildcard character * which matches with anything. Leave the conversation text box blank and go to the topic "Actions" page to add a conversation action: [Ask][Default lawyer conversations][about][%text%]

You also need to add the conversation action: [Enter Conversation]with[This character]

or the player will get an error message if they try to talk to the character without using their name.

These actions redirect an "ask [this character] about [topic]" command to the default character, and the default characater will supply the answer.

The same thing can also be done with "tell" and "General command" topics.

If a particular character knows more about one of the default topics, then add a new topic to that character before the default topic and it will override it.

Note that any Introdution/Farewell messages will be shown repeatedly unless you add restrictions to prevent it.

<<< Introductory Tutorials : Keeping ScoreMain PageAdding a new command >>>