This takes care of all the work of creating an equipment. The equipped creature is saved in card_instance.targets[8].
For a simple example, see Bonesplitter. For an advanced example, see Cranial Plating.