Need Help with coding a Zombie Gamemode

Discussion in 'Skript' started by Vortexprimes, Jan 12, 2019.

  1. Hey! So recently i have been coding a variation of the gamemode "Zombies" based off Hypixel and aswell Call of Duty Zombies. Recently i have been frustrated and confused on how i will code this type of gamemode being my first ever game i have ever made on Skript. So far i have made the basics (Lobby, Spawn, Guns, Door opening, Weapon upgrades, Gold System) but i have just been stuck on these:

    • Window repairing after a zombie broke it down
    • Zombie spawn system
    • Spawning more zombies as more rounds pass by (EX: Round 1 = 25 Zombies, Round 2 = 35 Zombies etc)
    • Setting Roles (EX: There will be 4 roles, and 4 players that are in the game, one player for a example would be assigned the role "Medic" and the other 3 will be assigned different roles
    • Resurrection system, aka when a player is "detected as killed" there body will lay on the ground until a player revives them WITHIN 15 seconds
    If anyone of you guys/gals can help me code this gamemode i would be more then described as thankful/grateful. If you have any better ways of doing this please make sure to comment.

    Heres my code so far (FYI: Some of the coding may be incomplete, reason is either i am Stuck, or just not completed):

    Code (Text):
    command /GCPD <text>:
        trigger:
            if arg-1 is "setspawn":
                clear {GCPD.SPAWN}
                set {GCPD.SPAWN} to location of the player
                send "&2[&aGCPD&2] &aSpawn now set at %{GCPD.SPAWN}%!" to player
            if arg-1 is "removespawn":
                clear {GCPD.SPAWN}
                send "&2[&aGCPD&2] &aSpawn is now removed" to player      
            if arg-1 is "setlobby":
                set {GCPD.LOBBY} to location of the player
                send "&2[&aGCPD&2] &aLobby now set at %{GCPD.LOBBY}%!" to player
            if arg-1 is "removelobby":
                clear {GCPD.LOBBY}
                send "&2[&aGCPD&2] &aLobby is now removed" to player
            if arg-1 is "start":
                loop players in radius 30 of {GCPD.LOBBY}:
                    teleport loop-player to {GCPD.SPAWN}
            if arg-1 is "list":
                send "%{GCPD::*}% to player"
            if arg-1 is "start":
                if {GCPD.game} is true:
                    loop all players:
                        if {GCPD::*} is set:
                            apply blindness of tier 3 without any particles to the loop-player for 10 seconds
                            set action bar of loop-player to "&7"
                            give wooden hoe named "&6Rifle" to loop-player
                            give iron sword named "&7Pocket Knife" to loop-player
                            set {GCPD.game.time} to true
                            send "&2[&aGCPD&2] &aBegin. . ." to {GCPD::*}
            if arg-1 is "forcestart":
                set {GCPD.game} to true
            if arg-1 is "join":
                if {GCPD.players} is not set:
                    set {GCPD.players} to 1
                    set {GCPD.queue.%player%} to 1
                    set {GCPD::*} to player
                    teleport player to {GCPD.LOBBY}
                    send "&2[&aGCPD&2] &aYou joined the queue! %{GCPD.players}%/4" to player
                else:
                    if {GCPD.queue.%player%} is 1:
                        send "&2[&aGCPD&2] &aYou are already in the game!" to player
                    else:
                        if {GCPD.players} is 4:
                            send "&2[&aGCPD&2] &aOops Too Late! The game has already started please wait for it to end!" to player
                        else:
                            if {GCPD.players} is less than 4:
                                set {GCPD.queue.%player%} to 1
                                add 1 to {GCPD.players}
                                teleport player to {GCPD.LOBBY}
                                send "&2[&aGCPD&2] &aYou joined the queue! %{GCPD.players}%/4" to player
                            else:
                                if {GCPD.players} is less than 5:
                                    set {GCPD.queue.%player%} to 1
                                    add 1 to {GCPD.players}
                                    teleport player to {GCPD.LOBBY}
                                    send "&2[&aGCPD&2] &aYou joined the queue! %{GCPD.players}%/4" to player
                                    set {GCPD.game} to true
                                    teleport {GCPD::*} to {GCPD.SPAWN}
                                   
            if arg-1 is "clear":
                clear {GCPD.SPAWN}
                clear {GCPD.LOBBY}
                clear {GCPD.players}
                clear {GCPD.queue.%player%}
                clear {GCPD::*}
                send "&6Cleared" to player
               
    command /mobGCPD <text> <text>:
        trigger:
            if arg-1 is "setmobspawn":
                if arg-2 is "1":
                    set {GCPD.mob.spawn.%arg-2%} to location of the player
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now set!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "2":
                    set {GCPD.mob.spawn.%arg-2%} to location of the player
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2%  is now set!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "3":
                    set {GCPD.mob.spawn.%arg-2%} to location of the player
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2%  is now set!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "4":
                    set {GCPD.mob.spawn.%arg-2%} to location of the player
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2%  is now set!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "5":
                    set {GCPD.mob.spawn.%arg-2%} to location of the player
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2%  is now set!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "6":
                    set {GCPD.mob.spawn.%arg-2%} to location of the player
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2%  is now set!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "7":
                    set {GCPD.mob.spawn.%arg-2%} to location of the player
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2%  is now set!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "8":
                    set {GCPD.mob.spawn.%arg-2%} to location of the player
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2%  is now set!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "9":
                    set {GCPD.mob.spawn.%arg-2%} to location of the player
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2%  is now set!" to player
            if arg-1 is "removemobspawn":
                if arg-2 is "1":
                    clear {GCPD.mob.spawn.%arg-2%}
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now removed!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "2":
                    clear {GCPD.mob.spawn.%arg-2%}
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now removed!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "3":
                    clear {GCPD.mob.spawn.%arg-2%}
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now removed!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "4":
                    clear {GCPD.mob.spawn.%arg-2%}
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now removed!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "5":
                    clear {GCPD.mob.spawn.%arg-2%}
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now removed!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "6":
                    clear {GCPD.mob.spawn.%arg-2%}
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now removed!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "7":
                    clear {GCPD.mob.spawn.%arg-2%}
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now removed!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "8":
                    clear {GCPD.mob.spawn.%arg-2%}
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now removed!" to player
            if arg-1 is "setmobspawn":
                if arg-2 is "9":
                    clear {GCPD.mob.spawn.%arg-2%}
                    send "&2[&aGCPD&2] &aMob Spawner %arg-2% is now removed!" to player
               



    on rightclick on Light Gray Shulker Box:
        if {Gold.%player%} is greater than or equal to 500:
            loop blocks in radius 2 of clicked block:
                if loop-block is stone:
                    set clicked block to air
                    set loop-block to air
                    play sound "entity.witch.throw" with volume 1 and pitch 2 at player
                    play sound "entity.iron_golem.hurt" with volume 1 and pitch .1 at player
                    play sound "entity.iron_golem.hurt" with volume 1 and pitch 2 at player
                    subtract 500 from {Gold.%player%}
                    stop
        else:
            send "&2[&aDoor&2] &aInsufficient Funds this door requires &e500 &aGold." to player
            play sound "entity.iron_golem.attack" with volume 1 and pitch .1 at player
            cancel event
           
    on rightclick on Green Shulker Box:
        if {Gold.%player%} is greater than or equal to 50:
            give player 32 melon seeds
            play sound "block.anvil.land" with volume 1 and pitch .1 at player
            play sound "entity.iron_golem.hurt" with volume 1 and pitch 2 at player
            subtract 50 from {Gold.%player%}
            stop
        else:
            send "&2[&aDoor&2] &aInsufficient Funds to buy ammo please collect atleast &e50 &aGold." to player
            play sound "entity.iron_golem.attack" with volume 1 and pitch .1 at player
            cancel event
           
    on rightclick on Gray Shulker Box:
        if {Gold.%player%} is greater than or equal to 500:
            if player is holding wooden hoe:
                remove wooden hoe from the player
                give stone hoe to the player
            play sound "block.anvil.land" with volume 1 and pitch .1 at player
            play sound "entity.iron_golem.hurt" with volume 1 and pitch 2 at player
            subtract 500 from {Gold.%player%}
            cancel event
            stop
        else:
            send "&2[&aDoor&2] &aInsufficient Funds to upgrade your item you must have &e500 &aGold." to player
            play sound "entity.iron_golem.attack" with volume 1 and pitch .1 at player
            cancel event
           
    on right click:
        player is holding wooden hoe named "&6Rifle"
        if player has 1 melon seeds in his inventory:
            shoot an snowball with speed 4
            remove 1 melon seeds from the player
            play sound "entity.skeleton.shoot" with volume 1 and pitch .8 at player
        else:
            play sound "entity.iron_golem.death" with volume 1 and pitch 2 at player
                   
    every 2 second:
        loop all players:
            if loop-player is in world "world":
                if {Oxygen.%loop-player%} is greater than or equal to 1:
                    subtract 1 from {Oxygen.%loop-player%}
                   
    every 1 second:
        loop all players:
            if loop-player is in world "world":
                if {Gold.%loop-player%} is greater than or equal to 0:
                    if {Gold.%loop-player%} is less than or equal to 2000:
                        add 1 to {Gold.%loop-player%}
                else:
                    if {Gold.%loop-player%} is greater than 2000:
                        subtract 1 from {Gold.%loop-player%}
                       
    every 5 ticks:
        loop all players:
            wipe loop-player's sidebar
            set name of sidebar of loop-player to "&2GCPD &aLockdown"
            set score "   &a-&2-&a-&2&a-&2-&a-&2-&a-&2-&a-&2-" in sidebar of loop-player to 10
            set score "&f" in sidebar of loop-player to 9
            set score "&9&lOxygen: &1%{Oxygen.%loop-player%}%" in sidebar of loop-player to 8
            set score "&6&lGold: &e%{Gold.%loop-player%}%" in sidebar of loop-player to 7
            set score "&7&lCharacter: " in sidebar of loop-player to 6
            set score "   &a-&2-&a-&2&a-&2-&a-&2-&a-&2-&a-&2-&a" in sidebar of loop-player to 5
           

           
           
    command /GCPDFIX:
        trigger:
            set {Oxygen.%player%} to 100
            set {Gold.%player%} to 500
            set {Oxygen.refill.%player%} to 100
            set {used.pistol.%player%} to now
                   
                   



    #Door System
    #Gun/Ammo System
    #Mob spawning system
    #Reconstruction system
    #Oxygen System  
    #Death/Downing System
    #      
     
     
  2. You really should not be using Skript to make a whole gamemode... just saying.
     
    • Winner Winner x 1
  3. I totally agree with Brett, you should be using Java for this. Sure it is more complicated, but iirc it should be more optimized and better in the long run. You have so much more things you can do with Java/Spigot. Skript itself was coded with Java. if you need help learning java contact me on discord.
    Atomics#1085
     
  4. do not care about the above posts, you definitely can and should make gamemodes with Skript as I have 17 of Skript gamemodes running on my server without problems, it's all about how you optimize it.(do not check stuff too often, do not use repeatitive code, do not have any repeated checks which work outside game(use while game is running instead of every x time), always keep thinking of how you can make the code to be even better performance)

    I think you should first learn how to make simpler stuff, Zombies isn't the easiest game to make as a first gamemode, but here to answer your questions:
    windows repairing = just check if player is within x radius of window and is sneaking and then just place blocks at set locations of window

    zombie spawnng = set zombie spawnpoints around map and if there are players near the spawnpoints(loop players around at every checkpoint with specific delay and specific amount of times until there are no more zombies to spawn), spawn zombies here

    more zombies = just have something like, if {round::%{_map}%} = 1: spawn 5 zombies, if 2 spawn 10

    classes = nothing hard I guess, just think about it, set {class::%player's uuid%} to "Medic" ? then if "Medic" give x

    laying on ground = you gonna need bed + packets for this, I can try help you with this one once you get all other done.


    EDIT: about the code you written, I recommend doing it other way than just having a variable with player's count, better to add all the players to the variable, so you later can check if they are offline or not, for example this is my variables format used in all of my minigames:
    Code (Text):

    {gameknockout::players::secretlobby::%player%} = player in a waiting lobby named secretlobby
    {gameknockout::game1::start::%player%} = player in a started game in map 1
    {gameknockout::game1::temp::%player%::kills} = kills of a player in a started game in map 1
    {gameknockout::game1::temp::gametime} = time of a started game in map 1
     
    also use format like this {variable::%player's uuid%} not {variable.%player's uuid%}, you can easily loop list variables and similar, it is much better than dot variables.

    the scoreboard method you are using isn't good, I recommend using Skore addon since that is the best here for scoreboards
     
    #4 Govindas, Jan 12, 2019
    Last edited: Jan 12, 2019
    • Optimistic Optimistic x 6
    • Agree Agree x 1
    • Funny Funny x 1
  5. You should NOT make a gamemode in skript, even if you optimize it as much as possible, it will still be slower. Java will also give you better experience and hell maybe get you a job. Java is much better for this.

    Skript is good for small little things server owners want to do while the developers do the actual work. Skript can never beat Java and thats the end of it.
     
    • Winner Winner x 4
    • Agree Agree x 1
  6. why not make a gamemode in binary then? it will be faster than java
    it's good to make gamemodes in Skript because it's easier and faster to write, yes it's better to make a gamemode in Java, but that does not mean that you should never make gamemodes in Skript, this is like saying, you should never use 10 year old computer and only use a newer one because it's faster, to a person who cannot afford it.
     
    • Agree Agree x 3
  7. Because Minecraft is coded in Java
     
  8. I would love to see you code a gamemode in binary! Please, be my guest. In fact, why don't you make an engine to read binary in Skript!
    /s
    Skript is a 'language' (term used lightly so I don't trigger some people) that is coded as a plugin for Java servers while Java is what the server reads itself. Skript is basically a converter that rewrites english sentences/lingual into Java code for the server to understand so by default Java will, and always will be faster. Period.
     
    • Winner Winner x 1
  9. I do not understand what is the point of this your message? it has nothing to do with my reply, I never said that Java is slower than Skript. I think you may have misunderstood something
     
  10. Why are you mentioning "cant afford it"? if you are developer using skript you already have the time to play minecraft and script for it, also, since you basically mentioned money, learning Java (an ACTUAL programming language) can earn you more money than alot of other jobs (~100k a year).
     
  11. yes master skript and spend years learning it will earn you lots moneys /s
     
  12. What? I never said skript would earn you lots of money, I said Java might/would

    just realized /s means sarcasm :/
     
    #12 Destructuctuor, Jan 13, 2019
    Last edited: Jan 13, 2019
    • Funny Funny x 1
  13. There is no more point in arguing, The OP has already said he is doing java (he contacted me on discord). and I am helping him out.
    He has chosen Java. the better choice :)
     
  14. by afford I mean, afford the time&brainpower to learn it. you don't just simply learn java automatically by playing Minecraft. I have started learning Java myself, but I keep not really finding the time to really put effort into it, because I find Skript way more fun. 100k a year if you find a very good place for it, I know a lot of java developers who earn less.

    it takes 1 day to learn Skript and a year or few to master
    Java takes way more which is why some people prefer Skript since it requires less effort.
     
    #14 Govindas, Jan 13, 2019
    Last edited: Jan 13, 2019
    • Agree Agree x 1
  15. Really, by the time I was 1 year in I had already made some (bad, I will admit) ambitous projects. it really isnt that hard to get started. and some learn faster than others. I had no teacher, but hope that if I can teach the OP he can learn faster than I did.
     
  16. Why point out that you don't learn java just by playing minecraft? You cant learn skript by just playing minecraft either. And the "fun" is objective.if you like complex and want to do more, Java is for you. Also about the job, I really just said what alot of programmer jobs get.
    Thanks!
    - Destructuctor
     
  17. I do not agree with you. I've learned java within 6 months. If your dedicated it is only a matter of how much time you have to put into learning it. And yes I know that skript still will be faster to learn but it will limit you in a lot of ways. Learning java takes time but you will understand the game a lot better and allow you to do a lot more. The only problem is that most people are lazy and want to be able to create 'the best plugin ever' within 1 day. Doing that with java is near impossible. But if you want to be able to create high quality plugins learning java is a must imo.
     
  18. Yes. this, although I question you saying you "learned" it in 6 months. Do you know the concept of OOP and Java 8 lambda?
     
  19. you do not agree with what exactly? I said the learning times based on my own experience, if you are dedicated, you can learn anything in the universe. Java is definitely a better way than Skript and there's no point in arguing that, some people prefer Java, some Skript, both have their own advantages. like in Java, once you make a plugin it's uneditable by anyone other without putting a lot of effort into getting to editing it part, while in Skript you can simply open a file with notepad and start editing it right away and you can easily reload scripts to quickly test your code at the cost of worse performance and mostly only being limited to vanilla minecraft plugins possibilities and being unable to create minecraft mods and similar, but if the only thing you want to do is minecraft plugins and you have a big plan without a big team(my situation), Skript is a really fast & cheap way to make the plan real, code reading is faster, code writing is faster and code testing is faster, the language performance stuff only matters if you get like 100 players online which is less than 1% of servers and if you do get that amount, you can rewrite your code into Java which would be fast since you already have the code logic written, you just need to translate it into another language. Why limit your creativity by learning Java for a long time before starting to create? Pretty much my opinion: Start creating right away with Skript and once you need more power, only then learn Java. If you already know Java, there isn't much point in learning Skript and you shouldn't be in this forum if you aren't here to help with Skript or learn, we don't go into java forums telling people to use Skript instead of Java.
     
  20. Java is pretty easy to edit tbh, doesn't require much work, yes it takes a bit much it doesn't take that long, hell it didn't take me long to update Multiverse and ALL of the Multiverse plugins to properly support 1.13 *shrug*
     

Share This Page