Paste #6534: Guard Dog

Date: 2014/07/07 18:44:14 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Sam:
    type: Assignment
    actions:
        on assignment:
        - flag npc mobprox_range:20
    interact scripts:
    - 10 SamAI

SamAI:
    type: Interact
    steps:
        1:
            chat trigger:
                1:
                    trigger: /Come/!
                    script:
                    - follow target:<player>
                2:
                    trigger: /Stay/!
                    script:
                    - follow stop
                3:
                    trigger: /Attack/!
                    script:
                    - attack <npc.location.find.living_entities.within[10].replace[chicken|cow|sheep|pig].random>
                    - run SamDamage
                4:
                    trigger: /Sit boy/!
                    script:
                    - Narrate "Sam has stopped guarding."
                    - attack stop
SamDamage:
    Type: Task
    Script:
    - narrate "Sam is now guarding!"
    - if <npc.location.find.living_entities.within[10].replace[chicken|cow|sheep|pig].random> == <player> {
        - Attack stop 
        } else {
        - hurt 5 <npc.location.find.living_entities.within[10].replace[chicken|cow|sheep|pig].random>
        - run SamAI step:3 delay:5t
        }