Skip to content

Relaction

Black Ram edited this page Jan 13, 2024 · 15 revisions

Relaction

In Information there is the possibility of creating relationships between characters.

Example:

He is my:"
$ friendI.setRelationNameByCharacter(character= mc)
I'm [friend]'s:"
$ mcI.setRelationNameByCharacter(character= friend)
$ relaction = mcI.getRelationNameByCharacter(friend)
friend "Hi my [relaction]"
$ relaction = friendI.getRelationNameByCharacter(mc)
mc "Hi my [relaction]"

How to use

You must first create a dictionary with the names of the relactions (the names are important).

the dictionary is formed like this:

  • key: a value of your choice for the sole purpose of identifying the type of relationship.
  • Value: that is, a string or string composed of the name of the relationship and synonyms. The addition of synonyms is fundamental because when the player enters a text to say what type of relationship he wants with the character the system will search the entire tuple to see if there is a match.

Remember: the first value of the tuple will be the one that will be displayed, and the remaining ones will be used as synonyms

For example:

define relactions = {
    "mom": (__("Mom"), __("Mother"), __("Mum"), __("Mummy"), __("Mommy")),
    "dad":( __("Dad"), __("Father"), __("Daddy"), __("Daddey")),
    "son": __("Son"),
    "daughter": (__("Daughter"), __("Daugther")),
    "brother": __("Brother"),
    "sister": __("Sister"),
    "uncle": __("Uncle"),
    "aunt": __("Aunt"),
    "cousin": __("Cousin"),
    "friend": __("Friend"),
    "girlfriend": __("Girlfriend"),
    "boyfriend": __("Boyfriend"),
}

Get Relation Name By Character

(code-snippets: DR_RelationGet)

python:
    relaction = mcI.getRelationNameByCharacter(character = mario, relaction_types = relactions)
mario "Hi my [relaction]"

Set Relation Name By Character

(code-snippets: DR_RelationSetOrAdd)

python:
    mcI.setRelationNameByCharacter(character = mario, relation_key = "friend", relaction_types = relactions)

Clone this wiki locally