"How do I...?"

From ADRIFT 5 Manual Wiki
Revision as of 13:07, 17 January 2013 by Campbell (Talk | contribs) (Create a locked door that can be opened with a key?)

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 actions:

Set variable T1 to %PropertyValue[Object1,ReadText]%&"< br >"&%text%

(Where Object1 is the key of the notebook object)

and

Set property '... and description when read' of object 'notebook' to '%T1%

Example: Notepad.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 ]

PopupChoice.taf


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 just the default name given to the character the player starts off controlling. 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.


<<< FunctionsMain PageAdding a new command >>>