LoginSignup
2
0

More than 3 years have passed since last update.

Minecraft Skript 基礎編 Part.4 アスレマップがあるサーバーにおすすめのコード

Last updated at Posted at 2019-09-01

アスレマップがあるサーバーにおすすめのコードを紹介

 Minecraftのサーバーでアスレチックを設置してる方にはおすすめのコードです。

ブロックを設置できなくする

Place_Cancel.sk
Options:
    parkour_map_name: "asure"
    #アスレマップの名前

on place:
    player is in {@parkour_map_name}
    player's gamemode is not creative
    cancel event 

プレイヤーがasureという名前のワールドにいたらブロックを設置できなくするというものです。

ブロックを破壊できなくする

Break_Cancel.sk
Options:
    parkour_map_name: "asure"
    #アスレマップの名前

on break:
    player is in {@parkour_map_name}
    player's gamemode is not creative
    cancel event 

プレイヤーがasureという名前のワールドにいたらブロックを破壊できなくするというものです。

ブロックを破壊できなくする

Damage_Cancel.sk
Options:
    parkour_map_name: "asure"
    #アスレマップの名前

on damage:
    attacker is a player
    attacker is in {@parkour_map_name}
    attacker's gamemode is not creative
    cancel event 

攻撃したプレイヤーがasureという名前のワールドにいたらプレイヤーを攻撃できなくします。

ブロックを破壊できなくする

Damage_of_Fall_Cancel.sk
Options:
    parkour_map_name: "asure"
    #アスレマップの名前

on damage:
    victim is in {@parkour_map_name}
    damage cause is fall
    cancel event

プレイヤーがasureという名前のワールドにいたら落下ダメージをキャンセルします。

チェックポイント

checkpoint.sk
Options:
    parkour_map_name: "asure"
    #アスレマップの名前

    block_of_check_point: beacon
    #チェックポイント用のブロック
    under_block_of_check_point: glowstone
    #チェックポイント用のブロックの下のブロック
    sound_of_set_check_point: "entity_player_levelup"
    #チェックポイントを設定したときの音
    sound_of_teleport_check_point: "entity_endermen_teleport"
    #チェックポイント用のブロックの下のブロック

on rightclick:
    player is in {@parkour_map_name}
    if event-block is not {@block_of_check_point}:
        event-item is red dye named "&6Teleport Spawn point"
        cancel event
        if {%UUID of player%.spawnpoint} is set:
            teleport player to {%UUID of player%.spawnpoint}
            send "&8[&c&lMLS&8] &5チェックポイントにテレポートしました" to player
            play {@sound_of_teleport_check_point} to player at volume 1
            stop
        else:
            teleport player to spawnpoint of player's world
            send "&8[&c&lMLS&8] &5スポーンポイントにテレポートしました" to player
            play {@sound_of_teleport_check_point} to player at volume 1
            stop
    if event-block is {@block_of_check_point}:
        block under the event-block is {@under_block_of_check_point}
        cancel event
        if block under the player is not air:
            set {%UUID of player%.spawnpoint} to location of player
            send "&8[&c&lMLS&8] &5チェックポイントを設定しました" to player
            play {@sound_of_set_check_point} to player at volume 1
            stop
        else:
            stop

手に&6Teleport Spawn pointという名前の赤色の染料を持って右クリックするとチェックポイントにテレポートします。
ですが、チェックポイントが設定されてなければプレイヤーがいるマップのスポーンポイントにテレポートします。

もし、チェックポイント用に設定したブロック(ここではbeacon)に向かって右クリックして、そのブロックの下のブロックが設定したブロックであれば(ここではglowstone)、チャックポの座標をチェックポイントを設定します。

ですが、プレイヤーの足元にブロックがあることが条件です。

テレポートしたときとチェックポイントを設定したときに音を流すようにしていますが、これはskrayfallが必須です。

コードすべて

このコードをダウンロードしてそのまま入れたら動くと思います。
skrayfallが必須

ダウンロードはこちら

配布しているものはメッセージなどをOptionsで設定できるようになっています。

一応ここにもコード貼っておきます。

asure.sk
# ================================
#    アスレサーバー用Skript
#    Created by Monster2408
# ================================

Options:
    parkour_map_name: "asure"
    #アスレマップの名前

    place_cancel_message: "&8[&c&lMLS&8] &cあなたはブロックを設置することはできません"
    #ブロックの設置をキャンセルしたときに流れるメッセージです

    break_cancel_message: "&8[&c&lMLS&8] &cあなたはブロックを破壊することはできません"
    #ブロックの設置をキャンセルしたときに流れるメッセージです

    hit_cancel_message: "&8[&c&lMLS&8] &cあなたはそのプレイヤーを殴ることはできません"
    #ブロックの設置をキャンセルしたときに流れるメッセージです

    block_of_check_point: beacon
    #チェックポイント用のブロック
    under_block_of_check_point: glowstone
    #チェックポイント用のブロックの下のブロック
    sound_of_set_check_point: "entity_player_levelup"
    #チェックポイントを設定したときの音
    message_of_set_check_point: "&8[&c&lMLS&8] &5チェックポイントを設定しました"
    #チェックポイントを設定したときの音
    sound_of_teleport_check_point: "entity_endermen_teleport"
    #テレポートしたときの音
    teleport_message_of_check_point: "&8[&c&lMLS&8] &5チェックポイントにテレポートしました"
    #チェックポイントにテレポートしたときのメッセージ
    teleport_message_of_spawn_point: "&8[&c&lMLS&8] &5スポーンポイントにテレポートしました"
    #スポーンポイントにテレポートしたときのメッセージ

    could_not_teleport: "block_anvil_use"
    #テレポートできなかったときの音
    could_not_teleport_message: "&8[&c&lMLS&8] &cアスレマップでなければテレポートできません"
    #テレポートできなかったときのメッセージ

on place:
    player is in {@parkour_map_name}
    player's gamemode is not creative
    send {@place_cancel_message} to player
    cancel event 

on break:
    player is in {@parkour_map_name}
    player's gamemode is not creative
    send {@break_cancel_message} to player
    cancel event 

on damage:
    attacker is a player
    victim is a player
    attacker is in {@parkour_map_name}
    attacker's gamemode is not creative
    send {@hit_cancel_message} to player
    cancel event 

on damage:
    victim is in {@parkour_map_name}
    damage cause is fall
    cancel event

on rightclick:
    player is in {@parkour_map_name}
    if event-block is not {@block_of_check_point}:
        event-item is red dye named "&6Teleport Spawn point"
        cancel event
        if {%UUID of player%.spawnpoint} is set:
            teleport player to {%UUID of player%.spawnpoint}
            send {@teleport_message_of_check_point} to player
            play {@sound_of_teleport_check_point} to player at volume 1
            stop
        else:
            teleport player to spawnpoint of player's world
            send {@teleport_message_of_spawn_point} to player
            play {@sound_of_teleport_check_point} to player at volume 1
            stop
    if event-block is {@block_of_check_point}:
        block under the event-block is {@under_block_of_check_point}
        cancel event
        if block under the player is not air:
            set {%UUID of player%.spawnpoint} to location of player
            send {@message_of_set_check_point} to player
            play {@sound_of_set_check_point} to player at volume 1
            stop
        else:
            stop

command /checktp:
    trigger:
        if player is in {@parkour_map_name}:
            if {%UUID of player%.spawnpoint} is set:
                teleport player to {%UUID of player%.spawnpoint}
                send {@teleport_message_of_check_point} to player
                play {@sound_of_teleport_check_point} to player at volume 1
                stop
            else:
                teleport player to spawnpoint of player's world
                send {@teleport_message_of_spawn_point} to player
                play {@sound_of_teleport_check_point} to player at volume 1
                stop
        else:
            send {@could_not_teleport_message} to player
            play {@could_not_teleport} to player at volume 1
            stop

さいごに

Skriptをプログラミングと言っていいのかは難しいのですが、プログラミングをする方はたまに「答え見たり聞いたりせず自分で考えたり、調べろ」と言う方がいます。

わたくしが思うに答え(ソースコード)を見て勉強するのも1つの手だと思います。

習得するのに少し時間がかかるかもですがそれが向く人とそうじゃない人がいると思うのでなんとも言えませんが・・・

それでは次回もお楽しみください。

次はコチラ

前はコチラ

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0