Paste #20367: killzombie

Date: 2015/09/24 13:49:29 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


KillZombies:
    type: assignment
    actions:
        on assignment:
        - trigger name:click state:true
        - trigger name:chat state:true
        - trigger name:proximity state:true radius:4
    interact scripts:
    - 10 KillZombiesInteract

npcchat:
    type: format
    format: "<&b><npc.name> <&f>to you<&co> <&2><text>"

KillZombiesWorld:
    type: world
    events:
        on player kills zombie:
            - if !<player.has_flag[KillZombiesActive]> queue clear
            - flag player KillZombieCount:++
            - if <player.flag[KillZombieCount]> >= 5 {
                - wait 1s
                - narrate "<gray><italic>[You have killed 5 Zombies.]"
                - wait 1s
                - narrate "<gray><italic>[Return to Maoki.]"
                - flag player KillZombiesActive:!
                - flag player KillZombieCount:!
                - flag player KillZombiesTurnin
            }

KillZombiesInteract:
    type: interact
    steps:
        1:
            click trigger:
                script:
                - if <player.has_flag[engaged]> {
                    - queue clear
                }
                else {
                    - flag player engaged
                    - narrate format:npcchat "<player.name>, I am glad you are here."
                    - wait 3s
                    - narrate format:npcchat "Zombies are getting plentiful in the area and I need someone to help."
                    - wait 3s
                    - narrate format:npcchat "Will you kill at least <white>5 Zombies <dark_green>for me to help keep them in check?"
                    - wait 3s
                    - narrate "<dark_green>Type <white>Yes <dark_green>or <white>No."
                    - flag player engaged:!
                    - zap step:2
                }
        2:
            chat trigger:
                1:
                    trigger: /Yes/, I will aid you.
                    script:
                        - if <player.has_flag[engaged]> queue clear
                        - flag player engaged
                        - narrate format:npcchat "Thank the Aesir. Please hurry and return to me when you are done."
                        - wait 2s
                        - narrate "[<gray><&o>Kill 5 Zombies and return to Maoki.]"
                        - flag player KillZombieCount:0
                        - flag player KillZombiesActive
                        - flag player engaged:!
                        - zap step:3
                2:
                    trigger: /No/, I cannot help at this time.
                    script:
                        - if <player.has_flag[engaged]> queue clear
                        - flag player engaged
                        - random {
                            - narrate format:npcchat "Well then...hopefully I can keep them at bay until you can help."
                            - narrate format:npcchat "I understand. At least keep watch in case they become too great in number."
                            - narrate format:npcchat "I am sorry to hear that. Please come back soon. We could really use your help."
                            }
                        - flag player engaged:!
                        - zap step:1
        3:
            click trigger:
                script:
                - if <player.has_flag[KillZombiesActive]> {
                        - flag player engaged
                        - random {
                            - narrate format:npcchat "Please, do not waste any time. The sooner those zombies are killed, the better off we will be."
                            - narrate format:npcchat "I hope the zombies are not too much trouble for you. They always seem to grow in number."
                            - narrate format:npcchat "I cannot thank you enough for helping. I will feel so much better knowing you have culled those things."
                        }
                        - flag player engaged:!
                }
                else if <player.has_flag[KillZombiesTurnin]> {
                    - flag player engaged
                    - narrate format:npcchat "It seems you have helped exterminate some of the zombies."
                    - wait 2s
                    - narrate format:npcchat "You are a true friend to have helped me. Please take this as a token of my thanks."
                    - wait 3s
                    - narrate "<gray><&o>[You have received 1 diamond from Maoki.]"
                    - give i@diamond
                    - wait 3s
                    - narrate format:npcchat "I hope that will suffice for now, <player.name>. I may soon again call for your aid."
                    - flag player KillZombiesTurnin:!
                    - flag player KillZombiesCooldown duration:24h
                    - flag player engaged:!
                    - zap step:4
                }
        4:
            click trigger:
                script:
                - if <player.flag[KillZombiesCooldown]> == 0h {
                    - narrate format:npcchat "Ah, you have come back to help with more zombies have you?"
                    - narrate "<dark_green>Type <white>Yes <dark_green>or <white>No."
                    - zap step:5
                }
                else if <player.flag[KillZombiesCooldown]> > 0h {
                    - wait 1s
                    - narrate format:npcchat "Thankfully the zombies are not too great in number right now."
                    - wait 2s
                    - narrate format:npcchat "Come back in <player.flag[KillZombiesCooldown].expiration.formatted> and you can help again!"
                }

        5:
            chat trigger:
                1:
                    trigger: /Yes/, I want help again.
                    script:
                        - narrate format:npcchat "Very good then! I am always happy to have your help!"
                        - wait 1s
                        - narrate "[<gray><&o>Kill 5 Zombies and return to Maoki.]"
                        - flag player KillZombieCount:0
                        - flag player KillZombiesActive
                        - flag player engaged:!
                        - zap step:3