Date: 2024/05/26 02:54:56 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
force_choke:
type: task
definitions: target
script:
- if <[target]> != null && (<[target].is_player> || <[target].is_mob> || <[target].is_npc>):
- flag <player> player.force.statistics.cast_choke:++
- cast slow <[target]> duration:<script[item_force_choke].flag[variables.base_duration].add[0.5]> amplifier:3 hide_particles:true no_icon:true no_clear
- cast slow <player> duration:<script[item_force_choke].flag[variables.base_range].sub[1]> amplifier:1 hide_particles:true no_icon:true no_clear
- narrate "did 1"
- wait 0.25s
# Prevent other force powers from being used when healing
- foreach <player.flag[player.force.force_powers_list].exclude[force_choke]> as:power:
- define expiration <script[item_force_choke].flag[variables.base_duration]>
- define old_cooldown <player.flag_expiration[player.force.cooldown.<[power]>].second||0>
- if <[old_cooldown]> > <[expiration]>:
- foreach next
- flag <player> player.force.cooldown.<[power]> expire:<[expiration]>
- itemcooldown <item[item_<[power]>].material> duration:<[expiration]>
- narrate "did me a lot"
- define previous_target <[target]>
- repeat <script[item_force_choke].flag[variables.base_duration].add[1]>:
- define target <player.eye_location.ray_trace_target[ignore=<player>;range=<script[item_force_choke].flag[variables.base_range]>;raysize=<script[item_force_choke].flag[variables.ray_size]>]||null>
- narrate "target: <[target].name>"
- narrate "previous: <[previous_target].name>"
- narrate "target exists: <[target].exists>"
- narrate "previous target exists: <[previous_target].exists>"
- if (<[target].exists> && <[previous_target].exists>) && (<[target].is_player> || <[target].is_mob> || <[target].is_npc>):
- narrate "WTF"
- if !<[target].exists>:
- narrate "huh 1"
- cast slow remove <[previous_target]>
- define previous_target null
- wait <script[item_force_choke].flag[variables.base_duration].sub[0.25].div[6]>
- repeat next
- if <[target]> != <[previous_target]>:
- narrate "huh 2"
- cast slow remove <[previous_target]>
- hurt <script[item_force_choke].flag[variables.base_strength]> <[target]> cause:Magic
- narrate "defining previous"
- define previous_target <[target]>
- else if <[target]> == null && <[previous_target]> == null:
- cast slow remove <player>
- foreach <player.flag[player.force.force_powers_list].exclude[force_heal]> as:power:
- if !<player.has_flag[player.force.cooldown.<[power]>]>:
- foreach next
# if the old cooldown > new expiration, dont change anything. If it's less or equal, set it to 0
- if <[old_cooldown]> <= <[expiration]>:
- flag <player> player.force.cooldown.<[power]> expire:0
- itemcooldown <item[item_<[power]>].material> duration:0
- stop
- wait <script[item_force_choke].flag[variables.base_duration].sub[0.25].div[6]>