Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Routine: SetTarget

Haliotro edited this page Dec 17, 2012 · 15 revisions

Makes the entity change its aggro target. Valid targets are the valid entity references for the Event type that you are in, or the value none.

Syntax

- 'set.{entity}_target': '{entity or none}'

Examples

#Let's assume that you've been tagging players that you don't want being targeted
Target: #Don't let them aggro this player!
    - 'if target_tagvalue_noaggro = 1':
        - 'cancel' #First, you're canceling the targeting, so the player won't be targeted
        - 'nearby.entity.Player.10': #Second, you're looking for any other viable targets so that the same player doesn't keep taking and canceling the aggro
            - 'if it_tagvalue_noaggro != 1':
                - 'set.entity_target': 'it'

Damage: #Cause a zombie to become confused and attack its own kind.
    - 'switch.attacker.type':
        - 'Player':
            - 'if target.type.Zombie':
                - 'if chance.5': #give a 5% chance to cause the zombie to attack nearby zombies
                    - 'nearby.target.Zombie.10': #check for other nearby zombies
                        - 'set.target_target': 'it' #change target to a nearby zombie
                        - 'tag.target.aggrochanged': '1' #set a flag so you know that aggro was changed
                    - 'if target_tagvalue_aggrochanged = 1':
                        - 'untag.target.aggrochanged' #unset the flag
                        - 'message.attacker':
                            - '&aThe zombie is now confused!'
Clone this wiki locally