Difference between revisions of "TYPEDEF"
m (→Built-in Types: added t_carpentry, t_spawn_char, t_game_piece, t_portculis, t_figurine) |
m (→Built-in Types: started adding more type, but ran out of time...) |
||
Line 223: | Line 223: | ||
* MOREP = The coordinates that the moongate leads to | * MOREP = The coordinates that the moongate leads to | ||
|- | |- | ||
− | | | + | | t_chair || 40 || This type is used for any sort of a chair item and it's only purpose is to trigger a sitting animation. |
+ | |- | ||
+ | | t_forge || 41 || This type is used by blacksmiths to smelt ore.... | ||
|- | |- | ||
| t_ore || 42 || This type is harvested by miners, and converted by blacksmiths (using a forge) into something else. It leverages the following properties: | | t_ore || 42 || This type is harvested by miners, and converted by blacksmiths (using a forge) into something else. It leverages the following properties: | ||
* TDATA1 = ID of item created when the ore is smelted (usually ingots) | * TDATA1 = ID of item created when the ore is smelted (usually ingots) | ||
|- | |- | ||
− | | | + | | t_log || 43 || This type is a raw material resource usually harvested from trees. |
|- | |- | ||
| t_tree || 44 || This type is chopped by lumberjacks to get logs. It leverages the following properties: | | t_tree || 44 || This type is chopped by lumberjacks to get logs. It leverages the following properties: | ||
* FRUIT = ID of item gathered if double-clicked (usually logs) | * FRUIT = ID of item gathered if double-clicked (usually logs) | ||
|- | |- | ||
− | | . | + | | t_rock || 45 || This type can be mined for ore. |
+ | * MORE1 = The regiontype ID that determines what sorts of resources (fish etc) that it can produce (is this true?) | ||
+ | |- | ||
+ | | t_carpentry_chop || 46 || A carpentry tool that can be used to craft carpentry objects as well as used to "chop" trees (like a saw?) | ||
+ | |- | ||
+ | | || || | ||
+ | t_multi 47 // = multi part object like house or ship. | ||
+ | t_reagent 48 // = alchemy when clicked ? | ||
+ | t_ship 49 // = this is a ship multi | ||
+ | t_ship_plank 50 // | ||
+ | t_ship_side 51 // = should extend to make a plank | ||
+ | t_ship_side_locked 52 // | ||
+ | t_ship_tiller 53 // = tiller man on the ship. | ||
+ | t_eq_trade_window 54 // = container for the trade window. | ||
+ | t_fish 55 // = fish can be cut up. | ||
+ | t_sign_gump 56 // = things like grave stones and sign plaques | ||
+ | t_stone_guild 57 // = guild stones | ||
+ | t_anim_active 58 // = active anium that will recycle when done. | ||
+ | t_sand 59 // = sand on the beach | ||
+ | t_cloth 60 // = bolt or folded cloth | ||
+ | t_hair 61 // | ||
+ | t_beard 62 // = just for grouping purposes. | ||
+ | t_ingot 63 // = ingot. | ||
+ | t_coin 64 // = coin of some sort. gold or otherwise. | ||
|- | |- | ||
| t_crops || 65 || This type is used to grow plants that likely bear fruit. Double clicking a t_crop item will harvest the fruit if it is ripe. It leverages the following properties: | | t_crops || 65 || This type is used to grow plants that likely bear fruit. Double clicking a t_crop item will harvest the fruit if it is ripe. It leverages the following properties: | ||
Line 242: | Line 267: | ||
'''Note''' This type has unusual TIMER behavior in that regardless of the ATTR flags, the timer will restart when it reaches zero. | '''Note''' This type has unusual TIMER behavior in that regardless of the ATTR flags, the timer will restart when it reaches zero. | ||
|- | |- | ||
− | | | + | | || || |
+ | t_drink 66 // = some sort of drink (non booze) | ||
+ | t_anvil 67 // = for repair. | ||
+ | t_port_locked 68 // = this portcullis must be triggered. | ||
+ | t_spawn_item 69 // = spawn other items. | ||
+ | t_telescope 70 // = big telescope pic. | ||
+ | t_bed 71 // = bed. | ||
+ | t_gold 72 // = gold coin | ||
+ | t_map 73 // = map object with pins. | ||
+ | t_eq_memory_obj 74 // = a char has a memory link to some object. (i am fighting with someone. this records the fight.) | ||
+ | t_weapon_mace_staff 75 // = staff type of mace. or just other type of mace. | ||
+ | t_eq_horse 76 // = equipped horse object represents a riding horse to the client. | ||
+ | t_comm_crystal 77 // = communication crystal. | ||
+ | t_game_board 78 // = this is a container of pieces. | ||
+ | t_trash_can 79 // = delete any object dropped on it. | ||
+ | t_cannon_muzzle 80 // = cannon muzzle. not the other cannon parts. | ||
+ | t_cannon 81 // = the rest of the cannon. | ||
+ | t_cannon_ball 82 // | ||
+ | t_armor_leather 83 // = non metallic armor (t_clothing) | ||
|- | |- | ||
| t_seed || 84 || This type is used for seeds. A seed can be created by using a dagger on a fruit (assuming the fruit is setup to have a seed.) A seed can be planted by double clicking it and targeting the ground (specifically t_dirt items). It leverages the following properties: | | t_seed || 84 || This type is used for seeds. A seed can be created by using a dagger on a fruit (assuming the fruit is setup to have a seed.) A seed can be planted by double clicking it and targeting the ground (specifically t_dirt items). It leverages the following properties: |
Revision as of 03:06, 8 November 2010
Type definitions are the equivalent of EVENTS that can be attached to items. There are different properties that can be used to attach a type block to an item or set of items:
- item definitions via their TYPE and/or TEVENTS property.
- items via their TYPE and/or EVENTS property.
In addition to handling triggers, type definitions can also be used to define different types of terrain. This can be used to affect the return value of the TYPE property on map points, or for some hardcoded types such as t_rock it can be used to define which terrain IDs Sphere should consider to be rock when the mining skill is used.
Built-in Types
The built-in types are all listed in the sphere_defs.scp file. The table below only lists some of the built-in types and it is VERY weak on actual details...so use with care.
DEFNAME | Number | Description |
---|---|---|
t_normal | 0 | No built-in behavior. |
t_container and t_container_locked | 1 and 2 | These types are used for containers. They leverage the following properties:
|
t_door or t_door_unlocked | 3 or 4 | This type is used for both locked and unlocked doors. They leverage the following properties:
|
t_key | 5 | This type is used for keys. It leverages the following properties:
Note: Keys, containers, and doors are interesting. If both a key and a door/container contain the same arbitrary MORE1 value, the key can be used to lock or unlock the door/container. That action changes the TYPE of the door/container to indicate whether it is locked or not. It also seems like LINK on the key can be set to the UID of a multi so that it can be used to open all doors/containers inside that multi. |
t_light_lit | 6 | This type is used for light sources that can be turned on or off. It leverages the following properties:
|
t_light_out | 7 | This type is used for light sources that can be turned on or off. It leverages the following properties:
|
t_food | 8 | This type is used for edible food. It leverages the following properties:
|
t_food_raw | 9 | This type is used for raw food. It leverages the following properties:
|
t_armor | 10 | This type is used for armor. It leverages the following properties:
Note: Old versions of sphere stored remaining charges in MORE2, this is no longer true. |
t_weapon_mace_smith | 11 | This type is used for macefighting weapons that can also be used by blacksmiths to forge items. It leverages the following properties:
The following overrides can be set on a per item basis:
|
t_weapon_mace_sharp | 12 | This type is used for macefighting weapons that have sharp cutting edges. It leverages the following properties:
The following overrides can be set on a per item basis:
|
t_weapon_sword | 13 | This type is used for swordsmanship weapons. It leverages the following properties:
The following overrides can be set on a per item basis:
|
t_weapon_fence | 14 | This type is used for fencing weapons. It leverages the following properties:
The following overrides can be set on a per item basis:
|
t_weapon_bow | 15 | This type is used for archery weapons (bow or crossbow). It leverages the following properties:
The following overrides can be set on a per item basis:
|
t_wand | 16 | This type is used for magic wands. It leverages the following properties:
|
t_telepad | 17 | This type is used for teleport pads. It leverages the following properties:
|
t_switch | 18 | This type is used for switches. The way these things work is, when used, they trigger @DCLICK on the LINK object. It leverages the following properties:
|
t_book | 19 | This type is used for books of static or dynamic text. It leverages the following properties:
Note: we need more information on those flags... |
t_rune | 20 | This type is used for recall runes. It leverages the following properties:
|
t_booze | 21 | This type is used for alcohol (it causes a drunk effect when double clicked.) It leverages the following properties:
|
t_potion | 22 | This type is used for potions. It leverages the following properties:
|
t_fire | 23 | This type is used for fires (and ovens?). These items can be used to cook food, and they can burn you if stepped on. It leverages the following properties:
|
t_clock | 24 | This type is used to tell time (game time, not real time) when double clicked. The result comes out something like "half past eleven o'clock at night". From what I can tell there are no MORE or TDATA modifiers that affect the result. |
t_trap and t_trap_active | 25 and 26 | These types are used for traps that are triggered when walked on. They leverage the following properties:
|
t_musical | 27 | This type is used for musical instruments. It leverages the following properties:
|
t_spell | 28 | This type is used for magic spell effects. It leverages the following properties:
|
t_gem | 29 | This type is used for gems, and from what I can tell there is no built-in behavior for it. |
t_water | 30 | This type is used for water, which means it can be fished in or used to clean used bandages.
|
t_clothing | 31 | This type is used for all cloth based equip-able items. It is essentially identical to t_armor and t_armor_leather. It leverages the following properties:
Note: Old versions of sphere stored remaining charges in MORE2, this is no longer true. |
t_scroll | 32 | This type is used for scrolls. It leverages the following properties:
|
t_carpentry | 33 | This type is used by carpenters to craft items, and from what I can tell there is no built-in behavior for it. |
t_spawn_char | 34 | This type is used to spawn NPCs. Once it spawns its first creature, it will turn red and change its appearance to the ICON of the creature (or appear as a wisp if the spawn is set to use a template.) It leverages the following properties:
Note: The spawn is considered active if the TIMER has a positive value, and when the timer reaches zero, it is automatically restarted using a random number between MOREX and MOREX. |
t_game_piece | 35 | This type is used for game board pieces (checkers, chess, etc). They cannot be removed from the game, and they have no tile image outside of the game board gump. It leverages the following properties:
|
t_portculis | 36 | This type is used for portcullis doors that raise and lower when double clicked. It leverages the following properties:
|
t_figurine | 37 | This type is used for shrunk NPCs (essentially magic figurines), that turn into a "pet" creature when double clicked. It leverages the following properties:
|
t_shrine | 38 | This type is used for shrines. They will resurrect a ghost when double-clicked by a ghost. |
t_moongate | 39 | This type is used for moongates. When stepped on they teleport the player to another location. It leverages the following properties:
|
t_chair | 40 | This type is used for any sort of a chair item and it's only purpose is to trigger a sitting animation. |
t_forge | 41 | This type is used by blacksmiths to smelt ore.... |
t_ore | 42 | This type is harvested by miners, and converted by blacksmiths (using a forge) into something else. It leverages the following properties:
|
t_log | 43 | This type is a raw material resource usually harvested from trees. |
t_tree | 44 | This type is chopped by lumberjacks to get logs. It leverages the following properties:
|
t_rock | 45 | This type can be mined for ore.
|
t_carpentry_chop | 46 | A carpentry tool that can be used to craft carpentry objects as well as used to "chop" trees (like a saw?) |
t_multi 47 // = multi part object like house or ship. t_reagent 48 // = alchemy when clicked ? t_ship 49 // = this is a ship multi t_ship_plank 50 // t_ship_side 51 // = should extend to make a plank t_ship_side_locked 52 // t_ship_tiller 53 // = tiller man on the ship. t_eq_trade_window 54 // = container for the trade window. t_fish 55 // = fish can be cut up. t_sign_gump 56 // = things like grave stones and sign plaques t_stone_guild 57 // = guild stones t_anim_active 58 // = active anium that will recycle when done. t_sand 59 // = sand on the beach t_cloth 60 // = bolt or folded cloth t_hair 61 // t_beard 62 // = just for grouping purposes. t_ingot 63 // = ingot. t_coin 64 // = coin of some sort. gold or otherwise. | ||
t_crops | 65 | This type is used to grow plants that likely bear fruit. Double clicking a t_crop item will harvest the fruit if it is ripe. It leverages the following properties:
Note This type has unusual TIMER behavior in that regardless of the ATTR flags, the timer will restart when it reaches zero. |
t_drink 66 // = some sort of drink (non booze) t_anvil 67 // = for repair. t_port_locked 68 // = this portcullis must be triggered. t_spawn_item 69 // = spawn other items. t_telescope 70 // = big telescope pic. t_bed 71 // = bed. t_gold 72 // = gold coin t_map 73 // = map object with pins. t_eq_memory_obj 74 // = a char has a memory link to some object. (i am fighting with someone. this records the fight.) t_weapon_mace_staff 75 // = staff type of mace. or just other type of mace. t_eq_horse 76 // = equipped horse object represents a riding horse to the client. t_comm_crystal 77 // = communication crystal. t_game_board 78 // = this is a container of pieces. t_trash_can 79 // = delete any object dropped on it. t_cannon_muzzle 80 // = cannon muzzle. not the other cannon parts. t_cannon 81 // = the rest of the cannon. t_cannon_ball 82 // t_armor_leather 83 // = non metallic armor (t_clothing) | ||
t_seed | 84 | This type is used for seeds. A seed can be created by using a dagger on a fruit (assuming the fruit is setup to have a seed.) A seed can be planted by double clicking it and targeting the ground (specifically t_dirt items). It leverages the following properties:
|
... | 85-114 | FIXME!!! |
t_deed | 115 | This type is used to create something else when double clicked. It is perhaps the best solution for a player to place a multi part item like a house. When double clicked, it will prompt for a target location. It leverages the following properties:
|
... | 116-128 | FIXME!!! |
t_fruit | 129 | This type is used for fruit. When double clicked, fruit will be eaten. Fruit can be grown from crops (t_crop). It leverages the following properties:
|
... | 130-144 | FIXME!!! |
t_foliage | 145 | This type is very similar to t_crops, the difference being the foliage does not disappear when the fruit is harvested. It leverages the following properties:
Note This type has unusual TIMER behavior in that regardless of the ATTR flags, the timer will restart when it reaches zero. |
... | 146-175 | FIXME!!! |
t_eq_script | 176 | This type can have tags and can be equipped. Possibly used for memory objects that leverage @Equip and @UnEquip triggers. |
... | 177-182 | FIXME!!! |
t_script | 183 | This type can have tags, but can NOT be equipped. |
Scripted TYPEDEFs
DEFNAME | File | Description |
---|---|---|
t_advance_gate | ??.scp | MORE = ID of character to change into |
Syntax
The syntax for defining a type is:
[TYPEDEF defname]
TERRAIN=id
TERRAIN=start_id, end_id
ON=trigger_name
script
ON=trigger_name
script
Any number of triggers can be handled by one TYPEDEF definition, however it is not possible to handle the same trigger twice without using multiple definitions.
The trigger name can be the name of any item trigger. The return value from the script can affect Sphere's hardcoded behaviour in different ways. See the documentation for the trigger to discover what parameters are passed in to each trigger and what the return values do.
Note: If the defname matches any of Sphere's hardcoded types (see 'typedefs' block in sphere_defs.scp), then the TYPEDEF can be used to override the behaviours of items of that type.
Examples
// // Water definition from default script pack. // [TYPEDEF t_water] TERRAIN = 0a8 0ab TERRAIN = 0136 0137
// // Makes an item speak when double clicked. // [TYPEDEF t_exampletype] ON=@DClick SAY I have been double clicked! RETURN 2