Date: 2020/10/22 13:46:53 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
#
# Feel free to use it however you like :D
#
# version 0.2
# author: RoboChicken
#
# skill keys:
# CLICK:
# - triggers when player right clicks any block including air
# - ideal for activating aoe or utility skills
# ATTACK:
# - triggers when attacking an entity
# - for combat skills
# BOW:
# - triggers when an entity shoots a bow
# - can be used to change the type of projectile
# - or add effects when shooting the bow
# ARROW:
# - triggers when an arrow/projectile hits an entity or a block
# - useful for making custom arrows
# SHIELD:
# - triggers when a player toggles his shield either hand
#
# There are predefined tags that you can use directly in your task scripts
# but make sure you add the tags that you are using in the "definitions" key
# of your task script to prevent vscode from detecting it as an error
#
# A little heads up for the spigot boys, you will have to change the code for the arrow
# skill because the <context.item> tag for the bow shooting event only works on paper.
# hint: use a tag that gets the first arrow item of the player's inventory
#
item_skills_handler:
type: world
debug: false
events:
on player right clicks block using:hand:
- if <context.item.script.data_key[skills.click]||null> != null:
- define player <player>
- define item <context.item>
- define location <context.location||<player.location>>
- define relative <context.relative||null>
- inject <[item].script.data_key[skills.click]>
on player damages entity:
- if <context.damager.item_in_hand.script.data_key[skills.attack]||null> != null:
- define player <context.damager>
- define item <context.damager.item_in_hand>
- define entity <context.entity>
- define finalDamage <context.final_damage>
- inject <[player].item_in_hand.script.data_key[skills.attack]>
on player shoots bow:
- if <context.item.script.data_key[skills]||null> != null:
- define player <context.entity>
- define projectile <context.projectile>
- define bow <context.bow>
- define force <context.force>
- define item <context.item>
- if <[item].script.data_key[skills.bow]||null> != null:
- inject <[item].script.data_key[skills.bow]>
- if <[item].script.data_key[skills.arrow]||null> != null:
- flag <[projectile]> shooter:<[player]>
- flag <[projectile]> bow:<[bow]>
- flag <[projectile]> force:<[force]>
- flag <[projectile]> arrow:<[item]>
- flag <[projectile]> skills.arrow:<context.item.script.data_key[skills.arrow]>
on projectile hits block:
- if <context.projectile.has_flag[skills.arrow]>:
- define player <context.projectile.flag[shooter]>
- define bow <context.projectile.flag[bow]>
- define force <context.projectile.flag[force]>
- define arrow <context.projectile.flag[item]>
- define location <context.location>
- inject <context.projectile.flag[skills.arrow].as_script>
on projectile collides with entity:
- if <context.projectile.has_flag[skills.arrow]>:
- define player <context.projectile.flag[shooter]>
- define bow <context.projectile.flag[bow]>
- define force <context.projectile.flag[force]>
- define arrow <context.projectile.flag[item]>
- define projectile <context.projectile>
- define entity <context.entity>
- inject <[projectile].flag[skills.arrow].as_script>
# doesnt have much tags but would be nice if
# theres a tag for the shield item and whatever hand is using it
on player toggles shield:
- if <player.item_in_hand.script.data_key[skills.shield]||null> != null:
- define player <player>
- define item <player.item_in_hand>
- define state <context.state>
- define hand hand
- inject <[item].script.data_key[skills.shield]>
- if <player.item_in_offhand.script.data_key[skills.shield]||null> != null:
- define player <player>
- define item <player.item_in_offhand>
- define state <context.state>
- define hand off_hand
- inject <[item].script.data_key[skills.shield]>