Date: 2024/06/29 01:03:24 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# # ******************************************************************************
# ___ _ ___ _ _ _ _
# | . \<_> ___ / __>| |<_>._ _ ___ ___| |_ ___ _| |_
# | _/| |/ ._> \__ \| || || ' |/ . |<_-<| . |/ . \ | | 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: <gold>Pie Slingshot
lore:
- <yellow>Launches pies at enemies
- <gold>Special Ability: Pie Barrage
- <gray>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: <red>Exploding Pie
lore:
- <red>Explodes on impact
- <dark_red>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 "<gold>Hold right-click to charge up your Pie Slingshot!"
- define offhand <player.inventory.slot[offhand].display||air>
- if <player.gamemode> != creative && !<[offhand].advanced_matches[*pie]>:
- narrate "<red>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 "<gold>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 "<gold>Release right-click to fire your Pie Slingshot!"
- define offhand <player.inventory.slot[offhand].display||air>
- if <player.gamemode> != creative:
- if !<[offhand].advanced_matches[*pie]>:
- narrate "<red>You are out of AMMO! You need to have a pie in your offhand!"
- animate <player> animation:STOP_USE_ITEM
- determine cancelled
- else:
- take slot:offhand
- define projectile <[offhand]>
- define time <context.held_for.in_seconds>
- if <[offhand].advanced_matches[Exploding_pie]>:
- define type exploding
- else:
- define type regular
- if <[time]> > 0.1:
- playsound <player.location> sound:ENTITY_GLOW_SQUID_HURT volume:3 pitch:<util.delta_time_since_start.in_ticks.as_element.sin.add[2]>
- shoot <[offhand]> origin:<player.location.add[0,1.2,0].forward[1]> destination:<player.eye_location.forward[50]> speed:<[time].min[4]> spread:<[time].mul[5].min[10]> script:pie_fire shooter:<player> 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