Paste #1999: for Reason

Date: 2014/02/12 17:47:46 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17


# | Handles the world event for entity spawning and fires @KillPlayer_Task
KillPlayer_World:
    type: world
    events:
      on entity spawns:
      # Run the attack script precisely one tick from now.
      - run KillPlayer_Task def:<context.location> delay:1t

# | Causes the entity at %location% to attack the nearest player
KillPlayer_Task:
    type: task
    definitions: location
    script:
    # If there is a player nearby, attack!
    - if <def[location].find.players.within[10].get[1]> != null {
      - attack <def[location].find.living_entities.within[5].get[1]> target:<def[location].find.players.within[10].get[1]>
      }