This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
attach_points [2020/09/26 21:02] – justin | attach_points [2022/05/09 15:05] – justin | ||
---|---|---|---|
Line 5: | Line 5: | ||
=====Creating Attach Points===== | =====Creating Attach Points===== | ||
- | |||
Attach points for models can be created with the " | Attach points for models can be created with the " | ||
Line 19: | Line 18: | ||
=====Offset, | =====Offset, | ||
- | |||
There are several properties that can be adjusted for attach points from the [[Model Properties]] panel: //offset//, // | There are several properties that can be adjusted for attach points from the [[Model Properties]] panel: //offset//, // | ||
Line 28: | Line 26: | ||
=====Scripting with Attach Points===== | =====Scripting with Attach Points===== | ||
+ | Once you've set up any necessary attach points for your [[object|objects]] and the models to which they will be attached, you can use the [[Attach Object]] scripting function to trigger an [[object]] to be attached to a target [[entity]] in-game, for example to attach a torch to a wall tile when the player interacts with it. | ||
+ | The example below will attach the " | ||
<code bauxite> | <code bauxite> | ||
- | attach_object(" | + | attach_object(" |
</ | </ | ||
+ | Alternately, | ||
<code bauxite> | <code bauxite> | ||
- | attach_object(" | + | attach_object(" |
</ | </ | ||
+ | To detach a previously attached [[object]], you can use the [[Detach Object]] scripting function, for example to remove a book from a table when the player interacts with the table. | ||
+ | |||
+ | The example below will detach the [[object]] currently attached to the player' | ||
+ | <code bauxite> | ||
+ | detach_object(player, | ||
+ | </ | ||
+ | |||
+ | You can reference the [[object]] that's currently attached to an attach point using the " | ||
<code bauxite> | <code bauxite> | ||
- | detach_object(player, " | + | play_animation(player.attachment[" |
</ | </ | ||
=====Equipment===== | =====Equipment===== | ||
+ | Although most of the equipment system is yet to be implemented, | ||
- | Automatic attaching based on attach point ID when an item is equipped and an object model is assigned | + | 1) Toggle the " |
- | Steps to follow: | + | 2) Assign an [[object]] model to the [[item]] in the [[Item Editor]]. |
- | - Toggle " | + | 3) Create an attach point for both the [[character]] and [[object]] that matches |
- | - Assign an " | + | 4) Call the [[Equip Item]] scripting function |
- | - Create an attach point for both the character and object that match the equipment slot ID (e.g. " | + | <code bauxite> |
+ | equip_item(player, | ||
+ | </ | ||
- | - Call " | + | With this setup, calling the [[Unequip Item]] |
+ | |||
+ | <code bauxite> | ||
+ | unequip_item(player, | ||
+ | </ | ||
~~NOTOC~~ | ~~NOTOC~~ |