Whoso pulleth out this sword of this stone

How to masterize rewards dropping

Breaking things is definitely one of Hexen II gameplay's distinctive traits and commonly gets the player a reward in the form of a dropping goodie...

A sword stuck in stone

Make the Arthurian Legends yours

Items & artefacts

Well, it's probably obvious to say that but, since breaking is part of Hexen II's DNA, options are already natively hard coded by Raven: you already know that certain objects have dedicated properties to release stuff when they're destroyed, like chests or pots.

cnt_xxx properties


The first good news is that such properties are in fact available for practically any kind of entity including monsters. The rule of thumb is: if it can be destroyed, it can drop something.
"Something" can be either one of the usual items/artefacts or a puzzle piece. For an item or artefact, give the entity one of the classic properties below:

PropertyComment
armor_amulet For some reason, the value must be
exactly 20 for the reward to spawn.

Broken
Sadly, even if the 3D model spawns, the player
will get no armor points in vanilla HexenC:
the feature is broken as the granted AC
is determined by the armor's classname
which is not set when spawn dynamically.
It looks like a reward but it's just hot air.
armor_bracer
armor_breastplate
armor_helmet
cnt_blast Number of artefacts the player must receive.

Only one 3D model spawns anyway,
so if the value is more than 1,
a backpack spawns instead of the artefact's model.

Please also note that internal
hard coded rules apply to keep
a reasonable amount of goodies
in the player's inventory.
So it would be pointless
setting super high numbers.
cnt_cubeofforce
cnt_flight
cnt_glyph
cnt_h_boost
cnt_haste
cnt_invincibility
cnt_invisibility
cnt_mana_boost
cnt_polymorph
cnt_sh_boost
cnt_summon
cnt_teleport
cnt_tome
cnt_torch
bluemana You can only set one of those 2
properties at most, but you can
give it any value you like even
a fancy big one (but the 3D
model won't look bigger or
anything like that).

Here again, hard coded rules may
cut off any too big value.
greenmana
spawn_health Just one standard crystal vial
(HP +10) will spawn, no matter
the value set here.

Note that, although monsters may usually release rewards upon death randomly, if one or more of the properties above are manually set, they take the precedence and force the reward(s) of your choice
Caution: if the destroyed thing spawning a reward is a brush entity (like a breakable_brush), the reward will spawn at the origin point of the entity. That's usually the '0 0 0' point in the world, likely an entirely different place of your map, maybe even out of its bounds! To work around that, add an origin brush to your entity, that is a small cubic brush with the ORIGIN texture on all faces. The center of gravity of the cube is now your entity's origin. The cube itself is disposed and will never show in-game.

Puzzle pieces

Instead of an item/artefact, the reward may be a PP (puzzle piece). Then give the destroyable entity a puzzle_id property with the relevant value depending of the desired piece you want to spawn:

All vanilla puzzle pieces
Comprehensive list of all the puzzle pieces of vanilla Hexen II + Portal Of Praevus with the corresponding puzzle_id
(Click on the picture to enlarge)

⚠ Important warnings!
  • If the destroyed thing is an object or a monster:
    • Another unreachable occurrence of the PP must be hidden somewhere in the map, so that its model is correctly precached by the game engine.
    • You should also set the puzzle_piece_1 property to a friendly name for the piece to be displayed upon pick up, otherwise the player will read a silly "You have acquired the" uncompleted message.
  • If the destroyed thing is a brush entity (door, train, trigger, breakable_brush...), the puzzle_id technique above won't work. The entity must instead target a puzzle_piece entity (with "Spawn" spawnflags set) the classic way. Drawback: the spawning spot is set in advance at mapping time and won't follow the entity if it moves, so the entity must be static or the destruction point known in advance.
  • Anyway, in order to be sure the friendly name for your PP is coherent, please check my dedicated article about puzzle pieces.

Weapons

That's here that things become interesting, weird and hacky as hell... and take us back (at last!) to the title of this article evoking a weapon stuck in stone.
So let's imagine a big rock (breakable_brush) which must be destoyed to reveal a weapon it encompasses.

First observation : if we just put a weapon entity at a place where another solid entity is, the weapon simply refuses to spawn (the same with any kind of pickup by the way). A pickup needs a free space. Lets call that problem "the collision issue".

So obviously a trick is required. The idea is that, as long as the breakable_brush is there, the weapon can't occupy the same space because of the collision issue, so it awaits underground, hidden. A fake version, non solid thus immune to the collision issue, lies there instead, ready to be seen by the player as soon as the rock is destroyed. Since the rock is gone, there is no more collision to fear and a door pushes up the real weapon where the player can grab it.

Here is the setup:

A breakable obelisk stands above a hole in the ground.
The blue parts are world geometry.

classnamebreakable_brush
health5
targetd
thingtype1
It targets a 8-units thick door at the bottom of the hole.

classnamefunc_door
angle-1
lip-8
speed300
targetnamed
wait-1

The door just goes up enough to make the weapon's hitbox slightly stick out of the ground level.
A regular wp_weapon3 is sitting on the door.

classnamewp_weapon3
effects128
killtargetfakeweapon
netnameexcalibur

The hole must be deep enough so that the weapon's hitbox doesn't stick out of the ground level.
Its X & Y dimensions must be large enough for the weapon to be able to spawn, but small enough to prevent the player from falling down in the hole (like 32x32 as shown here; grid size 8).

effects|128 means the weapon is invisible, to prevent any risk of having 2 weapons visible at the same time (the real one and the fake one).

Picking up the real one removes the fake one.
A func_illusionary with the same texture as the world geometry makes the hole undetectable. Since it's not solid, it doesn't prevent the weapon from spawning.
A func_rotating_movechain lies at the heart of the obelisk.
That's the fake weapon.

classnamefunc_rotating_movechain
flags2097152
modelmodels/w_l3_c1.mdl
netnameexcalibur
targetnamefakeweapon

func_rotating_movechain is one of those zombie draft entities left in the code although never having been used by Raven in any released map. It seems it was intended to align the rotation of a slave entity on the one of a master entity. Never mind.
Its interesting feature is that it can take the form of any model put in its model property. The model here is w_l3_c1 which can be read as "weapon level 3 for player class 1". Despite the "for player class 1" bit, the trick works correctly for any player class; the model correctly adapts to the character played by the player and displays the relevant weapon model. This wizardry comes from the magical flags|2097152. The internal nickname for this barbaric value is FL_CLASS_DEPENDENT. It causes the game engine to dynamically change the last digit at the end of the model name to turn it into the right name within the [w_l3_c1 - w_l3_c5] range. Of course, no matter the actual model it must be precached first. func_rotating_movechain doesn't handle that part of the job but the real version of the weapon is also present in the map so it works.
A netname has also to be set as, because of its master/slave thing origin, func_rotating_movechain must share its netname with another entity in the map (supposedly its "master").

This trick is nice but suffers from evident restrictions:
  • As it involves some specific brushwork, it's applicable only in static settings. Monsters or moving brush entities can't spawn weapons that way.
  • Depending on the player class, the 3D model's offset to origin is different. So a rock tall enough to hide a crusader weapon may be too short for a necromancer one and reveal it partially. Be careful to test your setting with all the player classes to avoid bad surprises.
  • Unlike this page's feature image, the fake weapon must be entirely hidden in the breakable thing since it uses the vanilla weapon model which floats and rotates: an object stuck in stone logically wouldn't.
A static weapon model seen half emerging of a rock or embedded in an ice block like in my Winnowing Pass map then animating when it's freed is definitely possible. But it would require advanced modding and HexenC modifications, which are out-of-scope of this article...

Want to ask for clarification, report an issue with this trick or propose another one? Drop me an email If you use the trick please credit me and put a link to this website.