Teleport Player when hit with Blaze Rod

Discussion in 'Archived: Plugin Requests' started by PhoKing, Jan 30, 2014.

  1. Offline


    SO. I don't know if this is possible, but we'll see.

    I need a plugin that makes it so when you're in 'world' and you hit somebody with a Blaze Rod, it teleports the person that got hit to certain coordinates in that world.

    Why do I need this? I am having an npc walk back and forth from point A to point B "protecting" his loot. The point is to have players try to sneak in and steal the loot without the npc noticing them. (I set the npc to attack any players in a range of 2 blocks).

    So this would be fine how it is, but simply hitting them with a Blaze Rod isn't very effective, as the players can have a friend run in and get beat to hell while everybody else grabs the loot. So that is why it would be much more effective if when the npc hits the player, it teleports the player to the center of the town (so they will have to run back and try again).

    (I used an enchanted stick in the picture, but just imagine it as a blaze rod ;) )
    Loot = Chest, NPC = The Guard

    The npc will be walking from the "Loot" to outside the doorway. (When the npc is going outside is the perfect time for players to run in and grab the loot.)

    Side Note: The Teleporting Blaze Rod item will be used ONLY in the hands of the NPC's, NOT PLAYERS! Will this still allow the plugin to work correctly?

    Thanks in advance! :D
  2. This doesn't seem to be too bad. Only 1 thing, you say a NPC is carrying the blaze rod, I assume this NPC is an Entity instead of a Player? This is rather important for your side note. xD
    PhoKing likes this.
  3. Offline


    Lol yeah. :rolleyes:

    Think it could still work?
  4. This should be easy to do, though there is another problem. I can't test this since I do not have the NPC's in my server.
    PhoKing likes this.
  5. Offline


    Oh, here's how to get citizens.

    ^^^ Newest version of citizens
    Download that, place it in the plugins folder, restart server.

    Go in your server, and type /npc create RandomNameHere

    Then type /npc equip
    Right click the npc with the item you're holding, and the npc will equip it. Once you're done equipping the item, do /npc equip to close the editor.
    (To remove all of the items the npc is holding, right click the npc with nothing in your hand)

    Those are the only commands you would need to test out the plugin.

    If you need more you can go here

    If you could do this, I would be so amazed :p
  6. Alright, I'll have a look at this later today. You'll hear from more. For now I made a promise for another plugin request and I have my own server with my own plugins, but I think I can make this work for you.
    PhoKing likes this.
  7. Offline


    Awesome! No rush at all. We're still in the building process of our server, and aren't doing any plugin work for about 3 more weeks.

    HUGE thanks for this! :)
  8. Alright, but 1 more thing. How do I make it so he will attack me within 2 blocks radius?
    I can't know for sure how to solve this, until I can capture him attacking me. ;)
  9. Offline


    To make the NPC able to attack players you need the add-on called Sentry.


    Drop the jar in your plugins folder, restart server, ect.

    Once you're back on the server, face your npc and do /npc sel
    Then  /sentry target add entity:player
    Then  /sentry range 2
    Then your npc should attack any player in the range of 2 blocks.
  10. I did /npc sel, whichs tell me I already have that NPC selected. Then I type /npc target add entity:player, and it tells me I can only perform this on a sentry. :(
  11. Offline


    Hasn't been tested, not sure if I've used the correct event to check if NPC hits player, but worth the shot:
    # The loot guards name, this is required to be able to identify which NPC will be able to TP players
    # out. The name is case sensitive, so enter the name exactly how it is.
    lootGuard: 'Loot Guard'
    # Format worldname:xvalue:yvalue:zvalue - Must use whole numbers.
    - world:100:65:100
    Obviously needs Citizens to run.
    AlmarM likes this.
  12. Offline


    Oh whoops. I forgot a command. Try this.

    /npc sel
    /trait sentry
    /target add entity:player
    /sentry range 2

    It works!

    Even better, it works without the blaze rod! I just included the blaze rod because I thought it would be easier.
    I'll keep in contact with you incase I experience any errors with it.

    Thankyou so much! :)

    PS: When the npc attacks with the balze rod, he shoots fireballs..? Is that some screw up on my end or yours? But either way it doesn't matter, because I prefer him to not hold a blaze rod.

    Oh and also, is it possible to make a custom message appear on the player's screen? Something like "You wake up feeling dizzy..." ?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 6, 2016
  13. Offline


    PhoKing likes this.
  14. Offline


    Thought of 2 other thing that I need.
    Is it possible for when the player gets caught for it to subtract money from their bank account? I'm using the essentials economy.
    Also, when they get teleported I have been trying to work out a way to cause the players to get the potion effects Confusion & Blindness for maybe 20-30 seconds.

    I found this plugin --->

    /potion [duration] [amplifier] <---
  15. Offline


    Yeah I'll be able to add those, I'll get around to it when I can.
    PhoKing likes this.
  16. Offline


    Okay sweet!!!

    Just reply here whenever you get around to it. You're amazing :D
  17. Offline


  18. Offline


    Hey thanks!

    So, the -$500 works flawlessly.

    But, there are no potion effects.

    Also, I took the gold nuggets, got caught, and they disappeared like they were supposed to, but the next time I tried it, I had 2 in my inventory (in separate inventory slots), then 2 more (stacked on top of each other in 1 inventory slot), and it only took the 2 from separate slots, not the stacked. Then after that it didn't take ANY nuggets.

    Any idea what's up?

Share This Page