Date: 2016/08/14 07:31:15 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
# Let us go back to the first world script we made, the one with the Armorstand.
ClickMithrilOre:
type: world ## World scripts trigger only when the event happens.
events:
on player right clicks at ARMOR_STAND: ## In this case the event triggers when a player right click ANY Armorstand.
- if <context.entity> == e@141d286a-d697-4932-9441-a0232191b4c4 { ## Only after that we check if the Armorstand id is the right one.
- if <player.flag[DwarfMithrilOre]> == 1 { ## In the IF we have <context.entity> this is called a tag.
- narrate "<&o>I can't carry anymore." ## This specific tag is equal to the Armorstands id which is different for reach Armorstand.
- wait 1
} else {
- ^narrate "<&o>You gather some Mithril Ore."
- ^give i@MithrilOre qty:1
- ^flag player DwarfMithrilOre:1
}
}
DwarfPie: ## Remember, we made this item before but now we need a world script to make it give health when consumed.
type: item
material: pumpkin_pie
display name: <&6><&l>Dwarven Pie
lore:
- <&8>Consumable
- <&7><&o>Strong alcoholic pie,
- <&7><&o>likely to render drunk.
- <&f>
- <&2>Use: <&a>Restores 25 Health.
DwarfPieEat:
type: world
events:
on player right clicks with i@DwarfPie: ## This is another event, it triggers when you right click with the specific custom item
- determine passively cancelled ## All this line does is CANCEL the right click (so you don't accidently place the item or eat it)
- ^take i@DwarfPie qty:1 ## Now we instantly (note the ^) take the pie from the player's inventory.
- ^heal 25 <context.player> ## After that we heal the player, this is called a command (like the give/take).
- ^narrate "You restore 25 Health." ## Little text message to tell you what happened.
- ^cast CONFUSION power:10 duration:20s ## Another command, it casts the Confusion effect on the player.
DwarfJetPack:
type: item
material: cauldron_item
display name: <&6><&l>Jetpack
lore:
- <&9>Epic
- <&7><&o>This generates a vertical thrust
- <&7><&o>by a downward discharge of steam,
- <&7><&o>thereby rocketing the player in the air.
- <&f>
- <&2>Use: <&a>Consumes one Charcoal.
- <&2>Use: <&a>Rockets the player in the air. ## A little harder one, first me make the item.
DwarfJetPackScript:
type: world
events:
on player right clicks with i@DwarfJetPack: ## We use the same event as before, right click with a specific item.
- ^determine cancelled passively ## Cancel the click, otherwise the player might accidenly place his JetPack on the ground.
- if <player.world> == w@survival || <player.world> == w@survival_the_end || <player.world> == w@survival_nether { ## Now we check whether the player is in survival or (||) in the end or the nether.
- if <player.flag[cooldownJetPackMaze]> == true { ## We check whether the item is on cooldown or not.
- narrate "<player.flag[cooldownJetPackMaze].expiration.formatted> cooldown remaining." ## Narrate the flag duration that is still remaining.
} else {
- if "<player.inventory.contains[Charcoal].qty[1]>" { ## If it is not on cooldown then we check if the player has Charcoal.
- ^take charcoal from:<player.inventory> qty:1 ## If they have Charcoal we continue with a chain of commands.
- ^playeffect <player.location> effect:cloud qty:25 ## We create particles, shoot the player up a little and wait 0.2s to repeat it all.
- shoot <player> destination:<player.location.add[0,12,0]> speed:0.5 height:0.5 no_rotate
- wait 0.2s
- ^playeffect <player.location> effect:cloud qty:25
- shoot <player> destination:<player.location.add[0,12,0]> speed:0.5 height:0.5 no_rotate
- wait 0.2s
- ^playeffect <player.location> effect:cloud qty:25
- shoot <player> destination:<player.location.add[0,12,0]> speed:0.5 height:0.5 no_rotate
- wait 0.2s
- ^playeffect <player.location> effect:cloud qty:25
- shoot <player> destination:<player.location.add[0,12,0]> speed:0.5 height:0.5 no_rotate
- wait 0.2s
- ^playeffect <player.location> effect:cloud qty:25
- shoot <player> destination:<player.location.add[0,12,0]> speed:0.5 height:0.5 no_rotate
- wait 0.2s
- ^playeffect <player.location> effect:cloud qty:25
- shoot <player> destination:<player.location.add[0,12,0]> speed:0.5 height:0.5 no_rotate
- wait 0.2s
- ^playeffect <player.location> effect:cloud qty:25
- shoot <player> destination:<player.location.add[0,12,0]> speed:0.5 height:0.5 no_rotate
- wait 0.2s
- ^playeffect <player.location> effect:cloud qty:25
- ^cast DAMAGE_RESISTANCE duration:4.5s power:8 <player>
- ^flag player "cooldownJetPackMaze:true" duration:15.0S
} else { ## This else is for if the player does not have Charcoal.
- narrate "You need Charcoal to power the Jetpack."
}
}
}
Commandwebsite: ## Quick and small script to change or add a certain command.
type: world ## This is not a very important script though
events:
on website command:
- if <context.args.get[1]||null> == null { ## If the 2nd argument in the command is null, meaning you only typed /website and not /website t
- narrate "<&2><&l>Link to the website:" ## Only then do we narrate information.
- narrate "<&a>www.everhold.enjin.com/home"
- determine passively FULFILLED ## This means we fulfill the command, meaning you do not get the wrong command message.
}
berserkdamaged: ## Very simple ability script for a boss.
type: world
events:
on SkeletonBerserk damaged: ## It triggers when the boss takes damage.
- if <util.random.int[1].to[10]> == 4 { ## This takes a random integer from 1 to 10 and if it is equal to 4
- narrate "<&4><&l>Skeleton Berserk: <&f>SPEED! I SHALL FEED UPON YOUR BONES!" ## This means there is a 10 percent chance the boss uses this ability when damaged.
- cast speed <context.entity> d:2 p:3 ## The ability is a simple speed boost but it could be more complicated.
} ## We could, for example, shoot the player a few blocks back or make the boss spawn additional monsters.
SpawnBosses:
type: world
debug: false
events:
on Zombie spawns because NATURAL in SURVIVAL: ## Event triggers when a zombie spawns by default (not spawners) in survival world.
- ^flag n@901 Boss:<util.random.int[1].to[90]> ## Now we flag a specific NPC (my variable NPC) with a random number between 1 and 90.
- if <n@901.flag[Boss]> == 10 { ## Then for each boss we check if the number is equal to something and if it is then we spawn it.
- ^spawn ZombieKing <context.location> save:boss ## Note the save:boss so we can reuse it in the next commands.
- ^cast FIRE_RESISTANCE d:10000 p:10 <entry[boss ].spawned_entities>
- ^equip <entry[boss].spawned_entities> hand:gold_sword offhand:i@shield[base_color=YELLOW;patterns=li@WHITE/STRAIGHT_CROSS] ## Next we finally equip the boss with his weapons, and shield in this case.
- ^determine cancelled passively
}
- if <n@901.flag[Boss]> == 30 {
- ^spawn SkeletonBerserk <context.location> save:boss
- ^equip <entry[boss].spawned_entities> hand:i@Claw[unbreakable=true;flags=li@HIDE_Attributes|Hide_unbreakable] offhand:i@Claw[unbreakable=true;flags=li@HIDE_Attributes|Hide_unbreakable]
- ^cast FIRE_RESISTANCE d:10000 p:10 <entry[boss].spawned_entities>
- ^determine cancelled passively
}
screamloopdwarfstory: ## This is a task script, it does not have any event and can only be triggered manually or with a loop.
type: task
debug: false
script:
- foreach <server.list_online_players> { ## This is the foreach .. and in this case the do it for each online player.
- if <%value%.world> == w@DwarfVillage && <%value%.flag[RPGStoryVillageStory]> < 10 { ## %value% is <player> in this case because we took foreach player online.
- random { ## We check if they are in the DwarvenVillage AND if they have not finished the story.
- narrate "<&4><&l>???: <&f>AAAAAAAAAARRRRRGGGGGHHHHH..." targets:%value% ## If they finished the story their flag:RPGStoryVillageStory would be 15 in this case.
- narrate "<&4><&l>???: <&f>GOD DARN IT!" targets:%value% ## Then we just randomly play a screaming sound or narrate something.
- narrate "<&4><&l>???: <&f>WHY YOU LITTLE.. I WILL KILL YOU!" targets:%value%
- narrate "<&4><&l>???: <&f>AAAAAAAAAAAAARRRRRRRRGGGGGGGGHHHHHHH..." targets:%value%
- narrate "<&4><&l>???: <&f>AAAAAAAAAARRRRRRRGGGGGGHHHHHHH..." targets:%value%
- narrate "<&4><&l>???: <&f>RUN ALL YOU WANT YOU ARE NOT GETTING AWAY! GET BACK HERE!" targets:%value%
- playsound ENTITY_WOLF_HOWL <%value%.location> pitch:1.6 volume:1
- playsound ENTITY_WOLF_HOWL <%value%.location> pitch:1.6 volume:1
- playsound ENTITY_WOLF_HOWL <%value%.location> pitch:1.6 volume:1
}
}
}
- ^run screamloopdwarfstory instantly delay:240s ## This is the most important part about a loop, it runs itself again after a certain delay, here it is 4 minutes.
# Now these are just examples, there are many and many events you can use to make a world script and there are lots of tags you can check for.
# There are also a lot of commands, more than I can show you but everything I showed you here is the basics and if you know this you can make simple quests and stories.