Paste #129706: Woodsman

Date: 2025/01/04 12:46:55 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


spawn_woodsman:
    type: item
    debug: true
    material: stick
    display name: summon woodsman
    recipes:
        1:
            type: shaped
            input:
                - air|air|air
                - air|oak_log|air
                - air|stick|air


spawn_woodsmand_handler:
    type: world
    debug: true
    events:
        on player right clicks block with:spawn_woodsman:
        - create player WoodsMan <context.location.add[0,1,0]> save:WoodsMan
        - equip <entry[WoodsMan].created_npc> hand:iron_axe
        - adjust <entry[WoodsMan].created_npc> can_pickup_items:true
        - assignment set script:woodsman_npc_assignment npc:<entry[WoodsMan].created_npc>

woodsman_npc_assignment:
    type: assignment
    debug: true
    actions:
        on assignment:
        - trigger name:click state:true
        - define woodsman_chest_location <npc.location.add[1,0,0]>
        - wait 1t

        - foreach <npc.location.find_blocks[*log].within[50]> as:WOOD:
            - walk <npc> <[WOOD].right> auto_range
            - wait 1s system
            - while <npc.is_navigating>:
                - wait 3s system
            - chat "distance above  <[WOOD].y.sub[<npc.location.y>]>"

            - if <[WOOD].y.sub[<npc.location.y>]> < 4:
                - break <[WOOD]> <npc> radius:3
        - foreach <npc.location.find_blocks[*leaves].within[50]> as:LEAVES:
            - ~walk <npc> <[LEAVES].below> auto_range
            - wait 1s system
            - while <npc.is_navigating>:
                - wait .1s system
            - chat "distance above  <[LEAVES].y.sub[<npc.location.y>]>"

            - if <[LEAVES].y.sub[<npc.location.y>]> < 4:
                - break <[LEAVES]> <npc> radius:3

        on click:
        - chat "hello"