summaryrefslogtreecommitdiff
path: root/doc/script_commands.txt
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-11-12 01:46:40 +0100
committerHaru <haru@dotalux.com>2017-11-12 01:46:40 +0100
commitab1c84c8586b18ebb194d2f67120df7307399712 (patch)
tree35dc8320db48da8d26ba7c9aee9bfeef04933f80 /doc/script_commands.txt
parent82da003c98d1525b6302cb7c753959a3b3e8c10d (diff)
downloadhercules-ab1c84c8586b18ebb194d2f67120df7307399712.tar.gz
hercules-ab1c84c8586b18ebb194d2f67120df7307399712.tar.bz2
hercules-ab1c84c8586b18ebb194d2f67120df7307399712.tar.xz
hercules-ab1c84c8586b18ebb194d2f67120df7307399712.zip
Add type constants for the getiteminfo()/setiteminfo() buildins
Replacements are as follows: 0 => ITEMINFO_BUYPRICE 1 => ITEMINFO_SELLPRICE 2 => ITEMINFO_TYPE 3 => ITEMINFO_MAXCHANCE 4 => ITEMINFO_SEX 5 => ITEMINFO_LOC 6 => ITEMINFO_WEIGHT 7 => ITEMINFO_ATK 8 => ITEMINFO_DEF 9 => ITEMINFO_RANGE 10 => ITEMINFO_SLOTS 11 (Subtype, for weapons and ammunitions) => ITEMINFO_SUBTYPE 11 (ViewSprite, for other item types) => ITEMINFO_VIEWSPRITE (NOT AVAILABLE YET) 12 => ITEMINFO_ELV 13 => ITEMINFO_WLV 14 => ITEMINFO_VIEWID 15 => ITEMINFO_MATK (NOT AVAILABLE YET - this was documented but never implemented) Calls to getiteminfo() and setiteminfo() have been replaced with the newly introduced constants. Other constants (such as W_ weapon subtypes) in related code have been replaced as well, to improve code readability. This fixes an issue in the Eden Tutorial script "Tutorial Goal", where ITEMINFO_ATK was accidentally used instead of ITEMINFO_WEIGHT. Note: calls to getiteminfo or setiteminfo with numeric type arguments in third party scripts must be replaced with the respective constants. The use of numeric literals is no longer recommended, and those values may change in the future without notice. See the getiteminfo documentation for details. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'doc/script_commands.txt')
-rw-r--r--doc/script_commands.txt48
1 files changed, 24 insertions, 24 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 940302982..c8496d227 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -3176,23 +3176,43 @@ Example:
---------------------------------------
*getiteminfo(<item ID>, <type>)
+*setiteminfo(<item ID>, <type>, <value>)
This function will look up the item with the specified ID number in the
database and return the info set by TYPE argument.
It will return -1 if there is no such item.
Valid types are:
- 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
- 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
+
+ ITEMINFO_BUYPRICE - Buy Price
+ ITEMINFO_SELLPRICE - Sell Price
+ ITEMINFO_TYPE - Item Type
+ ITEMINFO_MAXCHANCE - Max drop chance of this item e.g. 1 = 0.01% , etc..
if = 0, then monsters don't drop it at all (rare or a quest item)
if = 10000, then this item is sold in NPC shops only
- 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
- 10 - slot; 11 - subtype; 12 - elv; 13 - wlv; 14 - view id
+ ITEMINFO_SEX - Sex
+ ITEMINFO_LOC - Equip location
+ ITEMINFO_WEIGHT - Weight (note: 1/10 of unit)
+ ITEMINFO_ATK - Attack
+ ITEMINFO_DEF - Defense
+ ITEMINFO_RANGE - Range
+ ITEMINFO_SLOTS - Slots
+ ITEMINFO_SUBTYPE - Item subtype
+ ITEMINFO_ELV - Equip min. level
+ ITEMINFO_WLV - Weapon level
+ ITEMINFO_VIEWID - View ID ("Sprite" field in the Item DB)
If RENEWAL is defined, 15 - matk
Check sample in doc/sample/getiteminfo.txt
+The setiteminfo function will, instead, set the item's parameters. It returns
+the new value on success, or -1 on failure (item_id not found).
+
+Example:
+
+ setiteminfo(Stone, ITEMINFO_WEIGHT, 9990); // Stone now weighs 999.0
+
---------------------------------------
*getequipisenableopt(<equipment slot>)
@@ -8296,26 +8316,6 @@ Example:
---------------------------------------
-*setiteminfo(<item id>, <type>, <value>)
-
-This function will set some value of an item.
-Returns the new value on success, or -1 on fail (item_id not found or
-invalid type).
-
-Valid types are:
- 0 - Buy Price; 1 - Sell Price; 2 - Item Type;
- 3 - maxchance (Max drop chance of this item e.g. 1 = 0.01% , etc..
- if = 0, then monsters don't drop it at all (rare or a quest item)
- if = 10000, then this item is sold in NPC shops only
- 4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
- 10 - slot; 11 - subtype; 12 - elv; 13 - wlv; 14 - view id
-
-Example:
-
-setiteminfo Stone, 6, 9990; // Stone now weighs 999.0
-
----------------------------------------
-
*setitemscript(<item id>, <"{ new item script }">{, <type>})
Set a new script bonus to the Item. Very useful for game events.