# # ****************************************************************************** # ___ _ ___ _ _ _ _ # | . \<_> ___ / __>| |<_>._ _ ___ ___| |_ ___ _| |_ # | _/| |/ ._> \__ \| || || ' |/ . |<_-<| . |/ . \ | | by: Kalebbroo & Collossal # |_| |_|\___. <___/|_||_||_|_|\_. |/__/|_|_|\___/ |_| art by: LittleRoomDev # # ****************************************************************************** # # This script is free and open source. You are permitted to do # whatever you want with it, EXCEPT sell any part of this or claim it # as your own work. Selling in game access, items, or item skins is fine. # If you use this script or model, please credit the creator and artist. # link to: # # # Developer https://github.com/kalebbroo # # Artist https://www.patreon.com/littleroomdev # # This Is a submission for the Denizen Script Contest # # Usage Instructions: # 1. Craft the Pie Slingshot using the following recipe: # - leather | string | leather # - stick | bow | stick # - leather | string | leather # 2. Craft Exploding Pies using the following recipe: # - gunpowder | sugar | gunpowder # - sugar | pie | sugar # - gunpowder | sugar | gunpowder # 3. Equip the Pie Slingshot and place regular pies or Exploding Pies # in your offhand. # 4. Shoot the Pie Slingshot to fire the pie. Regular pies will # blind and slow targets, while Exploding Pies will create # a large explosion. # ****************************************************************** Pie_Slingshot: type: item material: bow mechanisms: unbreakable: true custom_model_data: 1 display name: Pie Slingshot lore: - Launches pies at enemies - Special Ability: Pie Barrage - Fires a barrage of pies, blinding and slowing targets flags: ability: pie_barrage recipes: 1: type: shaped recipe_id: pie_slingshot_recipe group: joke_weapons output_quantity: 1 input: - leather|string|leather - stick|bow|stick - leather|string|leather Exploding_Pie: type: item material: arrow mechanisms: unbreakable: true custom_model_data: 1 display name: Exploding Pie lore: - Explodes on impact - Use with the Pie Slingshot for explosive results recipes: 1: type: shaped recipe_id: exploding_pie_recipe group: joke_weapons output_quantity: 1 input: - gunpowder|sugar|gunpowder - sugar|pumpkin_pie|sugar - gunpowder|sugar|gunpowder Pie_Slingshot_Ability: type: world debug: true events: on player raises Pie_Slingshot: - narrate "Hold right-click to charge up your Pie Slingshot!" - define offhand - if != creative && !<[offhand].advanced_matches[*pie]>: - narrate "You are out of AMMO! You need to have a pie in your offhand!" - animate player animation:START_USE_MAINHAND_ITEM - determine cancelled - else: - animate player animation:START_USE_MAINHAND_ITEM - wait 1s - animate player animation:STOP_USE_ITEM on player chooses arrow: - narrate "Release right-click to fire your Pie Slingshot!" - determine cancelled on player lowers Pie_Slingshot reason:lower: # Check if the player has a pie or exploding pie in their offhand. If not, cancel the event and send a message - narrate "Release right-click to fire your Pie Slingshot!" - define offhand - if != creative: - if !<[offhand].advanced_matches[*pie]>: - narrate "You are out of AMMO! You need to have a pie in your offhand!" - animate animation:STOP_USE_ITEM - determine cancelled - else: - take slot:offhand - define projectile <[offhand]> - define time - if <[offhand].advanced_matches[Exploding_pie]>: - define type exploding - else: - define type regular - if <[time]> > 0.1: - playsound sound:ENTITY_GLOW_SQUID_HURT volume:3 pitch: - shoot <[offhand]> origin: destination: speed:<[time].min[4]> spread:<[time].mul[5].min[10]> script:pie_fire shooter: def:type on player shoots Pie_Slingshot: # prevent using arrows - determine cancelled pie_fire: type: task debug: true definitions: type script: - define projectile <[last_entity]> - define shooter <[projectile].shooter> - shoot <[projectile]> source:<[shooter]> speed:2.0 spread:0.0 - while <[projectile].is_valid>: - wait 1t - define projectile_location <[projectile].location> - if <[type]> == regular: # define the location once for performance - playeffect at:<[projectile_location]> effect:ITEM_CRACK qty:10 spread:0.2 item:pumpkin_pie - playeffect <[projectile_location]> effect:CLOUD qty:5 spread:0.1 - playeffect <[projectile_location]> effect:NOTE qty:3 spread:0.05 - playeffect <[projectile_location]> effect:HEART qty:5 spread:0.1 - playeffect <[projectile_location]> effect:SPELL_MOB qty:5 spread:0.1 - if <[type]> == exploding: - playeffect <[projectile_location]> effect:EXPLOSION_NORMAL qty:5 spread:0.1 - playeffect <[projectile_location]> effect:ITEM_CRACK qty:10 spread:0.2 item:tnt - playeffect <[projectile_location]> effect:SMOKE_NORMAL qty:5 spread:0.1 - playeffect <[projectile_location]> effect:CRIT qty:5 spread:0.1 - playeffect <[projectile_location]> effect:VILLAGER_ANGRY qty:5 spread:0.1 - run pie_impact def:<[projectile_location]>|<[shooter]>|<[type]> pie_impact: type: task debug: true definitions: location|shooter|type script: - define impact_location <[location]> - if <[type]> == regular: - playeffect <[impact_location]> effect:ITEM_CRACK qty:50 spread:0.5 item:pumpkin_pie - playeffect <[impact_location]> effect:CLOUD qty:30 spread:0.3 - playeffect <[impact_location]> effect:NOTE qty:20 spread:0.2 - playeffect <[impact_location]> effect:HEART qty:20 spread:0.2 - playeffect <[impact_location]> effect:SPELL_MOB qty:20 spread:0.2 - foreach <[impact_location].find.living_entities.within[5]> as:target: - if <[target].entity_type> != player: - adjust <[target]> potion_effects:[type=BLINDNESS;amplifier=0;duration=200t;ambient=false;particles=true;icon=true] - adjust <[target]> potion_effects:[type=SLOW;amplifier=2;duration=200t;ambient=false;particles=true;icon=true] - hurt <[target]> damage:0.5 source:<[shooter]> - playeffect <[target].location.add[0,1,0]> effect:ITEM_CRACK qty:20 spread:0.1 item:pumpkin_pie - if <[type]> == exploding: - playeffect <[impact_location]> effect:EXPLOSION_HUGE qty:1 spread:0.0 - playeffect <[impact_location]> effect:ITEM_CRACK qty:50 spread:0.5 item:tnt - playeffect <[impact_location]> effect:CRIT qty:50 spread:0.5 - playeffect <[impact_location]> effect:VILLAGER_ANGRY qty:50 spread:0.5 - foreach <[impact_location].find.living_entities.within[5]> as:target: - if <[target].entity_type> != player: - adjust <[target]> health:<[target].health.sub[10]> - playeffect <[target].location.add[0,1,0]> effect:ITEM_CRACK qty:20 spread:0.1 item:tnt - playeffect <[target].location.add[0,1,0]> effect:CRIT qty:20 spread:0.1 - playeffect <[target].location.add[0,1,0]> effect:VILLAGER_ANGRY qty:20 spread:0.1