Paste #6610: Guard dog

Date: 2014/07/08 21:45:08 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
        - flag npc SamDamage
    Events:
        on <npc> damages entity:
        - if <context.damager.flag[SamDamage]> == true {
            - determine 100
            }
    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:
                    - define target <npc.location.find.living_entities.within[10].exclude[<n@1>|<npc.owner>|chicken|cow|sheep|pig].get[1]||false>
                    - attack <t[<def[target].is[!EQUALS].to[false]>]:target<&co>%target%||cancel>
                4:
                    trigger: /Sit boy/!
                    script:
                    - Narrate "Sam has stopped guarding."
                    - attack stop