|
|
|
|
|
%spell()
Aliases | %spell( ) |
---|
Parameters | mixed @spell, string @castType [, mixed @targets [, integer @level
[, integer @quality [, entity @actor [, entity @master]]]]] |
---|
|
This function can be used to invoke a spell at the lowest level. Unlike using the hackish "usespell" or "silentspell" commands, %spell() enables the builder, command, or spell scripter to invoke a spell with all the available configuration options to make it work exactly as planned. For instance, the spell can be invoked to work as though it were cast, as though it were on a wand, as though it were on a staff, or even as though it were on a weapon. While these might all seem the same to a novice they can have distinct and advantageous differences. For instance, invokation of %spell() with @spellType set to "staff" will cause the spell to take on area effect properties. Additionally, the scripter can customize other variables such as the spell's level, quality, precise targets, etc.
Unlike many other functions, the %spell() function supports only a small set of actual parameters, the rest of the customization must be provided by declaring the custom variables within the script context itself. The reason for this is to simplify the function for it's most common uses, while making it possible to easily punt functionality from a scripted spell to a sub-spell. For instance when a player casts "major heal", the spell actually invokes the "cure blindness" and "remove poison" spells so that there is no duplication of code and if either spell is updated, then the "heal" spell will automatically receive those updates too. All "contextual" parameters are optional and will receive defaults if not specified.
Customization criteria and how they may be defined:
@spell - parameter @spellType - parameter @targets - parameter, context @level - parameter, context, owner @quality - parameter, context, owner @actor - parameter, context, owner @master - parameter, context @command - context @arguments - context @commandId - context @commandUserFlags - context @commandSrcFlags - context @commandAttFlags - context @castString - context @costMana - context @costMovement - context @costHitpoints - context @castingTime - context
The @spell can be either the name of a spell or the ID of a spell. It is strongly suggested that the spell's name be used for portability and readability.
Other than @spell, all of the other parameters are described in detail at the following URL:
http://www.wocmud.org/Carnage/documents/display.php/documentID/26
In addition to the description for @targets, the variable may also be a pointer to a single entity upon which to apply the spell.
Example:
// // Cast magic missile on the entire room as though from a staff. The // quality will be random between 101 and 120. // %spell( "magic missile", "staff", %roomGetMobs(), 50, 100 + 1d20 ) |
|
|
|
|
|
|
|