Spell
Filtering
Using DSAs it is possible to intercept and modify all spells that are
cast.
Step 1: Specify a location in the dungeon that will receive a
message whenever a spell is cast. This is done using CSBuild's
Edit/Global menu selection. On the Edit Global Information dialog
there is an "Important Locations" drop-down box and associated edit
boxes that specify a level, x, and y locations in the dungeon. In
the drop-down box select "Spell Filter Location" and in the edit boxes
provide the location to receive the message.
Step 2: Put a DSA at the location specified in Step 1.
Whenever a spell is cast, a 'Set 0' message will be sent to that
location. You could put a door or pit there if you so choose but
it seems likely you will want to do something more complicated than
opening a pit. A DSA is probably the best thing to put there.
Step 3: Design a DSA that will do what you want done. Some
examples:
- Deny the use of the ZO spell until a particular scroll is found.
- Deny the use of Fireballs on level 9 ( The water level ).
- Don't let Halk use the ZO spell.
- If the Character Stamina is too low modify the spell at
random. ( Too tired to get it right. )
- Require twice as much mana to cast Fireballs on level 4.
- Deny use of ZO spell unless character has an Apple in his left
hand.
- Change the direction of Fireballs so that they are sent opposite
to the direction the party is facing.
- Et cetera
The DSA has access to all of the parameters that the runtime engine
uses to create the spell effects. The parameters can be obtained
by using the &PARAM@ command to put the parameters into the
Temporary Variable array. The parameters can be modified and then
sent back to the spell-casting code using the &PARAM!
command. This is the mechanism for modifying (Filtering) the
spell's effect. Here are the parameters:
- 0 - Action
- 1 - Incantation
- 2 - Character Index
- 3 - Disable time
- 4 - Missile Type
- 5 - Party Location in Dungeon
- 6 - Party facing direction
- 7 - Skill Required
- 8 - Spell Byte 5
- 9 - Spell Class
- 10 - Unused 1
- 11 - Unused 2
- 12 - Unused 3
- 13 - Unused 4
Action: This is the action to be taken when the DSA exits.
It is initially set to zero. The possible actions are
- 0 - Proceed to cast the spell as usual using the Spell
Parameters. If you do not modify the spell's parameters then this
will cause the spell to be cast just as though there were no filtering
in effect. If you have modified the parameters then the spell
will be cast using those modified parameters.
- 1 - Cancel the spell. Print no message. The spell
just quietly fizzles.
- 2 through 100 - Cancel the spell and print a message. See
the list of possible built-in messages later in this discussion.
Incantation: The incantation is specified by a 4-digit decimal
number.
The four digits are the four runes that are selected in the
casting. If fewer than four are used then the unused ones are
zero. A ZO-Spell might be 1600 or 2600 or 3600 or 4600 or
5600 or 6600 depending on the 'power'. A fireball could be 1440
or 2440 or 3440 or 4440 or 5440 or 6440 depending on the 'power'.
That should be enough examples to get the idea across. A spell of
1700 would be nonsense because there is no seventh rune.
Character Index: The index ( 0, 1, 2, or 3) of the character
casting the spell. From left to right in the portrait area.