farming farms

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Turb032

Active Member
Jan 16, 2020
109
0
16
21
Hi guys. I want to know if it's possible to do this thing: I place a block (bedrock), right click it with any hoe, and the block become a farmland block. Above the farmland block i put crops:7, and on break of crops i collect money and crops respawn in a certain amount of time. At left and right to farmland block i put wall sign. On click on one of these signs, i upgrade the farm with Speed or Balance (they are multipliers, balance is when you break the crops and you collect money, you collect more, Speed is the delay of crops respawn), I DID IT ALL RIGHT, but there is a problem: When i place another block and right click it, the stats of the farm are the same of the others, and i don't want to. If this is possible with skript, thank you sooo much!
[doublepost=1581152409,1581152117][/doublepost]HERE IS THE SKRIPT:

Code:
variables:
  {bal mult.%player%} = 0
  {sp mult.%player%} = 0

options:
  p: &7[&6&lFarm&7]

on place of bedrock:
  if name of event-block is "&a&lWheat Farm":
    message "{@p} &6&lRight-Click the block" to player
    message "&6&lcreate a &a&lWheat Farm&6&l!" to player
# FARM CREATE
on right click on bedrock:
  if player is holding any hoe:
    set {bal mult.%player%} to 0
    set {sp mult.%player%} to 0
    wait 10 ticks
    set event-block to farmland
    wait 1 ticks
    set event-block to bedrock
    wait 1 ticks
    set event-block to farmland
    wait 1 ticks
    set event-block to bedrock
    wait 1 ticks
    set event-block to farmland
    wait 1 ticks
    set event-block to bedrock
    wait 1 ticks
    set event-block to farmland
    wait 1 ticks
    set event-block to bedrock
    wait 1 ticks
    set event-block to farmland
    message "{@p} &a&lSuccesfully created &6&lWheat Farm&a&l!" to player
    wait 40 ticks
    set block above event-block to crops:7
    set block left event-block to wall sign
    set block right event-block to wall sign
    set {rsign} to block right event-block
    set {lsign} to block left event-block
    if {lsign} is sign:
      set line 1 of {lsign} to "&8[&c&lUpgrade&8]"
      set line 2 of {lsign} to "&b&lSpeed"
      if {sp mult.%player%} = 0:
        set line 3 of {lsign} to "&2$&a&l50"
    if {rsign} is sign:
      set line 1 of {rsign} to "&8[&c&lUpgrade&8]"
      set line 2 of {rsign} to "&c&lPower"
      if {bal mult.%player%} = 0:
        set line 3 of {rsign} to "&2$&a&l50"
        stop
# CROPS BREAK
on break of crops:7:
  if player has permission "skript.farm":
    if block below event-block is farmland:
      set {lsign} to block left block below event-block
      set {rsign} to block right block below event-block
      if {rsign} is wall sign:
        if {lsign} is wall sign:
          if line 2 of {lsign} is "&b&lSpeed":
            if {bal mult.%player%} = 0:
# SP MULTIPLIER
              if {sp mult.%player%} = 0:
                cancel event
                set event-block to air
                add 2 to player's balance
                show an action bar from "&aReceived&7: &2$&62.00" to player
                wait 5 seconds
                set event-block to crops:7
                stop
              if {sp mult.%player%} = 1:
                cancel event
                set event-block to air
                add 2 to player's balance
                show an action bar from "&aReceived&7: &2$&62.00" to player
                wait 95 ticks
                set event-block to crops:7
                stop
              if {sp mult.%player%} = 2:
                cancel event
                set event-block to air
                add 2 to player's balance
                show an action bar from "&aReceived&7: &2$&62.00" to player
                wait 90 ticks
                set event-block to crops:7
                stop
              if {sp mult.%player%} = 3:
                cancel event
                set event-block to air
                add 2 to player's balance
                show an action bar from "&aReceived&7: &2$&62.00" to player
                wait 90 ticks
                set event-block to crops:7
                stop
              if {sp mult.%player%} = 4:
                cancel event
                set event-block to air
                add 2 to player's balance
                show an action bar from "&aReceived&7: &2$&62.00" to player
                wait 75 ticks
                set event-block to crops:7
                stop
              if {sp mult.%player%} = 5:
                cancel event
                set event-block to air
                add 2 to player's balance
                show an action bar from "&aReceived&7: &2$&62.00" to player
                wait 10 ticks
                set event-block to crops:7
                stop
              if {sp mult.%player%} = 6:
                cancel event
                set event-block to air
                add 2 to player's balance
                show an action bar from "&aReceived&7: &2$&62.00" to player
                wait 10 ticks
                set event-block to crops:7
                stop
# POWER MULTIPLIER
          if line 2 of {rsign} is "&c&lPower":
            if {bal mult.%player%} = 0:
              cancel event
              set event-block to air
              add 2 to player's balance
              show an action bar from "&aReceived&7: &2$&62.00" to player
              wait 100 ticks
              set event-block to crops:7
              stop
            if {bal mult.%player%} = 1:
              cancel event
              set event-block to air
              add 5 to player's balance
              show an action bar from "&aReceived&7: &2$&65.00" to player
              wait 100 ticks
              set event-block to crops:7
              stop
            if {bal mult.%player%} = 2:
              cancel event
              set event-block to air
              add 7 to player's balance
              show an action bar from "&aReceived&7: &2$&67.00" to player
              wait 100 ticks
              set event-block to crops:7
              stop
            if {bal mult.%player%} = 3:
              cancel event
              set event-block to air
              add 10 to player's balance
              show an action bar from "&aReceived&7: &2$&610.00" to player
              wait 100 ticks
              set event-block to crops:7
              stop
            if {bal mult.%player%} = 4:
              cancel event
              set event-block to air
              add 12 to player's balance
              show an action bar from "&aReceived&7: &2$&612.00" to player
              wait 100 ticks
              set event-block to crops:7
              stop
            if {bal mult.%player%} = 5:
              cancel event
              set event-block to air
              add 15 to player's balance
              show an action bar from "&aReceived&7: &2$&615.00" to player
              wait 100 ticks
              set event-block to crops:7
              stop


on break of farmland:
  if player has permission "skript.farm":
    if player is not holding hoe:
      cancel event
    else:
      if block above event-block is crops:7:
        if block left event-block is wall sign:
          if player is holding hoe:
            set event-block to air
            set block above event-block to air
            set block left event-block to air
            message "{@p} &c&lSuccesfully broke a farm!" to player

on break of wall sign:
  if line 1 of event-block is "&8[&c&lUpgrade&8]":
    cancel event

on right click on wall sign:
  if player has permission "skript.farm":
    if line 3 of event-block is "&2$&a&l50":
# SPEED
      if line 2 of event-block is "&b&lSpeed":
        if player's balance > 49:
          set {sp mult.%player%} to 1
          remove 50 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&b&lSpeed&3)" to player
          set line 3 of event-block to "&2$&a&l150"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l150":
      if line 2 of event-block is "&b&lSpeed":
        if player's balance > 149:
          set {sp mult.%player%} to 2
          remove 150 from player's balance
          set line 3 of event-block to "&2$&a&l500"
          message "{@p} &a&lFarm upgraded! &3(&b&lSpeed&3)" to player
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l500":
      if line 2 of event-block is "&b&lSpeed":
        if player's balance > 499:
          set {sp mult.%player%} to 3
          remove 500 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&b&lSpeed&3)" to player
          set line 3 of event-block to "&2$&a&l1.500"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l1.500":
      if line 2 of event-block is "&b&lSpeed":
        if player's balance > 1499:
          set {sp mult.%player%} to 4
          remove 1500 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&b&lSpeed&3)" to player
          set line 3 of event-block to "&2$&a&l3.500"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l3.500":
      if line 2 of event-block is "&b&lSpeed":
        if player's balance > 3499:
          set {sp mult.%player%} to 5
          remove 3500 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&b&lSpeed&3)" to player
          set line 3 of event-block to "&2$&a&l7.500"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l7.500":
      if line 2 of event-block is "&b&lSpeed":
        if player's balance > 7499:
          set {sp mult.%player%} to 6
          remove 7500 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&b&lSpeed&3)" to player
          set line 3 of event-block to "&2$&a&l10.000"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
# BALANCE
    if line 3 of event-block is "&2$&a&l50":
      if line 2 of event-block is "&c&lPower":
        if player's balance > 49:
          set {bal mult.%player%} to 1
          remove 50 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&c&lPower&3)" to player
          set line 3 of event-block to "&2$&a&l150"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l150":
      if line 2 of event-block is "&c&lPower":
        if player's balance > 149:
          set {bal mult.%player%} to 2
          remove 150 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&c&lPower&3)" to player
          set line 3 of event-block to "&2$&a&l500"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l500":
      if line 2 of event-block is "&c&lPower":
        if player's balance > 499:
          set {bal mult.%player%} to 3
          remove 500 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&c&lPower&3)" to player
          set line 3 of event-block to "&2$&a&l1.500"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l1.500":
      if line 2 of event-block is "&c&lPower":
        if player's balance > 1499:
          set {bal mult.%player%} to 4
          remove 1500 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&c&lPower&3)" to player
          set line 3 of event-block to "&2$&a&l3.500"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l3.500":
      if line 2 of event-block is "&c&lPower":
        if player's balance > 3499:
          set {bal mult.%player%} to 5
          remove 3500 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&c&lPower&3)" to player
          set line 3 of event-block to "&2$&a&l7.500"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
    if line 3 of event-block is "&2$&a&l7.500":
      if line 2 of event-block is "&c&lPower":
        if player's balance > 7499:
          set {bal mult.%player%} to 6
          remove 7500 from player's balance
          message "{@p} &a&lFarm upgraded! &3(&c&lPower&3)" to player
          set line 3 of event-block to "&2$&a&l10.000"
          stop
        else:
          message "{@p} &c&lInsufficent money!" to player
          stop
  else:
    message "&cAny permission." to player

command /reset: #TEST COMMAND
  trigger:
    set {bal mult.%player%} to 0
    set {sp mult.%player%} to 0
[doublepost=1581152497][/doublepost]I know that this skript is annoying to read because of the lenght, but please help
 
There no error in chat, but when i create another farm (right click bedrock) all the stats of the other farms (power and speed) are the same of the created farm, example: I create my first farm, and i upgrade it with power and speed, and it's op. I wan't to create another farm, but without upgrading it, it's op like the other one. (same with what is my problem)
 
i know what to do but is the variable tab needed as it will break if it is
you gotta make it so it includes the location so you can have multiple farms this also needs to test if the block next to the bedrock is air so it don't break anything
 
Status
Not open for further replies.