This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| attach_points [2020/09/27 15:12] – justin | attach_points [2022/05/09 15:06] (current) – justin | ||
|---|---|---|---|
| Line 28: | Line 28: | ||
| 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. | 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. | 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> | <code bauxite> | ||
| - | detach_object(player, | + | detach_object(player, | 
| + | </ | ||
| + | |||
| + | You can reference the [[object]] that's currently attached to an attach point using the " | ||
| + | <code bauxite> | ||
| + | play_animation(player.attachment[" | ||
| </ | </ | ||
| Line 54: | Line 62: | ||
| <code bauxite> | <code bauxite> | ||
| - | equip_item(player, | + | equip_item(player, | 
| </ | </ | ||
| + | |||
| + | With this setup, calling the [[Unequip Item]] scripting function will automatically detach the [[object]] model associated with the [[item]] that is unequipped. | ||
| + | |||
| + | <code bauxite> | ||
| + | unequip_item(player, | ||
| + | </ | ||
| + | |||
| ~~NOTOC~~ | ~~NOTOC~~ | ||