Skip to content

FAQ: How do I use tagging?

KoryuObihiro edited this page Dec 26, 2011 · 17 revisions

Tagging is a currently experimental system that allows for basic persistence of information outside of the scope of a single event with an integer value. An entity tag is set until either ModDamage is reloaded, or the tag is unset by a routine. The examples below assume you are familiar with these tagging routines:

Tags are relatively simple to use. Here's a simple example:

Death:
    - 'tag.target.deathcount.(target_tagvalue_deathcount + 1)'
Spawn:
    - 'if target.istagged.deathcount':
        - 'message.target.You have died %target_tagvalue_deathcount% times on this server!'
Damage:
    - 'if attacker.group._cursedOne and target.type.player':
        - 'tag.target.cursed.4'
Time:
    - 'if target.istagged.cursed':
        - 'tag.target.cursed.(target_tagvalue_cursed - 1)'
        - 'if target_tagvalue_cursed.lessthanqequals.0':
            - 'untag.target.cursed'

A more advanced example here is intended to produce a "Left for Dead 2" type of play:

Damage:
    - 'if attacker.group.Undead and !target.istagged.infected':
        - 'if target.type.player and target_health.lessthan.7':
            - 'message.world.&4%target.name% has been infected by %attacker.name%!' # Inform the world of their blunder with a nicely-formatted message.
            - 'tag.target.infected' # Set the infection tag.
    - 'if_not attacker.group.PermaInfected or attacker.istagged.infected': # Not an infected or zombie person.
        - 'if attacker.wielding.gold_sword and target': '3' # Gold swords have a purifying effect, with people who aren't infected.
Death:
    - 'if_not attacker.group.Undead or target.istagged.infected':
        - 'if attacker.wielding.gold_sword and target.istagged.infected':
            - 'message.world.&6%target.name% was purified by %attacker.name%!' # Purification get!

Summary: Members of the group PermaZombie infect others, who can in turn infect others. Non-infected players wielding a gold sword can "purify" infected players by killing them.

Another example involving recursion and the usage of a tag's associated value with a Delay routine can also be found at the Explode calculation wiki entry.

Clone this wiki locally