So youre making a level and want to know how to insert a puzzle into your map. Follow these step by step instructions and pretty soon youll be able to lock everyone inside your map.
1. Create the objects that will need the puzzle. This can be as simple
as
a locked door, or as complex as placing a piece to trigger a
cinematic.
Lets keep it simple and talk about doors.
2. In front of the locked door, create a trigger_playerusepuzzle. It is a brush entity, so you can resize it to your specifications.
3. Create a trigger_puzzle also.
4. Target the trigger_playerusepuzzle to the trigger_puzzle, and target the trigger_puzzle to the door.
5. Select the trigger_puzzle and enter "item" in the key field,
and the puzzle piece in the value field.
For example: Key item, value item_puzzle_tavernkey.
6. Now hide the key in an appropriate place on the map.
A trigger_playerusepuzzle is a trigger that simply acts as a field for Corvus. While he is standing in the trigger, if the player presses "Use", Corvus will attempt to use the target of the trigger. There are extra flags for this trigger. The notes in the editor explain them, as does the documenation I provided with the game.
Basically though, you can set these flags to use your inventory items without the player hitting "use" and to not remove them. The reason we implemented this was for the Healer cinematic in andhealer. After the first cinematic, there were two other cinematics that could possibly play. One played if you didnt have both ingredients, while the other played if you did. We placed a trigger outside of his room so that you had to go through it and it would automatically check without the players knowledge. If you had both pieces, there was a pause while a new cinematic loaded.
The "no inventory" flag checks for a piece and uses it, but never shows the inventory bar. This is to hide the check from the player.
The other flag, "dont remove", is to make the trigger itself not remove. Therefore, if you are using it to check for multiple pieces and you have only one, the trigger wont remove itself so you can still use it for other pieces.
A trigger_puzzle gets used by the trigger, but only uses its targets if Corvus has the specified puzzle piece in his inventory. There is a "No take" flag if you dont want the piece removed from inventory. Thus, if you want the tavern key to open every door in a level, use this flag.