I want to limit animal breeding.

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

donghan kim

New Member
Sep 7, 2018
9
0
1
27
Skript Version (do not put latest): Skript 2.2 (dev34)
Minecraft Version: 1.12.2

---
Problem:
I want to limit animal breeding.

Actually, The breeding restriction succeeded. However, the cancel event does not end the breeding attempt. This Skript Print more than 30 "test" messages.

Is there a way to end the breeding attempt?



%EC%BA%A1%EC%B2%98.PNG


---
Full Code:
code_language.skript:
on Breeding:
    if event-animal is sheep:
        if {breed::%breeder%} is not set:
            set {breed::%breeder%} to 0
        if {breed::%breeder%} > 0:
            message "test1" to breeder
        if {breed::%breeder%} is 0:
            message "do not breed!" to breeder
            message "test2" to breeder
            cancel event
    broadcast "%breed item used%"
    broadcast "%breeder%"


Addons using (including versions):
sharpSK 1.6.3
skDragon
skllett 1.9.6b
SkQuery
skRayFall
skUtilities
TuSKe
SKCompat-2.1.0
SkStuff
SkAction 2.2

[template=footer][/template]
 
cancel event cancels it.
But you have a message to send before the cancel event, therefor the message sends, then the event cancels
The message sending isnt the event. The breeding is the event, that is cancelled, but the rest of your code will still fire
 
Status
Not open for further replies.