Paste #43645: BA Pets

Date: 2017/08/20 02:18:14 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


PETS: # this definitely works
    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> 
                        }
                        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>
                        - follow followers:<context.entity> target:<player> 
                         }
                        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>
                        - follow followers:<context.entity> target:<player> 
                         }
                        else {
                            - narrate "<&7>[<&b>Pets<&7>] <&c>You already have a pet!"
                        }    
                }   

PETS_ABILITIES: # I actually don't know if this works or not
    type: world
    events:
        on player chats:
        - if <player.has_flag[pets.current_pet]> {
            - if <li@call|whistle|whistles|*whistles*.contains[<context.message>]> {
                - run 'PETS_CALL'
            }

PETS_ATTACK_OVERRIDE: # This Thing Isn't Working
    type: world
    events:
        on entity damages entity:
        - choose "<context.entity>": 
            - case "default": 
                - if <player.has_flag[pets.current_pet]> {
                    - attack <player.flag[pets.current_pet]> target:<context.entity>
                }
        - case "player": 
            - if <player.has_flag[pets.current_pet]> {
                - attack <player.flag[pets.current_pet]> target:<context.damager>
                }

PETS_CALL: # This Thing Isn't Working
    type: task
    script:
    - define pet <player.flag[pets.current_pet]||null>
    - if <player.location.distance[<def[pet].location>]> < 100 {
        - walk <def[pet]> <player.location>
    }
    else {
        - teleport <def[pet]> <player.location>
        - playeffect <def[pet].location> effect:CLOUD visibility:500 quantity:40 offset:0.5
    }



# CHECKER:
#    type: world
#    events:
#        on player steers entity:
#        - narrate <context.entity>
#        - narrate <context.sideways>
#        - narrate <context.forward>
#        - narrate <context.jump>
#        - narrate <context.dismount>

#Anyone aware of a way to adjust the durability of an item in hand?
#NEW MESSAGES
#Mergu - Today at 12:56 AM
#@Kaiyoko use <context.forward> to move the entity towards the player's direction
#suspic - Today at 12:57 AM
#- adjust <player.item_in_hand> durability:# save:result
#- inventory set o:<entry[result].result> d:<player.inventory> slot:<player.item_in_hand.slot>

#more like if <entity.flag[owner].is[==].to[<player.uuid>]>


#STEAL AN EGG FROM DRAGONS TO TAME