Puzzle pieces

Puzzle pieces

Classname: puzzle_piece
Purpose: Being collected to solve puzzles (includes keys)
H2 Code: triggers.hc
fields required: origin,puzzle_id, netname
Puzzle-pieces are collected by the player, and essentially function as `keys' (keys are indeed implemented as puzzle-pieces), via the fields puzzle_piece1..4 of many of triggerable entities such as doors, etc. Puzzle pieces that have been put into their assigned positions, such as the elements in the Meso-Americal hub, are represented by puzzle static pieces. You can get the effect of, say, converting sand into a piece of glass by using one puzzle-piece to spawn the creation of another, by means of the targetname field and the SPAWN spawnflag, as discussed below.

Like other point entities, puzzle pieces can also trigger events and toggle lights when acquired; this works in original H2 but wasn't actually used by Raven until Portal of Praevus However, note the following warning from Terata:
In a coop [what about deathmatch?] game, the puzzle piece stays there when a player picks it up, so the next player can have it. This means that if you give the puzzle_piece a target, it won't activate in a coop game because it never gets "picked up."

To make your own custom puzzle piece, you need a model (.mdl) which goes into the models/puzzle subdirectory of your project, whose name (without the .mdl extension) is the value of the puzzle_id field, and a graphic lump with the same name and extension .lmp, which goes into the gfx/puzzle subdirectory of your project (go the the chopshop's Hexen 2 editing section to find out how to make these things). As a short-term expedient for the graphic, you can just extract one from the H2 .pak files and rename it. I haven't yet learned how to make a custom puzzle-piece bob and rotate.

Fields

origin Value is a triple of numbers, where the piece is. Should be handled visually by map-editor, automatically.
puzzle_id Value is the name of the puzzle_piece, listed here. You can add new ones, as discussed above. REQUIRED.
netname Value is a string, which is displayed when the puzzle piece is picked up.
targetname Value is a name, targetted by a trigger. If the SPAWN spawnflag is checked, the puzzle-piece doesn't appear until the trigger fires.
target Value is a name, of target triggered when puzzle piece is acquired.
style Value is a number (32 or greater) used in conjunction with target for toggling lights; this style values is to be shared by all lights that toggle together.
spawnflags Value is the sum of the numbers for the properties desired below:
  • 1 - SPAWN: puzzle-piece doesn't appear until targetting trigger fires.
  • 2 - FLOAT: puzzle-piece hangs at map location rather than dropping to the floor upon spawn.
  • 4 - AUTO_GET: function unkown; seems unimplemented to me.

Back to the list.