Paste #48373: testPaste

Date: 2018/07/04 10:48:24 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Talker:
    type: assignment

    actions:
      on assignment:
      - trigger name:chat toggle:true
      - trigger name:click toggle:true
      - trigger name:proximity toggle:true

    interact scripts:
    - 10 Talker_i

TalkerFormat:
  type: format
  format: <&a><npc.name><&co> <&7><&o><text>

Talker_i:
    type: interact

    steps:
        First*:
            proximity trigger:
                Entry Radius: 3
                Exit Radius: 3
                Entry:
                    Script:
                    #The player enters on radius, so the NPC asks a question
                    - CHAT format:TalkerFormat 'Seyd gegrüßt werter Bewohner Erianors! Wie geht es euch?*schaut ihn an*'
                    #The NPC waits for the answer, we set the flag to stop the movement and call the task to stop/move the NPC
                    - flag npc "AllowedToMove:0"
                    - ZAP 'SCRIPT:Talker_i' step:Second
                    - runtask "script:Wait_on_place"


        Second:
            chat trigger:
                1:
                    Trigger: /gut/ habt dank
                    script:
                    #If the player answers, the NPC says something and change the falg to keep moving
                    - CHAT format:TalkerFormat "Das freut mich zu hören! Nun *rückt den Helm zurecht* ich muss nun los! *zieht weiter*"
                    - flag npc "AllowedToMove:1"
                    - ZAP 'SCRIPT:Talker_i' step:First

                2:
                    Trigger: /wunderbar/ und euch?
                    script:
                    - CHAT format:TalkerFormat "Das liegt sicherlich an unserem ehrenwerten König Ranulf und seiner unendlichen Güte! *nickt und geht weiter*"
                    - flag npc "AllowedToMove:1"
                    - ZAP 'SCRIPT:Talker_i' step:First

                #unexpected answer
                3:
                    Trigger: /REGEX:\w+/
                    script:
                    - CHAT format:TalkerFormat "Nun denn.. *versteht offenbar nicht* Auf bald!"
                    - flag npc "AllowedToMove:1"
                    - ZAP 'SCRIPT:Talker_i' step:First

Wait_on_place:
  Type: Task
  Script:
  - flag npc "wait_xposwait:<npc.location.x>"
  - flag npc "wait_xposwait:++"
  - flag npc "wait_maxwaiting:0"
  - if <flag.n:AllowedToMove> == 0 runtask "script:Wait_on_place_loop"

Wait_on_place_loop:
  Type: Task
  Script:
  - walkto "location:<flag.n:wait_xposwait>,<npc.location.y>,<npc.location.z>,<npc.location.world>" "speed:0.00001"
  - flag npc "wait_maxwaiting:++"
     #There is a maximum time the NPC will wait for an answer, if you increase the number on the condition the NPC will wait more time
  - if <flag.n:wait_maxwaiting> == 15 flag npc "AllowedToMove:1"
  - if <flag.n:AllowedToMove> == 0 runtask "script:Wait_on_place_loop"