server-1.12/doc/Developers/item_transformation

55 lines
1.8 KiB
Plaintext

Through the 'use' command, it is possible to define complex item transformations.
'use' will work on 2 items, which will be called 'item1' and 'item2'.
Syntax for command is 'use item1 with item2'.
item2 is searched for a key/value of the form, in this order:
* on_use_with_<item1's archetype name>
* on_use_with_<item1's type>_<item1's subtype>
* on_use_with_<item1's type>
If no key is found, use will simply not do anything.
If a key is found, it's processed to know what to do.
Syntax of the value is pretty simple:
* add [number] archetype: will give the player [number] items of archetype specified
* remove $1: will remove one item1
* remove $2: will remove one item2
Note that remove can appear multiple times, but you can't specify a precise number to remove.
----------------------------------------------------------
There is also an 'ITEM_TRANSFORMER' (163) item type.
Last update: 2005-07-19.
An item transformer is simply applied, after having marked a 'victim' item.
If the victim is suitable, it will be transformed into something else.
To make an item transformable, you just have to fill the 'slaying' field.
The syntax is:
slaying slayer:[yield ]new_item[;slayer:[yield ]new_item]*
with [] denoting optional part, and * any number of preceding [].
Example, for object apple:
slaying knife:2 half_apple
This means that, when applying a knife (non existing item with type of 163),
one 'apple' will be transformed into 2 'half_apple'.
Pretty simple, hopefully.
Transformer uses food value to count how many times it can be used. 0 denotes
unlimited uses.
The 'slaying' field of the 'transformer' is a verb used to construct a message.
More complex imaginary example:
Object water
slaying bowl:full_bowl;paper:wet_paper
if paper and bowl are 'transformer' items.