Basic Minigame Mechanics in Skript Language:

  • 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!

Aidanete

Active Member
Apr 11, 2017
139
10
0
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_language.skript:
on projectile hit:
    projectile is arrow:
        wait 1 tick
        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_language.skript:
set the player's level to 10
set the level progress of player to 0.99
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_language.skript:
on walking on gravel or sand:
    block below event-block is tnt:
        wait 8 ticks
        set block below event-block to air
        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_language.skript:
on respawn:
    set {invulnerability.%player%} to true
    message "You're invulnerable for 5 seconds"
    wait 5 seconds
    message "You're no longer invulnerable"
    set {invulnerability.%player%} to false
on damage:
    {invulnerability.%victim%} is true:
        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_language.skript:
on break of iron ore:
    player's gamemode is survival:
        cancel event
        set the block at location of event-block to air
        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_language.skript:
on place:
    event-block is tnt:
        set block above the event-block to redstone block
        wait 1 tick
        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_language.skript:
on damage:
    damage cause is fall:
        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:
 
Last edited: