skriptMC/deacoudre.sk

114 lines
5 KiB
Text
Raw Normal View History

2021-06-28 21:03:09 +02:00
options:
X1: 103.5
X2: 99.5
Yeau: 57.5
Z1: -312.5
Z2: -304.5
2021-06-28 21:50:46 +02:00
on load:
ScriptList("add", script)
on unload:
ScriptList("remove", script)
2021-06-28 14:39:15 +02:00
command deacoudre [<text>]: # lancement de la partie
executable by: players
description: Lance une partie de dé à coudre.
trigger:
2021-06-28 14:39:15 +02:00
if arg-1 is set:
2021-06-29 08:49:40 +02:00
if arg-1 is "spawn":
if player is op:
2021-06-28 14:39:15 +02:00
set {thimble.location} to location of player
send "&aLe dé à coudre téléportes désormais ici."
stop
2021-06-29 08:49:40 +02:00
else:
send option("errorMessage")
stop
2021-06-28 14:39:15 +02:00
if {thimble.location} is not set:
send "&4Tu n'as pas défini de point de téléportation : &r&l/deacoudre spawn"
stop
if {party.player.%uuid of player%} is set:
if {thimble} is true:
delete {thimble}
loop {party.list::*}:
send "&cPartie de dé à coudre terminée." to loop-value
2021-06-28 14:39:15 +02:00
teleport loop-value to {thimble.location}
set gamemode of loop-value to creative
2021-06-29 08:49:40 +02:00
execute console command "fill 103 57 -313 99 57 -305 water"
else:
set {thimble} to true
loop {party.list::*}:
send "&aDémarrage de la partie de dé à coudre !" to loop-value
2021-06-28 14:39:15 +02:00
teleport loop-value to {thimble.location}
set gamemode of loop-value to adventure
feed loop-value
heal loop-value
cure loop-value
else:
send "&4Tu n'es pas dans une partie."
2021-06-28 12:04:45 +02:00
every 0.5 second in "world": # pose du bloc et téléporatation
if {thimble} is not true:
stop
loop {party.list::*}:
set action bar of loop-value to "&dEn partie de &lDé à coudre&r&d."
2021-06-28 21:03:09 +02:00
if block at loop-value is water: # si dans l'eau
# vérification que c'est l'eau du dé à coudre
set {_xLocationBlock1} to difference between X-location of block at loop-value and {@X1}
set {_xLocationBlock2} to difference between X-location of block at loop-value and {@X2}
set {_zLocationBlock1} to difference between Z-location of block at loop-value and {@Z1}
set {_zLocationBlock2} to difference between Z-location of block at loop-value and {@Z2}
set {_yLocationBlock} to difference between Y-location of block at loop-value and {@Yeau}
if {_xLocationBlock1} and {_xLocationBlock2} and {_zLocationBlock1} and {_zLocationBlock2} <= 0:
continue
2021-06-28 21:03:09 +02:00
if {_xLocationBlock1} and {_xLocationBlock2} >= ({@X1} - {@X2}):
continue
if {_yLocationBlock} != 0:
continue
2021-06-28 21:03:09 +02:00
if {_zLocationBlock1} and {_zLocationBlock2} >= ({@X1} - {@X2}):
continue
2021-06-28 21:03:09 +02:00
# vérification si c'est un jump qui est dur à faire (entre 4 blocs pleins)
set {_niceJump} to true
set {_blockX} to X-location of block at loop-value
set {_blockY} to Y-location of block at loop-value
set {_blockZ} to Z-location of block at loop-value
if block at location ({_blockX} - 1), {_blockY}, {_blockZ} in world "world" is water:
set {_niceJump} to false
if block at location ({_blockX} + 1), {_blockY}, {_blockZ} in world "world" is water:
set {_niceJump} to false
if block at location {_blockX}, {_blockY}, ({_blockZ} - 1) in world "world" is water:
set {_niceJump} to false
if block at location {_blockX}, {_blockY}, ({_blockZ} + 1) in world "world" is water:
set {_niceJump} to false
2021-06-28 21:03:09 +02:00
# pose du bloc (or si jump difficile + message, laine si normal)
2021-06-28 15:28:29 +02:00
if {thimble.dead.%uuid of loop-value%} is not set:
if {_niceJump} is true:
set block at loop-value to gold block
set {_player} to loop-value
loop {party.list::*}:
send "&a&l%{_player}%&r&e a fait un beau jump !" to loop-value-2
else:
set block at loop-value to wool
2021-06-28 15:28:29 +02:00
else:
delete {thimble.dead.%uuid of loop-value%}
2021-06-28 21:03:09 +02:00
# téléportation et feed/heal
2021-06-28 14:39:15 +02:00
teleport loop-value to {thimble.location}
feed loop-value
heal loop-value
2021-06-28 14:39:15 +02:00
on death:
if {thimble} is true:
if {party.player.%uuid of player%} is set:
cancel event
set gamemode of player to spectator
2021-06-28 21:03:09 +02:00
set {thimble.dead.%uuid of player%} to true
set {_finPartie} to true
2021-06-28 14:39:15 +02:00
loop {party.list::*}:
2021-06-28 21:03:09 +02:00
if {thimble.dead.%uuid of loop-value%} is false:
set {_finPartie} to false
2021-06-28 14:39:15 +02:00
send "&c%player%&b a été éliminé !" to loop-value
2021-06-28 21:03:09 +02:00
if {_finPartie} is true:
execute player command "deacoudre"