Paste #22415: mynpc

Date: 2015/11/09 12:36:07 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


cchat:
    type: format
    format: "<&b><npc.name><&f><&co> <&a><text>"

my_npc:
    type: assignment
    actions:
        on assignment:
        - trigger name:click state:true
        - trigger name:chat state:true
    interact scripts:
    - 10 my_npc_interact

my_npc_interact:
    type: interact
    steps:
        1:
            click trigger:
                script:
                - narrate "Hello! Would you like me to show you around the server?"
                - narrate "Say /yes/ or /no/"
            chat trigger:
                1:
                    trigger: /Yes/ I'd love to
                    script:
                    - narrate format:cchat "Ok great, follow me!"
                    - create player MyNPC <npc.location> save:mynpc
                    - adjust <player> hide_entity:<npc>
                    - adjust <server.list_online_players.exclude[<player>]> hide_entity:<entry[mynpc].created_npc>
                    - run my_npc_path npc:<entry[mynpc].created_npc> def:<^npc>
                    - run my_npc_talk npc:<entry[mynpc].created_npc>
                    - zap 2
                2:
                    trigger: /No/ I don't want to
                    script:
                    - random {
                        - narrate format:cchat "Ok see yaa"
                        - narrate format:cchat "Bye then"
                        - narrate format:cchat "Another time then"
                        - narrate format:cchat "Sod you then I won't help you"
                        - narrate format:cchat "I am sad now"
                    }

my_npc_path:
    type: task
    definitions: masternpc
    script:
    - ^flag <npc> step:1
    - ~walk <def[masternpc].anchor[spot1]> auto_range
    - ^inject my_npc_trypause
    - flag <npc> step:2
    - ~walk <def[masternpc].anchor[spot2]> auto_range
    - ^inject my_npc_trypause
    - flag <npc> step:3
    - ~walk <def[masternpc].anchor[spot3]> auto_range
    - wait 1
    - remove <npc>
    - adjust <player> show_entity:<def[masternpc]>
    - zap 1 script:s@my_npc_interact

my_npc_trypause:
    type: task
    script:
    - ^while <npc.loaction.distance[<player.loaction>].is[OR_MORE].than[5]> {
        - narrate format:cchat "Come on!!,  please try and keep up with me!"
        - wait 2
        }

my_npc_talk:
    type: task
    script:
    - narrate format:cchat "Did you know we have magic sheep here, they can teleport you!!!"
    - wait 14
    - narrate format:cchat "I think the m8craft server is a cool place!"
    - while <npc.flag[step].is[OR_LESS].than[3]> {
        - wait 1
        }
    - narrate format:cchat "Hey I found this chest! Ohh, I have to go, find me again soon I will show you something realy good!"