- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register








The script repo is an archive of historical scripts. For modern scripts, or to post your own, please use the Scripts forum section.





Staff Pick: Double Jump


By Anthony
Created: 2014/12/02 21:37:52 UTC-08:00 (10 years and 22 days ago)
Edited: 2014/12/28 16:46:29 UTC-08:00 (9 years and 361 days ago)
Likes: 1

Staff pick as of: 2014/12/02 21:44:42 UTC-08:00 (10 years and 22 days ago)
Denizen Version: 0.9.6-b1546
Script Version: 1.0
Description:

Double Jumper
Let your players do double jumps.


Upload this script to your scripts folder and reload. Players with the fly_enabled flag will be able to fly.


Download script | View raw 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
12600

# ---------------------------------------------------------------------------- #
#                                                                              |
#                                                                              |
#                           D o u b l e   J u m p e r                          |
#                                                                              |
#                       Let your players do double jumps                       |
#                                                                              |
#                                                                              |
#   Author: |Anthony|                                                          |
#   Version: 0.2                                                               |
#   dScript Version: 0.9.6-b1546                                               |
#                                                                              |
# ---------------------------------------------------------------------------- #
#                                                                              |
#                                                                              |
# 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:
    - if <c.new_location.y.is[LESS].than[<c.old_location.y>]||false> {
#      - narrate "Down"
      - if <c.new_location.sub[0,0.1,0].material.is_solid||false> {
        - queue clear
        }
      - if <player.has_flag[falling]||false> {
        - queue clear
        }
      - flag <player> falling:<c.old_location>
      - 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:!
        }
      - event "player fall|player starts falling" context:state|start|from_location|<c.old_location>
      - while <player.location.sub[0,0.1,0].material.is_solid.not||false> {
        - if <player.is_online.not> {
          - while stop
          }
        - wait 1t
        }
      - event "player fall|player stops falling" context:state|stop|to_location|<player.location.simple.as_location>|from_location|<player.flag[falling].as_location>
      - flag <player> falling:!
      - queue clear
      }

    - if <c.new_location.y.is[MORE].than[<c.old_location.y>]||false> {
#      - narrate "Up"
      - if <c.new_location.y.sub[<c.old_location.y>].is[==].to[0.5]> {
        - queue clear
        }
      - if <c.new_location.sub[0,0.1,0].material.is_solid||false> {
        - queue clear
        }
      - if <player.has_flag[jumping]||false> {
        - queue clear
        }
      - if <player.has_flag[falling]||false> {
        - queue clear
        }
      - flag <player> jumping:<c.old_location>
      - event "player jump|player starts jumping" context:state|start|from_location|<c.old_location>
      - queue clear
      }


    on player stops falling:
      - define fallDistance '<c.from_location.y.sub[<c.to_location.y>]||0>'
      - if <player.has_flag[launched]||false> {
        - queue clear
        }
      - if <player.has_flag[doublejump]> {
        - adjust <player> can_fly:false
        - adjust <player> 'fall_distance:<def[fallDistance].mul[0.70].sub[3]>'
        - wait 1t
        - adjust <player> can_fly:true
        - flag player doublejump:!
        }
        else {
        - adjust <player> can_fly:false
        - adjust <player> 'fall_distance:%fallDistance%'
        - wait 1t
        - adjust <player> can_fly:true
        }


    on player starts flying:
    - if <player.has_flag[doublejump]> {
      - determine CANCELLED
      }
    - if <player.has_flag[fly_enabled]||false>
      || <player.gamemode.id.is[==].to[1]> {
      - queue clear
      }
    - flag player doublejump
    - shoot <player> 'o:<player>' 'destination:<player.location.cursor_on[<player.flag[double_jump_multiplier].as_int||10>]>' no_rotate
    - wait 5t
    - adjust <player> can_fly:false
    - adjust <player> 'fall_distance:0'
    - wait 5t
    - adjust <player> can_fly:true

#










View History