Jump to content

Super Simple Kill Streak Skript


Fusezion

Recommended Posts

Something I've always noticed on minehut is that there are always some type of skript that people just can't figure out or just feels like it's far to complicated so when I was searching through the docs and I came across is divisible by (number) I felt like it was required of me to create the most common thing this condition would be used for.

 

#
#	As you can see there are a few events I have blocked out this is due to the fact I know some people won't want to use them
#	So in order to make sure this skript is usable for everyone anything that isn't a requirement I blocked out
#
#	At the bottom of this there will be an explanation on the on quit and on join events and why they are deleted and then set
#

options:
	# "placeholders"
	# [A] or [ATTACKER] | will be replaced with the attacker
	# [V] or [VICTIM] | will be replaced with the victim
	# [AKS] or [AKILLSTREAK] | will be replaced with the attacker's kills
	# [VKS] or [VKILLSTREAK] | will be replaced with the victim's kills


killstreak_kills: 5

	killstreak_msg: &c&lKS &8> &e[A] &7is now on a &e[AKS] killstreak&7!
	killstreak_death_msg_by_player: &c&lKS &8> &e[A] &7killed &e[V] &7while &e[V] &7was on a &e[VKS] killstreak&7!
	killstreak_death_msg: &c&lKS &8> &e[V] &7died while he was on a &e[VKS] killstreak&7!

on quit:
	delete {kills::%player%}

on join:
	set {kills::%player%} to 0

# You're required to have world guard for this event to work
#on region enter:
#	"%event-region%" contains "spawn"


# this event is from the Skript Addon Sk-NBeeT if minehut removes and adds SkBee then it will be in there too
#on bound enter:
#	"%event-bound%" contains "spawn"

on death of a player:
	set {_vkills} to {kills::%victim%}
	set {kills::%victim%} to 0
	if attacker is a player:
		add 1 to {kills::%attacker%}
		set {_akills} to {kills::%attacker%}

	set {_msg1} to "{@killstreak_msg}"
	set {_msg2} to "{@killstreak_death_msg_by_player}"
	set {_msg3} to "{@killstreak_death_msg}"

	loop 3 times:
		replace every "[V]" and "[VICTIM]" in {_msg%loop-value%} with "%victim%"
		if (floor({_vkills}/{@killstreak_kills})) > 0:
			replace every "[VKS]" and "[VKILLSTREAK]" in {_msg%loop-value%} with "%{_vkills}%"
		else:
			replace every "[VKS]" and "[VKILLSTREAK]" in {_msg%loop-value%} with "0"
		if attacker is a player:
			replace every "[A]" and "[ATTACKER]" in {_msg%loop-value%} with "%attacker%"
			replace every "[AKS]" and "[AKILLSTREAK]" in {_msg%loop-value%} with "%{_akills}%"
		else:
			replace every "[A]" and "[ATTACKER]" in {_msg%loop-value%} with "[INVALID]"
			replace every "[AKS]" and "[AKILLSTREAK]" in {_msg%loop-value%} with "0"
	if {_vkills} is divisible by {@killstreak_kills}:
		if {_akills} is set:
			broadcast formatted {_msg2}
		else:
			broadcast formatted {_msg3}
	{_akills} is set
	if {_akills} is divisible by {@killstreak_kills}:
		broadcast formatted {_msg1}

#
#	As I said above I said there was a reason for then on join and on quit it's not only to reset player killstreaks but it's also for blocking
#	an issue with using %player% lets say I removed the on quit and on join if a player was to get a 35 kill killstreak if they left and changed
#	their name their kill streak would reset and if anyone was to change their name to that player they would gain his/her's killstreak
#

#	NOTE: this skript was created inside the code formatter if there are any errors upon reload I'm dearly sorry if you're unable to
#	fix the errors yourself just reply here and I'll respond as soon as I can. Quick notice if the error happens to be on any of the broadcast
#	lines try removing "formatted" and try again I'm not sure when it was added or if it always been here there wasn't any documentation on it

# Looking back I notice this isn't as simple as it used to be that's due to the fact it's a mess with all the "placeholders" I needed to add
# to make msg editing more user friendly sorry if you can't make much sense of it <3

#
#	If you have any ideas on what I should create next please leave me some suggestions I've been bored as of late
#


Once again sorry if I made this to complicated it's just that I really wanted to make this new to skript friendly

Edited by Nic
fixed another bug

I'm a guy yes but I am also human just like any female so why do you believe it's so wrong to cry too?

Link to comment
Share on other sites

for people who want an extreamly simple one

 

options:
	killstreak_kills: 5

on join:
	set {kills::%player%} to 0
on quit:
	delete {kills::%player%}

on death of a player:
	set {kills::%victim%} to 0
	attacker is a player
	add 1 to {kills::%attacker%}
	{kills::%attacker%} is divisible by {@killstreak_kills}
#	send action bar "&c&lKS &8> &e%attacker% &fis on a &e%{kills::%attacker%}% kill streak" to all players
	broadcast formatted "&c&lKS &8> &e%attacker% &7is on a &e%{kills::%attacker%}% kill streak"

 

Edited by Nic

I'm a guy yes but I am also human just like any female so why do you believe it's so wrong to cry too?

Link to comment
Share on other sites

23 hours ago, Nic said:

for people who want an extreamly simple one

 


options:
	killstreak_kills: 5

on join:
	set {kills::%player%} to 0
on quit:
	delete {kills::%player%}

on death of a player:
	set {kills::%victim%} to 0
	attacker is a player
	add 1 to {kills::%attacker%}
	{kills::%attacker%} is divisible by {@killstreak_kills}
#	send action bar "&c&lKS &8> &e%attacker% &fis on a &e%{kills::%attacker%}% kill streak" to all players
	broadcast formatted "&c&lKS &8> &e%attacker% &7is on a &e%{kills::%attacker%}% kill streak"

 

you never need to set a variable to 0, see here

Link to comment
Share on other sites

10 minutes ago, Ofus-Will said:

you never need to set a variable to 0, see here

Never heard of that before I'll see what I can do with this new found knowledge thanks! XD

 

at the same time @Ofus-Will I don't see how that can apply to this situation besides me maybe changing it to delete instead I still need to reset the victim's kill and not going to lie I only really see use for that in messaging something similar to what the example is 

 

Edited by Nic

I'm a guy yes but I am also human just like any female so why do you believe it's so wrong to cry too?

Link to comment
Share on other sites

6 hours ago, Mesyl2 said:

Never heard of that before I'll see what I can do with this new found knowledge thanks! XD

 

at the same time @Ofus-Will I don't see how that can apply to this situation besides me maybe changing it to delete instead I still need to reset the victim's kill and not going to lie I only really see use for that in messaging something similar to what the example is 

 

The point is that setting a variable to 0 unnecessarily takes up unnecessary memory space that wouldn't be taken up if you deleted it instead. My point was that there is no point setting it to 0, as keeping it as not set allows you to work with the variable exactly the same, but saves memory.

Link to comment
Share on other sites

1 hour ago, Ofus-Will said:

The point is that setting a variable to 0 unnecessarily takes up unnecessary memory space that wouldn't be taken up if you deleted it instead. My point was that there is no point setting it to 0, as keeping it as not set allows you to work with the variable exactly the same, but saves memory.

That doesn't add up with what you originally posted

 

8 hours ago, Ofus-Will said:

you never need to set a variable to 0, see here

The link brings you to the otherwise expression which doesn't add up with what you just said I already said I could maybe delete it however at the same time I've also been running into errors with the values being none this has been most noticable in removing of balance if the variable is none and a player trys to buy something their balance is negative 

so for me to ensure no issues happen I set it to 0 you also need to keep in mind that logic only works for the very simple one and one more thing the variables are deleted upon leave

 

On 3/30/2020 at 2:23 AM, Mesyl2 said:

on join:
	set {kills::%player%} to 0

on quit:
	delete {kills::%player%}

 

 

I'm a guy yes but I am also human just like any female so why do you believe it's so wrong to cry too?

Link to comment
Share on other sites

15 minutes ago, Mesyl2 said:

That doesn't add up with what you originally posted

 

The link brings you to the otherwise expression which doesn't add up with what you just said I already said I could maybe delete it however at the same time I've also been running into errors with the values being none this has been most noticable in removing of balance if the variable is none and a player trys to buy something their balance is negative 

so for me to ensure no issues happen I set it to 0 you also need to keep in mind that logic only works for the very simple one and one more thing the variables are deleted upon leave

 

what's the point of storing a variable at all if you're going to delete it on leave?

there are no issues with the default value expression, if stuff is erroring you're doing it incorrectly
 

Link to comment
Share on other sites

1 hour ago, Ofus-Will said:

what's the point of storing a variable at all if you're going to delete it on leave?

there are no issues with the default value expression, if stuff is erroring you're doing it incorrectly
 

Who know! XD Why do we use variables in the first place?
Oh wait! I know because we need to store data

I'm a guy yes but I am also human just like any female so why do you believe it's so wrong to cry too?

Link to comment
Share on other sites

@Ofus-Will also while we're on this subject of why would we delete variables upon leave would you much rather have me just change it to meta data something about 3% of minehut skripters have even heard of let alone touch? because I couldn't agree more it's a much better way of storing tempory data

Edited by Mesyl2
Spelling

I'm a guy yes but I am also human just like any female so why do you believe it's so wrong to cry too?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...