1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Skript Other Basic Minigame Mechanics in Skript Language:

Discussion in 'Tutorials' started by Aidanete, Jul 16, 2018.

  1. Aidanete

    Aidanete Well-Known Member

    Joined:
    Apr 11, 2017
    Messages:
    139
    Likes Received:
    8
    I never did a tutorial, so sorry for any errors I commit.

    You may know that Minecraft servers are full of different minigames, some mechanics in this games are repeated or useful to clear lag or stuff like that. Today I will show you here how to make some of these mechanics

    No one wants in his/her minigames to get a floor full of arrows. Let's despawn any arrow that didn't hit anyone:
    Code (Skript):
    1. on projectile hit:
    2.     projectile is arrow:
    3.         wait 1 tick
    4.         delete event-entity
    The event detects when a projectile hits a block, the condition detects if the projectile is an arrow, then the effects remove that arrow with 1 tick of delay.
    The arena starts on 5, 4, 3, 2, 1... GO!
    Code (Skript):
    1. set the player's level to 10
    2. set the level progress of player to 0.99
    3. wait 1 second
    The first thing changes our XP level, that should be the seconds until arena starts (or whatever)
    The second is the level progress, you may see it as a percentage, 1 is 100% and 0 is 0%, so 0.44 should be 44%.
    The third is wait 1 second.
    After that, you should do it again and again until you reach to 0, of course with 1 second of delay between them.
    You probably should have played TNT Run, the sand and gravel below your feet disappear as you walk on it. This is the basic thing that occurs there.
    Code (Skript):
    1. on walking on gravel or sand:
    2.     block below event-block is tnt:
    3.         wait 8 ticks
    4.         set block below event-block to air
    5.         set block at event-block to air
    The first thing detects if you're walking on gravel or sand, if it is correct then the second one detects if the block below that sand or gravel is TNT, if it is that the case, when 8 ticks have passed, it will delete that sand and the TNT below.
    Code (Skript):
    1. on respawn:
    2.     set {invulnerability.%player%} to true
    3.     message "You're invulnerable for 5 seconds"
    4.     wait 5 seconds
    5.     message "You're no longer invulnerable"
    6.     set {invulnerability.%player%} to false
    7. on damage:
    8.     {invulnerability.%victim%} is true:
    9.         cancel event
    The first event detects when a player respawn, it will set his/her invulnerability to true, after 5 seconds, he/she will be no longer invulnerable.
    Then, the second event will detect if a player gets damage, if it has invulnerability, it will no receive any damage.
    Very typical from Skywars minigames:
    Code (Skript):
    1. on break of iron ore:
    2.     player's gamemode is survival:
    3.         cancel event
    4.         set the block at location of event-block to air
    5.         drop iron ingot at location of event-block
    When you break an iron ore, and the player is in survival mode, the script will manually remove the iron ore and will dorp an ingot at that location.
    Make a TNT auto-ignite itself when you place it.
    Code (Skript):
    1. on place:
    2.     event-block is tnt:
    3.         set block above the event-block to redstone block
    4.         wait 1 tick
    5.         set the block above the event-block to air
    When something is placed, if that thing is TNT, the script will place a redstone block above it during 1 tick. Probably no one will see it!
    Some minigames deny all the fall damage
    Code (Skript):
    1. on damage:
    2.     damage cause is fall:
    3.         cancel event
    First of all, if the player receives damage, and that damage is caused by falling, it will cancel/deny it.

    Hope this helped you, see you soon :emoji_grinning::emoji_stuck_out_tongue_winking_eye:
     
    #1 Aidanete, Jul 16, 2018
    Last edited: Jul 16, 2018
    • Like Like x 3
Loading...