Paste #43631: BendingAge Pets

Date: 2017/08/19 10:50:28 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


PETS:
    type: world
    events:
        on player right clicks entity:
        - choose <context.entity.entity_type>: 
            - case POLAR_BEAR: 
                - if <player.item_in_hand> == i@raw_fish[quantity=64] {
                    - if !<player.has_flag[pets.current_pet]> {
                        - narrate "THIS IS A BEAR"
                        - take i@raw_fish quantity:64
                        - playeffect <context.entity.location> effect:HEART visibility:500 quantity:10 offset:2
                        - flag player pets.current_pet:<context.entity.uuid>
                        }
                        else {
                            - narrate "<&7>[<&b>Pets<&7>] <&c>You already have a pet!"
                        }    
                }    
            - case WOLF: 
                - if <player.item_in_hand> == i@bone[quantity=16] {
                    - if !<player.has_flag[pets.current_pet]> {
                        - narrate "THIS IS A WOLF"
                        - take i@bone quantity:16
                        - playeffect <context.entity.location> effect:HEART visibility:500 quantity:10 offset:2.0
                        - flag player pets.current_pet:<context.entity.uuid>
                         }
                        else {
                            - narrate "<&7>[<&b>Pets<&7>] <&c>You already have a pet!"
                        }    
                }
            - case OCELOT: 
                - if <player.item_in_hand> == i@raw_fish[quantity=16] {
                    - if !<player.has_flag[pets.current_pet]> {
                        - narrate "THIS IS A CAT"
                        - take i@raw_fish quantity:16
                        - playeffect <context.entity.location> effect:HEART visibility:500 quantity:10 offset:2.0
                        - flag player pets.current_pet:<context.entity.uuid>
                         }
                        else {
                            - narrate "<&7>[<&b>Pets<&7>] <&c>You already have a pet!"
                        }    
                }   

PETS_ABILITIES: 
    type: world
    events:
        on player chats:
        - if <player.has_tag[pets.current_pet]> {
            - if <li@call|whistle|whistles|*whistles*.contains[<context.message>]> {
                - run 'PETS_CALL'
            } 
            - if <li@call|go|*points*.contains[<context.message>]> {
                - run 'PETS_GOTO'
            } 
            - if <li@call|attack|harm.contains[<context.message>]> {
                - run 'PETS_ATTACK'
            } 
            - if <li@call|defend|protect.contains[<context.message>]> {
                - run 'PETS_DEFEND'
            }  
            - if <li@call|get|retrieve|fetch.contains[<context.message>]> {
                - run 'PETS_RETRIEVE'
            } 
        }

PETS_CALL:
    type: task
    script:
    - define pet <player.flag[pets.current_pet_UUID]||null>
    - if <player.location.distance[<def[value]>.location]> < 201 {
        - walk <def[value]> <player.location>
    }
    else {
        - teleport <def[value]> <player.location>
        - playeffect <def[value].location> effect:CLOUD visibility:500 quantity:40 offset:0.5
    }