Solved Tamed horse spawning

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

Dabriel

Member
Aug 13, 2018
45
5
0
27
So what I'm having troubles with, is spawning a horse, tame it, mount it, and be able to move with it.
I was able to reach the mounting and taming effects but I can't go further. Like moving the horse, can you help me with this if you know how?

My current code:
code_language.skript:
on right click:
    if player's tool is saddle named "&6Jhu le Horse":
        spawn horse at player's location
        set {_entity} to last spawned entity
        make player ride {_entity}
What I need:
- a way to tame the spawned horse
- a way to be able to ride it and move with it.

Thanks : )
 
Effect
code_language.skript:
effect tame %entities% to %player%:
  trigger:
    loop expressions 1:
      try loop-value.setOwner(expr 2)

Example
code_language.skript:
tame last spawned entity to player

Requires
code_language.skript:
- Skript-Mirror
 
  • Like
Reactions: Dabriel
Effect
code_language.skript:
effect tame %entities% to %player%:
  trigger:
    loop expressions 1:
      try loop-value.setOwner(expr 2)

Example
code_language.skript:
tame last spawned entity to player

Requires
code_language.skript:
- Skript-Mirror
Thank you, the taming actually worked.
Now I just need a way to make it equip a saddle and be able to move with it.
Are you able to tell me how?
 
Riding should have the same functionality as how you used it, as long as you put it last.

For the saddle:

Expression
code_language.skript:
equip [%living entity%] with %item types%
make %living entity% wear %item types%

Example
code_language.skript:
equip last spawned entity with saddle
 
Riding should have the same functionality as how you used it, as long as you put it last.

For the saddle:

Expression
code_language.skript:
equip [%living entity%] with %item types%
make %living entity% wear %item types%

Example
code_language.skript:
equip last spawned entity with saddle
My code is now this,

code_language.skript:
on right click:
    if player's tool is saddle named "&6Jhu le Horse":
        spawn horse at player's location
        set {_entity} to last spawned horse
        tame last spawned horse to player
        equip last spawned horse with saddle
        make player ride {_entity}

The issue is, the horse will spawn. But now, the player will not ride the horse, and neither will the horse spawn with a saddle.
Any fix?
 
Can't reproduce your issue, your code and this code both work

code_language.skript:
command /horse:
  trigger:
    spawn horse at player's location
    tame last spawned horse to player
    equip last spawned horse with saddle
    make player ride last spawned horse
 
Can't reproduce your issue, your code and this code both work

code_language.skript:
command /horse:
  trigger:
    spawn horse at player's location
    tame last spawned horse to player
    equip last spawned horse with saddle
    make player ride last spawned horse
I actually realized that the code is giving errors in console.

Java:
19.08 15:45:54 [Server] ERROR Could not pass event PlayerCommandPreprocessEvent to Skript v2.2-dev37c
19.08 15:45:54 [Server] INFO org.bukkit.event.EventException: null
19.08 15:45:54 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:499) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:484) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1378) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1221) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_171]
19.08 15:45:54 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_171]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
19.08 15:45:54 [Server] INFO Caused by: java.lang.NoSuchMethodError: org.bukkit.entity.AbstractHorse.getInventory()Lorg/bukkit/inventory/AbstractHorseInventory;
19.08 15:45:54 [Server] INFO at ch.njol.skript.effects.EffEquip.execute(EffEquip.java:94) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.lang.Effect.run(Effect.java:52) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.lang.Trigger.execute(Trigger.java:55) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:294) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:251) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.command.Commands.handleCommand(Commands.java:257) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:172) ~[?:?]
19.08 15:45:54 [Server] INFO at sun.reflect.GeneratedMethodAccessor132.invoke(Unknown Source) ~[?:?]
19.08 15:45:54 [Server] INFO at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
19.08 15:45:54 [Server] INFO at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
19.08 15:45:54 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO ... 16 more
19.08 15:45:54 [Server] ERROR null
19.08 15:45:54 [Server] INFO org.bukkit.command.CommandException: Unhandled exception executing command 'horse' in plugin Skript v2.2-dev37c
19.08 15:45:54 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:651) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1386) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1221) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_171]
19.08 15:45:54 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_171]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
19.08 15:45:54 [Server] INFO Caused by: java.lang.NoSuchMethodError: org.bukkit.entity.AbstractHorse.getInventory()Lorg/bukkit/inventory/AbstractHorseInventory;
19.08 15:45:54 [Server] INFO at ch.njol.skript.effects.EffEquip.execute(EffEquip.java:94) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.lang.Effect.run(Effect.java:52) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.lang.Trigger.execute(Trigger.java:55) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:294) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:251) ~[?:?]
19.08 15:45:54 [Server] INFO at ch.njol.skript.command.ScriptCommand.onCommand(ScriptCommand.java:196) ~[?:?]
19.08 15:45:54 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot-1.12.1.jar:git-Spigot-da42974-8f47214]
19.08 15:45:54 [Server] INFO ... 15 more

My server's version is 1.12.1, this is confusing me. Nothing else is giving any errors, but this.
 
can't help you there buddy, you could try running paper?
Well, I do know that the equip effect is what's causing this error.
thank you for your help anyways.
[doublepost=1534709215,1534708752][/doublepost]
can't help you there buddy, you could try running paper?
I've actually solved it.

This is my code if anyone want it.

code_language.skript:
on right click:
    if player's tool is saddle named "&6Jhu le Horse":
        spawn horse at player
        add "{Variant:259,SaddleItem:{id:saddle,Count:1},Age:0}" to last spawned entity's nbt
        tame last spawned entity to player
        make player ride spawned horse
 
Status
Not open for further replies.