attacker is a player
victim is an entity
attacker is holding diamond sword
name of attacker's tool is {sacrificialdagger}
set {_attackerYaw} to yaw of attacker
set {_victimYaw} to yaw of victim
set {_yawDiff} to {_attackerYaw} - {_victimYaw}
set {_yawDiff} to abs({_yawDiff})
if {_yawDiff} < 90:
if {backstab::%attacker%} is set:
set {_cool} to difference between {backstab::%attacker%} and now
if {_cool} < 30:
set {_remaining} to round(({@backstab-cooldown} - {_cool}) / 1 second)
send "&cBackstab is on cooldown (%{_remaining}%s)" to attacker
stop
# Backstab logic (respects armor)
add 50 to {oblation::%attacker%}
damage victim by 2.5
set {frozen::%victim%} to true
send "&dYou backstabbed %victim%!" to attacker
play sound "entity.player.attack.crit" with volume 1 and pitch 2 at victim
execute console command "particle minecraft:heart %victim's location% 0.3 0.3 0.3 0.05 5 force"
wait 5 seconds
delete {frozen::%uuid of victim%}
set {backstab::%attacker%} to now
else if {_yawDiff} < 180:
if {backstab::%attacker%} is set:
set {_cool} to difference between {backstab::%attacker%} and now
if {_cool} < 20:
set {_remaining} to round(({@frontstab-cooldown} - {_cool}) / 1 second)
send "&cBackstab is on cooldown (%{_remaining}%s)" to attacker
stop
# Backstab logic (respects armor)
add 25 to {oblation::%attacker%}
apply weakness 2 to victim for 15 seconds
apply slowness 2 to victim for 15 seconds
set {frontstab::%attacker%} to now```
There are NO errors its just not working
#Why is this not working?
1 messages · Page 1 of 1 (latest)
What exaxtly isnt working?
all of it
Is this code ai by Chance?
thats me copying code from other things
i can fix them
also is it not normal to randomly add comments
Not really
i do that...
Well
if it makes me victimized ill stop
Debug it
And if you find what doesnt work
And you dont know how to fix it
Then you should come back to this
Senternal.jpeg suggests that you read this embed
Debug
What is debugging?
Debugging is the process of finding and fixing bugs/issues/errors within your code. For a more detailed explanation on proper debugging check out sovdee's page
Variables
Since you don't see the value of variables it can be easy to assume that everything is working properly even though that might not be the case. Variables and arguments in functions and commands might change throughout your code in unexpected ways. It is a good idea to broadcast your variables at different points in your code to confirm that the value is what you expect it to be.
on chat:
broadcast {chats::%player's uuid%}
add 1 to {chats::%player's uuid%}
broadcast {chats::%player's uuid%}```
In this example we broadcast the variable to check its value before and after we add to it to make sure the value goes up. If the variable was set to a string (`set {chats::%player's uuid%} to "3"`) then we would be able to see that the value did not go up, alerting us of the issue.
Conditions
If your code does no seem to be doing anything it is a good idea to establish which parts of your code are being executed, especially when using conditions. To accomplish this, add a broadcast after each part of line of your code with a descriptive message.
on right click:
broadcast "player clicked"
if player's tool = iron sword:
broadcast "player's tool was iron sword"
set player's tool to diamond sword```
In this example, we would only see the `player clicked` message if the player was holding an apple, alerting us that the code stopped after the first condition.
NBT
If you are debugging nbt you can use send pretty nbt of nbt of player's tool with split to make it more readable.
It is recommended that you don't use AI agents for multiple reasons @pale kindle:
2) Blindly trusting code from any source is a bad idea, especially on production servers. Even if the code that was generated appears to work, you have no clue what vulnerabilities it introduces or fails to protect against.
3) Using AI to write your code takes away from your learning and doesn't challenge you to develop problem solving skills.```
While AI can be used as a tool, it is necessary to understand what it is doing and check any code it creates. Since this is a learning community, we want to support your personal growth. As a result, we don't allow generated content in our help channels ([Rule 8](<#welcome-to-skunity message>))
It looks highly ai Generated i must admit
"Backstab logic (respects armor)"
"victim is an entity"
attacker is holding diamond sword
name of attacker's tool is {sacrificialdagger}
Senternal.jpeg suggests that you read https://sovdee.gitbook.io/skript-tutorials/
Read this instead of using ai
And you dont learn anything using it
the name of attacker's tool is {sacrificialdagger} is just me trying to quickly fix smth
Stop saying excuses
You wont get banned for using ai code, except if you do it repeatadly
im not using excuses im genuilly saying what i did
& ur freeze isnt working cus theeres no functionality 💀
prolly
If he has an on player move then the code is prolly ai too tho✌️
Least laggy event oat
there is
loop all players:
if {frozen::%loop-player%} is set:
if loop-player's location is not {previous-location::%loop-player%}:
teleport loop-player to {previous-location::%loop-player%}
send action bar "&cYou are stunned and cannot move!" to loop-player
set {previous-location::%loop-player%} to loop-player's location```
Why are you setting a global variable
This can be done much better using local variables
i actually dk why i did that
i was probally planning to use it in other skripts
at that time