paintballarena:
type: world
events:
on entity damaged by SNOWBALL:
- if !<player.flag[inpaintball]> queue clear
- ^flag <context.entity> damage:++
- ^hurt 0 <context.entity>
- ^adjust <player> show_boss_bar:<[email protected][<player.flag[damage]>].mul[40].as_int>|<&5><&l>Health
#this math just makes the boss bar show their health, read it and think it makes sense xD max boss_bar is 200
- ^if <context.entity.flag[damage]> == '5' {
- ^run respawn
- adjust <player> food_level:20
- if <context.entity> != '<context.damager>' {
- ^flag <context.damager> kills:++
}
- ^flag <context.entity> damage:0
- ^playsound <context.entity.location> ANVIL_BREAK
- ^run scoreboardupdate
- ^narrate "<&0>[<&6>Paintball<&0>] <&b>You were killed by <context.damager.name>!" target:<context.entity>
- ^narrate "<&0>[<&6>Paintball<&0>] <&b>You killed <context.entity.name>!" target:<context.damager>
#this runs when a player has 5 kills to end the game
- if <context.damager.flag[kills].as_int> == '5' {
- announce "<&0>[<&6>Paintball<&0>] <&b><context.damager.name> won paintball arena and received $500"
- "execute as_server eco give <context.damager.name> 500"
- give money qty:500
- foreach <server.flag[pb_arena_list].aslist> {
#for every player added to this list you need to remove all the pb related flags/scoreboards
- ^teleport <%value%> <server.flag[pblobby]>
- ^flag <%value%> kills:0
- ^flag <%value%> inpaintball:!
- ^flag <%value%> damage:0
- ^flag <%value%> has_perk:!
- ^adjust <%value%> show_boss_bar
- ^adjust <%value%> remove_effects
- ^scoreboard remove id:<%value%.name>_scoreboard
- ^inventory clear d:<%value%.inventory>
- ^give <%value%.flag[inventory]> player:<%value%>
- ^cast speed remove <%value%>
}
- flag global pb_arena_list:!
#clears the list of players in paintball
}
}
on player right clicks with wood_hoe:
- ^if !<player.flag[inpaintball]> queue clear
- ^run shoot
#this is the paintballgun
on player right clicks with arrow:
- if !<player.flag[inpaintball]> queue clear
- take iteminhand qty:1
- ^shoot <player> arrow o:<player.location.add[0,1.4,0]> d:<player.location.cursor_on[1000]> speed:1
#this is how I have created grenades, it shoots arrows that *explode*
on pb command:
#here is where I parse the arguments of /pb to find out what to do, whenever the script finds out what it needs to do it runs
#queue clear so that no time is wasted checking other if statements. If they all fail it narrate's some text @ the bottom
- determine passively fulfilled
- if <c.args.get[1]> == 'join' {
- if <player.flag[inpaintball]> {
- narrate "<&0>[<&6>Paintball<&0>] <&b>You are already in a paintball arena."
- queue clear
}
- ^run joinpb
- adjust <player> food_level:20
- queue clear
}
- if <c.args.get[1]> == 'quit' {
- if !<player.flag[inpaintball]> {
- narrate "<&0>[<&6>Paintball<&0>] <&b>You are not in a paintball arena. <&6>*derp*"
- queue clear
}
- ^flag player inpaintball:!
- ^flag global pb_arena_list:<-:<player>
- ^flag player pb_duration:!
- ^flag player damage:!
- ^flag player kills:!
- ^flag player xp_wait:!
- ^flag player grenade:!
- ^flag player has_perk:!
- ^adjust <player> show_boss_bar
- ^adjust <player> remove_effects
- ^narrate "<&0>[<&6>Paintball<&0>] <&b>You have left the paintball arena."
- ^scoreboard remove id:<player.name>_scoreboard
- ^run scoreboardupdate
- ^teleport <player> <server.flag[pblobby]>
- ^inventory clear o:<player.inventory>
- ^give <player.flag[inventory]>
- ^experience give <player.flag[experience]>
- ^adjust <player> remove_effects
- queue clear
#this just makes sure the player has no pb flags when they leave
}
- if <c.args.get[1]> == 'setspawn' {
#these are for admins setting the spawns @ setup
- if <player.is_op> != 'true' queue clear
- if <c.args.get[2]> == '1' {
- flag global pbspawn1:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn1 @ <server.flag[pbspawn1]>"
- queue clear
}
- if <c.args.get[2]> == '2' {
- flag global pbspawn2:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn2 @ <server.flag[pbspawn1]>"
- queue clear
}
- if <c.args.get[2]> == '3' {
- flag global pbspawn3:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn3 @ <server.flag[pbspawn3]>"
- queue clear
}
- if <c.args.get[2]> == '4' {
- flag global pbspawn4:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn4 @ <server.flag[pbspawn4]>"
- queue clear
}
- if <c.args.get[2]> == '5' {
- flag global pbspawn5:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn5 @ <server.flag[pbspawn5]>"
- queue clear
}
- if <c.args.get[2]> == '6' {
- flag global pbspawn6:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn6 @ <server.flag[pbspawn6]>"
- queue clear
}
- if <c.args.get[2]> == '7' {
- flag global pbspawn7:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn7 @ <server.flag[pbspawn7]>"
- queue clear
}
- if <c.args.get[2]> == '8' {
- flag global pbspawn8:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn8 @ <server.flag[pbspawn8]>"
- queue clear
}
- if <c.args.get[2]> == '9' {
- flag global pbspawn9:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn9 @ <server.flag[pbspawn9]>"
- queue clear
}
- if <c.args.get[2]> == '10' {
- flag global pbspawn10:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pbspawn10 @ <server.flag[pbspawn10]>"
- queue clear
}
- if <c.args.get[2]> == 'lobby' {
- flag global pblobby:<player.location>
- narrate "<&0>[<&6>Paintball<&0>] <&b>Set pblobby @ <server.flag[pblobby]>"
- queue clear
}
- narrate "<&0>[<&6>Paintball<&0>] <&b>/pb <context.raw_args> is an invalid command."
- queue clear
}
- if <c.args.get[1]> == 'perk' {
- if !<player.flag[inpaintball]> {
- narrate "<&0>[<&6>Paintball<&0>] <&b>You are not in a paintball arena!"
- queue clear
}
- inventory open d:in@PBStore
#opens the store gui
- queue clear
}
- narrate "<&c><&m>==================<&6> Fort Mine Paintball <&c><&m>=================="
- narrate "<&6>/pb join -<&b><&O> Join the paintball arena"
- narrate "<&6>/pb quit -<&b><&O> Quit the paintball arena"
- narrate "<&6>/pb perk -<&b><&O> Select your perk"
- narrate "<&6>Developed by -<&b><&O> que1124!"
#this runs when all the above if statements don't succeed
on player joins:
- ^if !<player.flag[inpaintball]> queue clear
- ^run quitinpb
#runs quitinpb (script) when people flagged with inpaintball join the game
on player quits:
- if !<player.flag[inpaintball]> queue clear
- flag global pb_arena_list:<-:<player>
- if <server.flag[pb_arena_list]> == 'null' queue clear
- ^foreach <server.flag[pb_arena_list].aslist> {
- scoreboard remove 'obj:<&6>* Paintball *' lines:<player> score:<player.flag[kills].as_int> id:<player.name>_scoreboard
}
- run scoreboardupdate
on player damages player:
- if !<player.flag[inpaintball]> queue clear
- if <context.projectile> == 'snowball' queue clear
- determine cancelled
#so peopel don't pvp
on player drops item:
- if !<player.flag[inpaintball]> queue clear
- determine cancelled
#so people don't drop their gun
on player changes food level:
- if !<player.flag[inpaintball]> queue clear
- determine cancelled
on player drops item:
- if !<player.flag[inpaintball]> queue clear
- determine cancelled
#don't want anyone starving
on command:
- if <context.command> == 'pb' queue clear
#this is to make sure no one /warps away in-game
#first it checks if the command is a /pb command, if it is run like normal
- if !<player.flag[inpaintball]> queue clear
#then if the player is not inpaintball do nothing else
- if <player.is_op> == 'true' queue clear
#if the player is an op let them do the command anyway
- narrate "<&0>[<&6>Paintball<&0>] <&b>You cannot use commands other than <&6>/pb perk<&b> and <&6>/pb quit<&b> during paintball."
- determine cancelled
on arrow hits block:
- if !<context.shooter.flag[inpaintball]> queue clear
#shoots snowballs in all directs from the landing with the shooter of the arrow as the shooter of the snowballs
#thanks to mcmonkey for adding the shooter thing for me (:
- shoot <context.shooter> snowball origin:<context.projectile.location.add[0,.5,0]> destination:<context.shooter.location.add[0,1,0]> speed:.5 shooter:<context.shooter>
- shoot <context.shooter> snowball origin:<context.projectile.location.add[0,.5,0]> destination:<context.shooter.location.add[10,1,0]> speed:.5 shooter:<context.shooter>
- shoot <context.shooter> snowball origin:<context.projectile.location.add[0,.5,0]> destination:<context.shooter.location.add[0,1,10]> speed:.5 shooter:<context.shooter>
- shoot <context.shooter> snowball origin:<context.projectile.location.add[0,.5,0]> destination:<context.shooter.location.add[10,1,10]> speed:.5 shooter:<context.shooter>
- shoot <context.shooter> snowball origin:<context.projectile.location.add[0,.5,0]> destination:<context.shooter.location.add[-10,1,0]> speed:.5 shooter:<context.shooter>
- shoot <context.shooter> snowball origin:<context.projectile.location.add[0,.5,0]> destination:<context.shooter.location.add[0,1,-10]> speed:.5 shooter:<context.shooter>
- shoot <context.shooter> snowball origin:<context.projectile.location.add[0,.5,0]> destination:<context.shooter.location.add[-10,1,-10]> speed:.5 shooter:<context.shooter>
- shoot <context.shooter> snowball origin:<context.projectile.location.add[0,.5,0]> destination:<context.shooter.location.add[-10,1,10]> speed:.5 shooter:<context.shooter>
- shoot <context.shooter> snowball origin:<context.projectile.location.add[0,.5,0]> destination:<context.shooter.location.add[10,1,-10]> speed:.5 shooter:<context.shooter>
joinpb:
type: task
script:
- ^flag player inventory:<player.inventory.list_contents>
- ^wait 5t
#stores the players inventory as a flag, and waits just to avoid occassional timing issues with empty inventories being stored
- ^inventory clear o:<player.inventory>
- ^give i@paintballgun qty:1 to:<player>
- ^flag global pb_arena_list:->:<player>
- ^flag player inpaintball
- ^flag player damage:0
- ^flag player kills:0
- ^flag player experience:<player.xp.total>
#stores xp level
- ^flag player pb_duration:20
#this gives them the default cooldown time
- ^flag player grenade:!
#removes grenade perk
- ^experience set 0
- ^adjust <player> show_boss_bar:<[email protected][<player.flag[damage]>].mul[40].as_int>|<&5><&l>Health
- ^narrate "<&0>[<&6>Paintball<&0>] <&b>You have joined the paintball arena."
- ^random {
- ^teleport <player> <server.flag[pbspawn1]>
- ^teleport <player> <server.flag[pbspawn2]>
- ^teleport <player> <server.flag[pbspawn3]>
- ^teleport <player> <server.flag[pbspawn4]>
- ^teleport <player> <server.flag[pbspawn5]>
- ^teleport <player> <server.flag[pbspawn6]>
- ^teleport <player> <server.flag[pbspawn7]>
- ^teleport <player> <server.flag[pbspawn8]>
- ^teleport <player> <server.flag[pbspawn9]>
- ^teleport <player> <server.flag[pbspawn10]>
}
- ^run scoreboardupdate
- inventory open d:in@PBStore
shoot:
type: task
speed: 1t
script:
- ^if <player.flag[shot]> queue clear
- ^flag player shot d:<math:<player.flag[pb_duration]>/10>
#makes sure they don't spam shoot
- ^repeat 4 {
#random speeds to make it look more natural
- ^random {
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:.9
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:1
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:1
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:3
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:2
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:2.4
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:2.6
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:1.9
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:1.2
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:2.3
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:2.1
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:2.2
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:3
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:3.1
- ^shoot <player> snowball o:<player.location.add[0,1.5,0]> d:<player.location.cursor_on[1000]> speed:2
}
}
- flag player xp_wait:<math:<player.flag[pb_duration]>/17>
- ^experience set 17
- ^wait <player.flag[xp_wait]>t
#this waits 17th of pb_duration and then takes the xp_bar down one slot
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1t
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- ^wait <player.flag[xp_wait]>t
- ^experience take 1
- queue clear
quitinpb:
type: task
script:
- ^wait 1s
- ^narrate "<&0>[<&6>Paintball<&0>] <&b>You quit in the middle of a paintball arena game so we restored your xp/inventory."
- ^flag player inpaintball:!
- ^flag player has_perk:!
- ^flag player grenade:!
- ^adjust <player> remove_effects
- ^teleport <player> <server.flag[pblobby]>
- ^scoreboard remove id:<player.name>_scoreboard viewers:<player>
- ^inventory clear o:<player.inventory>
- ^give <player.flag[inventory]>
- ^experience give <player.flag[experience]>
#just giving the quitters their stuff back
respawn:
type: task
script:
- ^random {
- ^teleport <player> <server.flag[pbspawn1]>
- ^teleport <player> <server.flag[pbspawn2]>
- ^teleport <player> <server.flag[pbspawn3]>
- ^teleport <player> <server.flag[pbspawn4]>
- ^teleport <player> <server.flag[pbspawn5]>
- ^teleport <player> <server.flag[pbspawn6]>
- ^teleport <player> <server.flag[pbspawn7]>
- ^teleport <player> <server.flag[pbspawn8]>
- ^teleport <player> <server.flag[pbspawn9]>
- ^teleport <player> <server.flag[pbspawn10]>
}
- ^if <player.flag[has_perk]> == 'grenade' {
- ^give i@grenade
}
- ^if <player.flag[has_perk]> == 'speed' {
- ^cast speed duration:9999 power:1
}
- ^adjust <player> show_boss_bar:200|<&5><&l>Health
- ^flag player grenade:!
#give player helath/perk stuff back, this is run when damage == '5'
scoreboardupdate:
type: task
script:
- foreach <server.flag[pb_arena_list].aslist> {
- scoreboard add 'obj:<&6>* Paintball *' lines:<%value%> score:<%value%.flag[kills].as_int> id:<player.name>_scoreboard
- scoreboard add id:<player.name>_scoreboard viewers:<%value%.name>
}
#scoreboards are per-player and stored as <player.name>_scoreboard
paintballgun:
type: item
no_id: true
material: wood_hoe
display name: <&b>Paintball Gun
lore:
- "<&6>Just a gun <3"
PBStore:
type: inventory
inventory: CHEST
size: 9
title: <&5><&l>Paintball Perks
definitions:
cooldown: "i@watch[lore=Shoot your gun faster!;display_name=<&6>Lower Shooting Cooldown]"
grenade: "i@262[lore=You get one grenade per-life;display_name=<&6>Paint Grenade]"
speed: "i@313[lore=Run faster than opponents;display_name=<&6>Improved Speed;enchantments=OXYGEN,1]"
close: "i@288[lore=Close the menu;display_name=<&6>Close]"
slots:
- "[] [] [] [speed] [cooldown] [grenade] [] [] [close]"
#gui for the store
PBStore_Events:
type: world
events:
on player clicks in inventory:
- if <context.inventory.title> != "<&5><&l>Paintball Perks" queue clear
- if <context.item.lore> == "li@Shoot your gun faster!" {
- narrate "<&0>[<&6>Paintball<&0>] <&b>You choose the cooldown perk."
- flag player pb_duration:10
- flag player has_perk:cooldown
- take "bydisplay:<&6>Paint Grenade"
- cast speed remove
- determine cancelled
}
- if <context.item.lore> == "li@Run faster than opponents" {
- narrate "<&0>[<&6>Paintball<&0>] <&b>You choose the speed power up."
- ^cast speed duration:9999 power:1
- flag player has_perk:speed
- flag player pb_duration:20
- take "bydisplay:<&6>Paint Grenade"
- determine cancelled
}
- if <context.item.lore> == "li@You get one grenade per-life" {
- if <player.flag[has_perk]> == 'grenade' {
- narrate "<&0>[<&6>Paintball<&0>] <&b>You already choose that!"
- determine cancelled
- queue clear
}
- if <player.flag[grenade]> {
- narrate "<&0>[<&6>Paintball<&0>] <&b>Nice try! Only one grenade per-life!"
- determine cancelled
- queue clear
}
- narrate "<&0>[<&6>Paintball<&0>] <&b>You choose the grenade perk."
- ^give i@grenade
- flag player has_perk:grenade
- flag player pb_duration:20
- flag player grenade
- cast speed remove
- determine cancelled
}
- if <context.item.lore> == "li@Close the menu" {
- inventory close
- determine cancelled
}
#gives perk when gui is clicked
grenade:
type: item
no_id: true
material: arrow
display name: <&6>Paint Grenade
lore:
- "Spatters your enemies in paint!"