AddAssociation(source as noderef, association_type as string, target as noderef)
- A node reference referring to the source node.
- A node reference referring to the target node that is being associated.
For more information, please see the section on Associations.
To associate a sword as being "in" a backpack, the backpack would be the source node, the sword would be the target, and the association type would be "in".
public function Initialize() swordref as noderef = CreatePersistedNodeFromClass("thingie") // Create sword node reference backpackref as noderef = CreatePersistedNodeFromClass("container") // Create backpack node reference AddAssociation(me, "wearing", backpackref) // Put the backpack on a player AddAssociation(me, "base_hard_association", backpackref) // Make a hard association so it saves AddAssociation(backpackref, "in", swordref) // Put the sword in the backpack AddAssociation(backpackref, "base_hard_association", swordref) // Make a hard association so it saves MsgArea("Associations created.") .