Date: 2014/12/06 18:37:21 UTC-08: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
# ---------------------------------------------------------------------------- #
# |
# |
# D o u b l e J u m p e r |
# |
# Let your players do double jumps |
# |
# |
# Author: |Anthony| |
# Version: 0.1 |
# dScript Version: 0.9.6-b1545 |
# |
# ---------------------------------------------------------------------------- #
# |
# |
# ABOUT: |
# |
# Players will be able to do double jumps. You can set a flag to let |
# some folks actually fly. |
# - flag <player> fly_enabled |
# |
# |
# ---------------------------------------------------------------------------- #
DoubleJump:
type: world
debug: false
speed: 0
events:
on player joins:
- wait 1t
- adjust <player> can_fly:true
on player changes gamemode:
- wait 1t
- adjust <player> can_fly:true
on player walks:
# - narrate "player <player.location.y>"
# - narrate "context old <c.old_location.y>"
# - narrate "context new <c.new_location.y>"
- if <c.new_location.y.is[LESS].than[<c.old_location.y>]||false> {
- if <c.new_location.sub[0,0.1,0].material.is[!=].to[m@air]||false> {
- queue clear
}
- if <player.has_flag[falling]||false> {
- queue clear
}
- if <player.has_flag[jumping]||false> {
- event "player jump|player stops jumping" context:state|stop|to_location|<c.old_location>|from_location|<player.flag[jumping]>
- flag <player> jumping:!
}
- flag <player> falling:<c.old_location>
- event "player fall|player starts falling" context:state|start|from_location|<c.old_location>
- while <player.location.standing_on.material.is[==].to[m@air]||false> {
- if <player.is_online.not> {
- while stop
}
- wait 1t
}
- event "player fall|player stops falling" context:state|stop|to_location|<player.location>|from_location|<c.old_location>
- narrate "Fall Distance <c.old_location.y.sub[<player.location.simple.as_location.y>]||0> blocks"
- narrate "Fall Distance <c.old_location.y> - <player.location.y>"
- wait 1t
- flag <player> falling:!
- queue clear
}
- if <c.new_location.y.is[MORE].than[<c.old_location.y>]||false> {
- narrate "UP"
- if <c.new_location.sub[0,0.1,0].material.is[!=].to[m@air]||false> {
- queue clear
}
- if <player.has_flag[jumping]||false> {
- queue clear
}
- flag <player> jumping:<c.old_location>
- narrate "Jump Event"
- event "player jump|player starts jumping" context:state|start|from_location|<c.old_location>
# - define old_location '<player.location.y>'
# - wait 1t
# - while <player.location.y.is[MORE].than[<def[old_location]>]||false> {
# - wait 1t
# - define old_location <player.location.y>
# }
## - define old_location <player.location.y>
# - narrate "JumpA <def[old_location].sub[<player.flag[jumping]>]||0> blocks"
# - flag <player> jumping:!
- queue clear
}
# - if <c.new_location.y.is[==].to[<c.old_location.y>]||false> {
# - if <player.has_flag[falling].not||false> {
# - queue clear
# }
# - narrate "FallB <player.flag[falling].sub[<c.old_location.y>]||0> blocks"
# - flag <player> falling:!
# - queue clear
# }
on player starts jumping:
- narrate "Jumping from <c.from_location.y>"
on player starts falling:
- narrate "Falling from <c.from_location.y>"
on player stops jumping:
- narrate "Jump Height <c.to_location.y.sub[<c.from_location.y>]||0> Blocks"
on player stops falling:
- narrate "Fall Distance <c.from_location.y.sub[<c.to_location.y>]||0> Blocks"
on player jumps:
- if <player.has_flag[launched]||false> {
- queue clear
}
- while <player.location.standing_on.material.name.is[==].to[air]||false> {
- if <player.is_online.not> {
- while stop
}
- wait 1t
}
- define fall '<c.location.y.sub[<player.location.y>]>'
- adjust <player> can_fly:false
- adjust <player> 'fall_distance:%fall%'
# - narrate "fall distance %fall%"
- adjust <player> can_fly:true
on player starts flying:
- if <player.has_flag[fly_enabled]||false>
|| <player.gamemode.id.is[==].to[1]> {
- queue clear
}
- wait 5t
- adjust <player> can_fly:false
- define maxY '<player.location.y>'
- while <player.location.standing_on.material.name.is[==].to[air]||false> {
- if <player.is_online.not> {
- while stop
}
- wait 1t
}
- adjust <player> fall_distance:<def[maxY].sub[<player.location.y>].mul[0.75]||0>
- adjust <player> can_fly:true