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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

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

Kill achievement

Discussion in 'Skript' started by Dan_k, Jun 6, 2019.

  1. D

    Dan_k Active Member

    Joined:
    Apr 25, 2019
    Messages:
    28
    Likes Received:
    0
    I tried to create that if you will kill 5 zombies it will teleport you to another world.
    Code (Text):
    1. variables:
    2.     {kill counter.%player%.kills_total} = 0
    3.  
    4. on death of a zombie:
    5.     attacker is a player
    6.     add 1 to {kill counter.%attacker%.kills_total}
    7. every 1 second:
    8.     loop all players:
    9.         if {kill counter.%attacker%.kills_total} equals to 5
    10.         make console execute "mw move %player% rpg"
    what is wrong with the code?
     
  2. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,217
    Likes Received:
    70
    Medals:
    You're using attacker and player in a every 1 second event, both don't exist there.
    The correct condition is %object% is equal to %object%. You can also use `%object% is %object%`
    (The indentation on line 10 is wrong and you're missing a `:` after line 9) or (you added an `if` where you didn't need it)
     
  3. D

    Dan_k Active Member

    Joined:
    Apr 25, 2019
    Messages:
    28
    Likes Received:
    0
    can you send me the fixed code pls? Cuz I am not at home right now to fix the code.
     
  4. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,217
    Likes Received:
    70
    Medals:
    Nope
     
  5. S

    Scholler Well-Known Member

    Joined:
    Aug 6, 2018
    Messages:
    103
    Likes Received:
    5
    Why are you asking for the code? You won't learn by us just writing the code for you. I will give you the wrong things and also I will explain it, hope you will understand...
    So. First of all, in line 10, you don't need to write ,,if'', you can just use it as a condition. Also, 'equals to 5' didn't work for me, changed it to 'is 5'
    Also line 10: there is no %attacker% in a every second event. You're looping all players, that's good, so put loop-player (because when you're looping stuff (e.g values in a list-variable) you always put loop- before it. E.g loop {something::*}: if loop-value is ....) instead of attacker.
    And line 11 I just changed make console execute to execute console command

    You can now change the things in your code.

    Also... I just don't want you to use this long code when you can do it easier. There you go, learn from this:
    (So if all you want is that a player kills 5 zombie then console executes MW move player rpg then use this)
    Code (Text):
    1. on death of zombie:
    2.     attacker is a player #tests if it was killed by a player
    3.     if {kills.%attacker%} is set: #if the variable exists (so the player may already killed some zombies)
    4.         add 1 to {kills.%attacker%} #adds one to the kill numbers
    5.         {kills.%attacker%} is 5 #This is a condition. You don't need to write if. If it's true (so the variable is 5) it will continue doing the things. If not, then it stops executing the command. This tests if the variable's value is 5 (so if the player killed 5 zombies)
    6.         execute console command "mw move %attacker% rpg" #console executes the command
    7.         delete {kills.%attacker%} #Delete the variable for some reasons:p
    8.     else: #Variable is not set, 0 zombie killed:
    9.         set {kills.%attacker%} to 1 #already one, gg...
    10.  
     
    • Like Like x 3
  6. D

    Dan_k Active Member

    Joined:
    Apr 25, 2019
    Messages:
    28
    Likes Received:
    0
    okey,Thank you very much.
    --- Double Post Merged, Jun 6, 2019, Original Post Date: Jun 6, 2019 ---
    Yeah,And I wanted to ask, I am new to skript soo I want to learn, where I should start to learn? I watched couple of videos in youtube and learn some really basic things in skript like making gui and other stuff but this is too easy, maybe you know where should I learn more about skript?
     
  7. S

    Scholler Well-Known Member

    Joined:
    Aug 6, 2018
    Messages:
    103
    Likes Received:
    5
    Well, for small things, you can try searching them on google, OR in the docs: https://skripthub.net/docs/ (I think everything can be found there about Skript, every expressions, events, also same with addons..)
    For example, you don't know how to change the tab name of a player. How to search it in the docs: Just write ,,tab name'' How to search it in google: ,,minecraft skript tab name'' (Well I can't found any real answer for it on google (didn't search for too much time, I have to go) that's why you should use a docs)
    -And I will edit this message tomorrow, link you some more things-
     
  8. D

    Dan_k Active Member

    Joined:
    Apr 25, 2019
    Messages:
    28
    Likes Received:
    0
    Thank you!!
    --- Double Post Merged, Jun 14, 2019, Original Post Date: Jun 7, 2019 ---
    Didn't edit the message XD
     
Loading...