Jump to content

I'm trying to make generator upgrades


Mel0nx
 Share

Recommended Posts

#-------------------------------------------------------------------------------------------------------

every 5 seconds:
	loop all players in world "plots":
		loop all blocks in radius 10 around loop-player:
			if loop-block is coal block:
				drop a coal at loop-block's position
		
#-------------------------------------------------------------------------------------------------------

every 5 seconds:
	loop all players in world "plots":
		loop all blocks in radius 10 around loop-player:
			if loop-block is iron block:
				drop a iron ingot at loop-block's position

#-------------------------------------------------------------------------------------------------------

every 5 seconds:
	loop all players in world "plots":
		loop all blocks in radius 10 around loop-player:
			if loop-block is gold block:
				drop a gold ingot at loop-block's position

#-------------------------------------------------------------------------------------------------------

every 5 seconds:
	loop all players in world "plots":
		loop all blocks in radius 10 around loop-player:
			if loop-block is diamond block:
				drop a diamond at loop-block's position

#-------------------------------------------------------------------------------------------------------

every 5 seconds:
	loop all players in world "plots":
		loop all blocks in radius 10 around loop-player:
			if loop-block is netherite block:
				drop a netherite ingot at loop-block's position

		
#-------------------------------------------------------------------------------------------------------

on craft of coal block:
	cancel event

on craft of iron block:
	cancel event

on craft of gold block:
	cancel event

on craft of diamond block:
	cancel event

on craft of netherite block:
	cancel event

on craft of coal:
	cancel event

on craft of iron ingot:
	cancel event

on craft of gold ingot:
	cancel event

on craft of diamond:
	cancel event

on craft of netherite ingot:
	cancel event


#[----------------------------------------------------------------------------------------------------------------]
on break of coal block:
	if "%world%" contains "plots":
		cancel event
		set block to air
		drop iron block named "&b&lCoal &b&lGenerator"

on break of iron block:
	if "%world%" contains "plots":
		cancel event
		set block to air
		drop iron block named "&b&lIron &b&lGenerator"

on break of gold block:
	if "%world%" contains "plots":
		cancel event
		set block to air
		drop iron block named "&b&lGold &b&lGenerator"

on break of diamond block:
	if "%world%" contains "plots":
		cancel event
		set block to air
		drop iron block named "&b&lDiamond &b&lGenerator"

on break of netherite block:
	if "%world%" contains "plots":
		cancel event
		set block to air
		drop iron block named "&b&lNetherite &b&lGenerator"

This is the code. I want the generator to upgrade when someone right-clicks it. For example, if i want an iron generator, i right-click the coal generator. But i want the upgrades to cost something from the essentials balance.

I have plugins: EssentialsChat, EssentialsX, LuckPerms, PlotSquared v5, Skript, SkBee, skQuery, skRayFall, SkVault, Vault, WorldEdit

 

Edited by Mel0nx
I forgot to put some information
Link to comment
Share on other sites

Firstly, I recommend remaking most portions of the Skript if possible. This format is extremely inefficient and will most likely cause substantial lag.

Second, you can set a block by doing:

on right click on <block>:
  	if the player's balance is greater than <amount>:
  		set block at location of event-block to <new block>
  		send action bar "&aYou've upgraded your generator at &2%location of event-block%&a!" to player
  		subtract <amount> from the player's balance
  	else:
  		send action bar "&cYou do not have enough money to do this!" to player

 

  • Thanks 1

––––––––––––––––––––––––––––––––––––––––––––––––––

Please leave a reaction if my assistance was satisfactory!

 

Link to comment
Share on other sites

  • 1 month later...

on right click on white terracotta: if "%world%" contains "Plots": wait 1 tick if player's balance is more or equal to 500: subtract 500 from player's balance set block to orange terracotta send action bar "&d&lUpgraded Generator!" to player else: send "&cError: &eInsufficient funds to upgrade Gen! &eYou need &a$500 &eand you have &a%player's balance%&e!"

Link to comment
Share on other sites

🔐 Topic locked.

Please do not reply on threads that have been inactive for over a month.

Discord - Tarna256#8675

In-game name - _Tarna_

Follow @Tarna_256 on Twitter

---------------------------------------------------------

[VIP] - 7/27/2020

Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



×
×
  • Create New...