Difference between revisions of "Manual:Zone Manual/Appendices/Complete magical transfers macros listing"

From DikuMUD Wiki
Jump to navigation Jump to search
(checked against the current code (wiki review 2026-11-15))
 
Line 1: Line 1:
 
==== Complete magical transfers macros listing ====
 
==== Complete magical transfers macros listing ====
−
This listing of macros was taken from
 
−
''wmacros.h''.  When building your objects you should
 
−
check the macros file to make sure you have the most up to date
 
−
macros.
 
−
<nowiki>
 
−
#define CHAR_FLAG_TRANSFER(_MFLAGS) \
 
−
flags {UNIT_FL_MAGIC}      \
 
−
affect                            \
 
−
  id ID_TRANSFER_CHARFLAGS      \
 
−
  duration -1                    \
 
−
  data[0] _MFLAGS                \
 
−
  firstf TIF_EYES_TINGLE        \
 
−
  tickf TIF_NONE                \
 
−
  lastf TIF_EYES_TINGLE          \
 
−
  applyf APF_MOD_CHAR_FLAGS;
 
  
−
/* skill MUST be one of SKI_XXX, amount in -10 to +10 */
+
A transfer gives the character who wears, wields or holds an object a bonus (or a penalty) for as long as the object is used: more strength, a better skill, faster attacks. The transfer macros are in [https://github.com/Seifert69/DikuMUD3/blob/master/vme/include/wmacros.h vme/include/wmacros.h], which ''macros.h'' includes. Each one adds an <code>affect</code> to the object and sets <code>UNIT_FL_MAGIC</code> on it. The bonus works only while the object is equipped (worn, wielded or held), not while it is carried.
−
#define SKILL_TRANSFER(skill, amount) \
 
−
flags {UNIT_FL_MAGIC}        \
 
−
affect                      \
 
−
  id ID_SKILL_TRANSFER      \
 
−
  duration -1              \
 
−
  data[0] skill            \
 
−
  data[1] amount            \
 
−
  firstf  TIF_SKI_INC      \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_SKI_DEC      \
 
−
  applyf  APF_SKILL_ADJ;
 
  
−
/* weapon MUST be one of WPN_XXX, amount in -10 to +10 */
+
{| class="wikitable"
−
#define WEAPON_TRANSFER(weapon, amount) \
+
! Macro !! What it changes !! Allowed values
−
flags {UNIT_FL_MAGIC}        \
+
|-
−
affect                      \
+
| <code>STR_TRANSFER(amount)</code> || strength || amount -7..+7
−
  id ID_WEAPON_TRANSFER    \
+
|-
−
  duration -1              \
+
| <code>DEX_TRANSFER(amount)</code> || dexterity || amount -7..+7
−
  data[0] weapon           \
+
|-
−
  data[1] amount           \
+
| <code>CON_TRANSFER(amount)</code> || constitution || amount -7..+7
−
  firstf  TIF_WPN_INC      \
+
|-
−
  tickf  TIF_NONE          \
+
| <code>CHA_TRANSFER(amount)</code> || charisma || amount -7..+7
−
  lastf  TIF_WPN_DEC      \
+
|-
−
  applyf  APF_WEAPON_ADJ;
+
| <code>BRA_TRANSFER(amount)</code> || brain || amount -7..+7
 +
|-
 +
| <code>MAG_TRANSFER(amount)</code> || magic ability || amount -7..+7
 +
|-
 +
| <code>DIV_TRANSFER(amount)</code> || divine ability || amount -7..+7
 +
|-
 +
| <code>HIT_TRANSFER(amount)</code> || the hit point ability || amount -7..+7
 +
|-
 +
| <code>SKILL_TRANSFER(skill, amount)</code> || one skill, <code>SKI_...</code> (see [[Manual:Zone Manual/Appendices/Skill definitions in values.h|Skill definitions]]) || amount -7..+7
 +
|-
 +
| <code>WEAPON_TRANSFER(weapon, amount)</code> || one weapon skill or weapon group, <code>WPN_...</code> (see [[Manual:Zone Manual/Appendices/weapon definitions in values.h|weapon definitions]]) || amount -7..+7
 +
|-
 +
| <code>SPELL_TRANSFER(spell, amount)</code> || one spell skill or spell group, <code>SPL_...</code> (see [[Manual:Zone Manual/Appendices/Spell definitions in values.h|Spell definitions]]) || amount -7..+7
 +
|-
 +
| <code>SPEED_TRANSFER(delta)</code> || attack speed: a positive delta makes the wearer faster || delta -8..+8
 +
|-
 +
| <code>SLOW_TRANSFER(delta)</code> || attack speed, slower: give a negative delta || delta -8..+8
 +
|-
 +
| <code>CHAR_FLAG_TRANSFER(flags)</code> || sets <code>CHAR_</code> flags on the wearer, e.g. <code>CHAR_FLAG_TRANSFER(CHAR_HIDE)</code> || <code>CHAR_</code> flags
 +
|}
  
−
/* spell MUST be one of SPL_XXX, amount in -10 to +10 */
+
vmc checks the -7..+7 amounts: an object <code>bad</code> with <code>DEX_TRANSFER(9)</code> stops the compile with <code>FATAL: bad: Adjustment 9 outside -7..+7 in ID -8.</code>; the header's comments still say -10..+10, which is out of date. The speed limit is not checked by vmc: the server ignores a delta outside -8..+8 and logs it.
−
#define SPELL_TRANSFER(spell, amount) \
 
−
flags {UNIT_FL_MAGIC}        \
 
−
affect                      \
 
−
  id ID_SPELL_TRANSFER      \
 
−
  duration -1              /* Must be permanent in the object */  \
 
−
  data[0] spell            /* It is a spell SPL_XXX transfer  */  \
 
−
  data[1] amount            /* Amount of better spell skill    */  \
 
−
  firstf  TIF_SPL_INC      \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_SPL_DEC      \
 
−
  applyf  APF_SPELL_ADJ;
 
  
−
#define STR_TRANSFER(amount) \
+
A ring that adds 1 to strength, from the dragon station:
−
flags {UNIT_FL_MAGIC}      \
 
−
affect                      \
 
−
  id ID_TRANSFER_STR        \
 
−
  duration -1               /* Must be permanent in the object */  \
 
−
  data[0] ABIL_STR          /* It is a strength function      */  \
 
−
  data[1] amount            /* Amount of better strength      */  \
 
−
  firstf  TIF_STR_INC      \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_STR_DEC      \
 
−
  applyf  APF_ABILITY;
 
  
−
#define DEX_TRANSFER(amount) \
+
<pre>
−
flags {UNIT_FL_MAGIC}       \
+
maskwa
−
affect                      \
+
names {"maskwa platinum ring", "platinum ring", "maskwa ring", "maskwa",
−
  id ID_TRANSFER_DEX        \
+
      "ring"}
−
  duration -1                /* Must be permanent in the object */  \
+
title "a Maskwa ring"
−
  data[0] ABIL_DEX            /* It is a dex function            */  \
+
descr "A Maskwa platinum ring is lying here."
−
  data[1] amount              /* Amount of better dex            */  \
+
type ITEM_WORN
−
  firstf  TIF_DEX_INC      \
+
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_FINGER}
−
  tickf  TIF_NONE          \
+
STR_TRANSFER(+1)
−
  lastf  TIF_DEX_DEC      \
+
weight 1
−
  applyf  APF_ABILITY;
+
cost 100 COPPER_PIECE
 +
end
 +
</pre>
  
−
#define CON_TRANSFER(amount) \
+
An object can have several transfers. All the macros look alike; this is <code>SKILL_TRANSFER</code> as ''wmacros.h'' defines it:
−
flags {UNIT_FL_MAGIC}      \
 
−
affect                      \
 
−
  id ID_TRANSFER_CON        \
 
−
  duration -1                /* Must be permanent in the object */  \
 
−
  data[0] ABIL_CON            /* It is a con function            */  \
 
−
  data[1] amount              /* Amount of better con            */ \
 
−
  firstf  TIF_CON_INC      \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_CON_DEC      \
 
−
  applyf  APF_ABILITY;
 
  
−
#define CHA_TRANSFER(amount) \
+
<pre>
−
flags {UNIT_FL_MAGIC}        \
+
/* skill MUST be one of SKI_XXX, amount in -10 to +10 */
−
affect                      \
+
#define SKILL_TRANSFER(skill, amount) \
−
  id ID_TRANSFER_CHA        \
+
flags {UNIT_FL_MAGIC}        \
−
  duration -1                 /* Must be permanent in the object */  \
+
affect                      \
−
  data[0] ABIL_CHA            /* It is a cha function            */  \
+
  id ID_SKILL_TRANSFER      \
−
  data[1] amount             /* Amount of better cha           */  \
+
  duration -1               \
−
  firstf  TIF_CHA_INC       \
+
  data[0] skill            \
−
  tickf  TIF_NONE          \
+
  data[1] amount            \
−
  lastf  TIF_CHA_DEC       \
+
  firstf  TIF_SKI_INC       \
−
  applyf  APF_ABILITY;
+
  tickf  TIF_NONE          \
 +
  lastf  TIF_SKI_DEC       \
 +
  applyf  APF_SKILL_ADJ;
 +
</pre>
  
−
#define BRA_TRANSFER(amount) \
+
The other macros differ in the <code>id</code>, the <code>data</code> values and the functions named in <code>firstf</code>, <code>lastf</code> and <code>applyf</code>; vmc checks that these match, so use the macros rather than writing <code>affect</code> blocks by hand. ''wmacros.h'' also has <code>CURSED_OBJECT</code>, which makes an object impossible to remove once worn.
−
flags {UNIT_FL_MAGIC}      \
 
−
affect                      \
 
−
  id ID_TRANSFER_BRA        \
 
−
  duration -1                /* Must be permanent in the object */  \
 
−
  data[0] ABIL_BRA            /* It is a bra function            */  \
 
−
  data[1] amount              /* Amount of better bra            */  \
 
−
  firstf  TIF_BRA_INC      \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_BRA_DEC      \
 
−
  applyf  APF_ABILITY;
 
−
 
 
−
#define MAG_TRANSFER(amount) \
 
−
flags {UNIT_FL_MAGIC}      \
 
−
affect                      \
 
−
  id ID_TRANSFER_MAG        \
 
−
  duration -1                /* Must be permanent in the object */  \
 
−
  data[0] ABIL_MAG            /* It is a mag function            */ \
 
−
  data[1] amount              /* Amount of better mag            */  \
 
−
  firstf  TIF_MAG_INC      \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_MAG_DEC      \
 
−
  applyf APF_ABILITY;
 
−
 
 
−
#define DIV_TRANSFER(amount) \
 
−
flags {UNIT_FL_MAGIC}      \
 
−
affect                      \
 
−
  id ID_TRANSFER_DIV        \
 
−
  duration -1                /* Must be permanent in the object */  \
 
−
  data[0] ABIL_DIV            /* It is a div function            */  \
 
−
  data[1] amount              /* Amount of better div            */  \
 
−
  firstf  TIF_DIV_INC      \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_DIV_DEC      \
 
−
  applyf  APF_ABILITY;
 
−
 
 
−
#define HIT_TRANSFER(amount) \
 
−
flags {UNIT_FL_MAGIC}      \
 
−
affect                      \
 
−
  id ID_TRANSFER_HPP        \
 
−
  duration -1                /* Must be permanent in the object */  \
 
−
  data[0] ABIL_HP            /* It is a hit point function      */  \
 
−
  data[1] amount            /* Amount of better strength      */  \
 
−
  firstf  TIF_HIT_INC      \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_HIT_DEC      \
 
−
  applyf  APF_ABILITY;
 
−
 
 
−
#define SPEED_TRANSFER(newspeed) \
 
−
flags {UNIT_FL_MAGIC}      \
 
−
affect                       \
 
−
  id ID_TRANSFER_SPEED      \
 
−
  duration -1                /* Must be permanent in the object */  \
 
−
  data[0] newspeed          \
 
−
  firstf  TIF_SPEED_BETTER  \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_SPEED_WORSE  \
 
−
  applyf  APF_SPEED;
 
−
 
 
−
#define SLOW_TRANSFER(amount) \
 
−
flags {UNIT_FL_MAGIC}        \
 
−
affect                        \
 
−
  id ID_TRANSFER_SPEED      \
 
−
  duration -1                \
 
−
  data[0] newspeed          \
 
−
  firstf  TIF_SPEED_WORSE    \
 
−
  tickf  TIF_NONE          \
 
−
  lastf  TIF_SPEED_BETTER  \
 
−
  applyf  APF_SPEED;</nowiki>
 
  
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual:Zone_Manual/Appendices/Liquid macros file|Previous: Liquid macros file]]</div>
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: left;float:left;width:50%;'>[[Manual:Zone_Manual/Appendices/Liquid macros file|Previous: Liquid macros file]]</div>
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual:Zone_Manual/Appendices/Skill definitions in values.h|Next: Skill definitions in values.h]]</div>
 
<div style='padding-top: 30px; padding-bottom: 20px; text-align: right;float:right;width:50%;'>[[Manual:Zone_Manual/Appendices/Skill definitions in values.h|Next: Skill definitions in values.h]]</div>

Latest revision as of 06:24, 15 November 2026

Complete magical transfers macros listing

A transfer gives the character who wears, wields or holds an object a bonus (or a penalty) for as long as the object is used: more strength, a better skill, faster attacks. The transfer macros are in vme/include/wmacros.h, which macros.h includes. Each one adds an affect to the object and sets UNIT_FL_MAGIC on it. The bonus works only while the object is equipped (worn, wielded or held), not while it is carried.

Macro What it changes Allowed values
STR_TRANSFER(amount) strength amount -7..+7
DEX_TRANSFER(amount) dexterity amount -7..+7
CON_TRANSFER(amount) constitution amount -7..+7
CHA_TRANSFER(amount) charisma amount -7..+7
BRA_TRANSFER(amount) brain amount -7..+7
MAG_TRANSFER(amount) magic ability amount -7..+7
DIV_TRANSFER(amount) divine ability amount -7..+7
HIT_TRANSFER(amount) the hit point ability amount -7..+7
SKILL_TRANSFER(skill, amount) one skill, SKI_... (see Skill definitions) amount -7..+7
WEAPON_TRANSFER(weapon, amount) one weapon skill or weapon group, WPN_... (see weapon definitions) amount -7..+7
SPELL_TRANSFER(spell, amount) one spell skill or spell group, SPL_... (see Spell definitions) amount -7..+7
SPEED_TRANSFER(delta) attack speed: a positive delta makes the wearer faster delta -8..+8
SLOW_TRANSFER(delta) attack speed, slower: give a negative delta delta -8..+8
CHAR_FLAG_TRANSFER(flags) sets CHAR_ flags on the wearer, e.g. CHAR_FLAG_TRANSFER(CHAR_HIDE) CHAR_ flags

vmc checks the -7..+7 amounts: an object bad with DEX_TRANSFER(9) stops the compile with FATAL: bad: Adjustment 9 outside -7..+7 in ID -8.; the header's comments still say -10..+10, which is out of date. The speed limit is not checked by vmc: the server ignores a delta outside -8..+8 and logs it.

A ring that adds 1 to strength, from the dragon station:

maskwa
names {"maskwa platinum ring", "platinum ring", "maskwa ring", "maskwa",
       "ring"}
title "a Maskwa ring"
descr "A Maskwa platinum ring is lying here."
type ITEM_WORN
manipulate {MANIPULATE_TAKE, MANIPULATE_WEAR_FINGER}
STR_TRANSFER(+1)
weight 1
cost 100 COPPER_PIECE
end

An object can have several transfers. All the macros look alike; this is SKILL_TRANSFER as wmacros.h defines it:

/* skill MUST be one of SKI_XXX, amount in -10 to +10 */
#define SKILL_TRANSFER(skill, amount) \
flags {UNIT_FL_MAGIC}        \
affect                       \
   id ID_SKILL_TRANSFER      \
   duration -1               \
   data[0] skill             \
   data[1] amount            \
   firstf  TIF_SKI_INC       \
   tickf   TIF_NONE          \
   lastf   TIF_SKI_DEC       \
   applyf  APF_SKILL_ADJ;

The other macros differ in the id, the data values and the functions named in firstf, lastf and applyf; vmc checks that these match, so use the macros rather than writing affect blocks by hand. wmacros.h also has CURSED_OBJECT, which makes an object impossible to remove once worn.

Previous: Liquid macros file
Next: Skill definitions in values.h