Hint System

The Pixie
Tried to upload this but "The upload was rejected because the uploaded file was identified as a possible attack vector." It is only short, so here is the code:

<library>
<command name="Hint">
<pattern>hint;clue</pattern>
<script>
if (HasScript (game.pov.parent, "hint")) {
game.pov.parent.hintflag = false
do (game.pov.parent, "hint")
}
if (not GetBoolean(game.pov.parent, "hintflag")) {
sl = NewStringList ()
foreach (obj, GetDirectChildren (hints)) {
list add (sl, obj.name)
}
sl = StringListSort (sl)
flag = false
foreach (s, sl) {
if (not flag) {
hint = GetObject (s)
if (not GetBoolean(hint, "passed")) {
flag = true
hint.done = true
if (HasScript (hint, "look")) do (hint, "look")
if (HasString (hint, "look")) msg (hint.look)
}
}
}
if (not flag) {
msg ("Sorry, no more clues")
}
}
</script>
</command>
<function name="HintCount">
total = 0
passed = 0
used = 0
foreach (obj, GetDirectChildren (hints)) {
total = total + 1
if (GetBoolean(obj, "passed")) passed = passed + 1
if (GetBoolean(obj, "done")) used = used + 1
}
msg ("You have used " + used + " hints out of " + total + " (" + passed + " stage-gates passed)")
</function>
</library>


ETA: I have created a Wiki page with better instructions and a slightly improved script too, so recommend going there, rather than using this page:
http://quest5.net/wiki/A_Hint_System

The Pixie
Here is a demo, which is not considered an attack vector!




The Pixie Hint System

If players are likely to get stuck in your game, a hint system is a good way to get them going again. A good hint system is context-sensitive (otherwise it is a walk-through), and that could be based on the location (if you are in room A, give hint X) or on the player's progress (if you have completed B, give hint y). This system is designed for the latter.

To use

1. First, include the HintLib library
2. Create an object called "hints"
3. For each hint, create an object inside the "hints" object, and give it a "look at" description
4. At each stage-gate, set the "passed" attribute of the appropriate hint to true.

Note: Do not put anything else in the hints object - it will be taken as a hint


Naming Hints

The way you name hints is important, because they are sorted alphabetically - the order the player might need them must be arranged as Quest will sort them.

In the demo, I name hints according to the scheme hint010, hint020, hint030, etc. potentially all the way up to hint990. The advantage of this system is that when I subsequently decided to add another hint I could insert it into the sequence as hint035.

If your game naturally falls into sections, you might prefer a system that reflects that, eg 01sword010, 01sword020... 02princess010, 02princess020...


Stage-gates?

So what are stage-gates? A stage-gate is where the player goes from one part of the game, where one hint is relevant, to the next, where the next hint applies. Presumably that first hint indicates how to achieve that. It could be killing the goblin, getting to a certain room, unlocking a door, finding a vital item.

In the demo, the first stage-gate is going into the second room, the next is picking up the key, the third is unlocking the door and the last is going into the last room. This is to show hints in action; in a real game you would not have a hint for each and every step.


Progressive hints

You can set up a series of hints for one stage gate, so that each time the player types hint he gets a more obvious clue (pick up the key in the demo and type hint twice to see this in action). To set this up, you obviously need a hint object for each hint. Each of these hints except the last should have a "look at" script, rather than text, and in the script, as well as displaying a message, should set its "passed" value to true.

Here is the code from the demo:

    <object name="hint030">
<inherit name="editor_object" />
<look type="script">
msg ("Now you have the key, what can you do with it?")
this.passed = true
</look>
</object>
<object name="hint035">
<inherit name="editor_object" />
<look>Type UNLOCK to unlock the door.</look>
</object>


In addition, the stage-gate itself must set the "passed" value to true for all the hints.

        msg ("You unlock the door")
hint030.passed = true
hint035.passed = true
exit_to_room3.locked = false

The Pixie
Local Hints

From version 2 you can have local hints. If a room has a script called "hint" this will be run. If the script sets the attribute hintflag on the room to true, then no other hints are given. Here is an example:

  <object name="room4">
<inherit name="editor_room" />
<hint type="script">
if (exit_to_room3.locked) {
msg ("Try unlocking the door in room2")
this.hintflag = true
}
</hint>
<exit alias="west" to="room">
<inherit name="westdirection" />
</exit>
</object>


The script tests a condition. If the condition is met, a hint is given, and the hintflag set. If te condition is not met, the flag is not set and the standard hint system comes into play.

This would be useful in rooms off the main quest. Player can get a hint to solve the puzzle when in the room. However, if that puzzle is solved, the player gets a hint towards the main quest as usual.

This topic is now closed. Topics are closed after 14 days of inactivity.

Support

Forums