Why isnt this working? The ender dragon spawns, player rides it, but then its stuck in one place and when it gets to low hp it moves at mach 10

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

sunkoslonko

New Member
Mar 31, 2024
6
0
1
21
if player has unbreakable netherite sword of sharpness 5 and fire aspect 2 and looting 3 and sweeping edge 3 named "&a Dragon" in main hand:
spawn ender dragon at location of player
tame last spawned ender dragon to player
make player ride last spawned ender dragon
push player's vehicle in horizontal direction of player at speed 0.1
loop 1000 times:
push player's vehicle in horizontal direction of player at speed 0.1
wait 1 ticks
kill last spawned ender dragon
 
Enderdragons are often quite strange when spawned in the overworld? Also why are you looping 1,000 times and pushing it every tick?
 
Enderdragons are often quite strange when spawned in the overworld? Also why are you looping 1,000 times and pushing it every tick?
okay so a little back story. I am making a plugin for my smp. I am graduating IT in a year and ive tried to do this with java but when complications came i tried to find more simple ways and found skript. Okay the plugin is something like custom swords and each one does something cool. Obviously if you spawned a enderdragon on smp that you could fly around endlessy you would be kind of unkillable. So thats why i loop it 1000 times so the dragon isnt just a thing ppl will use to escape from every fight. Also what is the issue of repeating it every tick? And also so there is no way to fix this?
 
Try making the delay longer than every tick.
already tried... updated my code:
its in on swap hands event (no errors in the code btw)


if player has unbreakable netherite sword of sharpness 5 and fire aspect 2 and looting 3 and sweeping edge 3 named "&a Dragon" in main hand:
spawn ender dragon at location of player
tame last spawned ender dragon to player
make player ride last spawned ender dragon
set last spawned ender dragon's health to 1
loop 100 times:
if player has unbreakable netherite sword of sharpness 5 and fire aspect 2 and looting 3 and sweeping edge 3 named "&a Dragon" in main hand:
push player's vehicle in horizontal direction of player at speed 0.1
wait 20 ticks
else:
kill last spawned ender dragon
kill last spawned ender dragon
 
Try setting a local variable to the last spawned ender dragon and using it to push the entity directly rather than using player's vehicle. Also increase the speed at which you push it. 0.1 won't do too much to an ender dragon.

Does it still go like mach 100 when it dies?
 
Try setting a local variable to the last spawned ender dragon and using it to push the entity directly rather than using player's vehicle. Also increase the speed at which you push it. 0.1 won't do too much to an ender dragon.

Does it still go like mach 100 when it dies?
Ok im not sharpest with skripts syntax.. what i did wrong?



if player has unbreakable netherite sword of sharpness 5 and fire aspect 2 and looting 3 and sweeping edge 3 named "&a Dragon" in main hand:
spawn ender dragon at location of player
tame last spawned ender dragon to player
make player ride last spawned ender dragon
set {entityy} to last spawned ender dragon
set last spawned {entityy}'s health to 1
loop 100 times:
if player has unbreakable netherite sword of sharpness 5 and fire aspect 2 and looting 3 and sweeping edge 3 named "&a Dragon" in main hand:
push player's vehicle in horizontal direction of player at speed 0.1
wait 20 ticks
else:
kill last spawned {entityy}
kill last spawned {entityy}
 
Try this.
Python:
on swap hand items:
    if name of player's tool contains "&a Dragon":
        spawn ender dragon at location of player
        set {_d} to last spawned ender dragon
        set name of {_d} to "&5%player%'s dragon!"
        tame {_d} to player
        make player ride {_d}
        set {_d}'s health to 1
        while name of player's tool contains "&a Dragon":
            push player's vehicle in horizontal direction of player at speed 1
            wait 10 ticks
        name of player's tool does not contain "&a Dragon":
            kill {_d}
Do note that this is untested, but I do know that it doesn't return any errors.
This also means that instead of using loop 100 times, it's going to continue pushing the dragon every half second until your held item does not contain "&a Dragon". (I've also taken the liberty of making some of the lines shorter by checking the name of the item rather than the entire item. Do note that players cannot just rename their swords in an anvil, it'll still work fine.)

My only question is why do you have that random space in the name of your sword.
 
Try this.
Python:
on swap hand items:
    if name of player's tool contains "&a Dragon":
        spawn ender dragon at location of player
        set {_d} to last spawned ender dragon
        set name of {_d} to "&5%player%'s dragon!"
        tame {_d} to player
        make player ride {_d}
        set {_d}'s health to 1
        while name of player's tool contains "&a Dragon":
            push player's vehicle in horizontal direction of player at speed 1
            wait 10 ticks
        name of player's tool does not contain "&a Dragon":
            kill {_d}
Do note that this is untested, but I do know that it doesn't return any errors.
This also means that instead of using loop 100 times, it's going to continue pushing the dragon every half second until your held item does not contain "&a Dragon". (I've also taken the liberty of making some of the lines shorter by checking the name of the item rather than the entire item. Do note that players cannot just rename their swords in an anvil, it'll still work fine.)

My only question is why do you have that random space in the name of your sword.
Hey thank you for putting time into this! But still the dragon is stuck in one place it is not moving. Idk if its an issue that only i have or something else. I even tried to go to end dimension because you stated that ender dragons behave weirdly in other dimensions and it is not working there either..
 
The dragon spawns and the player rides it though, right? And it dies when the player switches away from the sword?
 
Python:
on swap hand items:
    if name of player's tool contains "&a Dragon":
        spawn ender dragon at location of player
        set {_d} to last spawned ender dragon
        set name of {_d} to "&5%player%'s dragon!"
        tame {_d} to player
        make player ride {_d}
        set {_d}'s health to 1
        while name of player's tool contains "&a Dragon":
            push {_d} in direction of player's target block at speed 1
            wait 10 ticks
        name of player's tool does not contain "&a Dragon":
            kill {_d}
This is the last I can think of, if this doesn't work, I'm stumped.
 
Python:
on swap hand items:
    if name of player's tool contains "&a Dragon":
        spawn ender dragon at location of player
        set {_d} to last spawned ender dragon
        set name of {_d} to "&5%player%'s dragon!"
        tame {_d} to player
        make player ride {_d}
        set {_d}'s health to 1
        while name of player's tool contains "&a Dragon":
            push {_d} in direction of player's target block at speed 1
            wait 10 ticks
        name of player's tool does not contain "&a Dragon":
            kill {_d}
This is the last I can think of, if this doesn't work, I'm stumped.
still dragon is stuck. I dont know if this just an issue that i specificaly have or what but it still does the same thing as it did.