Skript Version:2.2-dev23
Skript Author:Bensku
Minecraft Version:1.11.2
Bare with me here when I try to explain what I mean and what I'm doing. I want to know if it's possible (or if anyone can think of a work around) to use a variable later in the code to call an option. As you will see I'm using the same options over and over depending on mob type and weapon used. If I could just plug in the victim mob's type in the name of an option, it would cut down my code by a lot! Something like {@%{_victim%}Iron} But obviously, that's messy and Skript doesn't like it haha.
In the options, I'm setting percentages for something to happen when a specific mob is killed. Iron and Diamond are just sword types to weight chances.
Then when an entity is killed
I want all mob deaths to be easily configurable and keep my code as small as possible. If I have to manually type each mob type death, I can, but using a variable inside an option would cut down a lot of work! Does anyone know of any work arounds or maybe offer me some advice?
Thanks so much!
Skript Author:Bensku
Minecraft Version:1.11.2
Bare with me here when I try to explain what I mean and what I'm doing. I want to know if it's possible (or if anyone can think of a work around) to use a variable later in the code to call an option. As you will see I'm using the same options over and over depending on mob type and weapon used. If I could just plug in the victim mob's type in the name of an option, it would cut down my code by a lot! Something like {@%{_victim%}Iron} But obviously, that's messy and Skript doesn't like it haha.
In the options, I'm setting percentages for something to happen when a specific mob is killed. Iron and Diamond are just sword types to weight chances.
code_language.skript:
options:
playerIron: 10%
playerDiamond: 25%
creeperIron: .1%
creeperDiamond: .25%
skeletonIron: .1%
skeletonDiamond: .25%
zombieIron: .1%
zombieDiamond: .25%
...etc the rest of the mobs eventually
Then when an entity is killed
code_language.skript:
on death:
set {_victim} to victim
if attacker is holding a diamond sword:
chance of {@%{_victim}%Diamond}
do stuff.
if attacker is holding a iron sword:
chance of {@%{_victim}%Iron}
do stuff
I want all mob deaths to be easily configurable and keep my code as small as possible. If I have to manually type each mob type death, I can, but using a variable inside an option would cut down a lot of work! Does anyone know of any work arounds or maybe offer me some advice?
Thanks so much!
Last edited: