Disguising as Mobs

Discussion in 'Plugin Development' started by Lactem, Feb 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Lactem

    Hey guys. Does anyone know the code to disguise as a mob? I only need skeletons and zombies. (No MobDisguise or DisguiseCraft, just independent disguising.) By disguising as a mob, I mean completely becoming the mob. (not just a head)

    Thanks in advance,
    Lactem
     
  2. Offline

    caseif

    I'm pretty sure you need to mess with sent packets, which can get a bit tricky. I wouldn't recommend working on this if you're relatively new to Java and/or Bukkit programming, but if you're experienced, go for it.
     
  3. Offline

    Lactem

    I am new, but this is pretty necessary for the plugin I am making. Could you give me any tips on how I would go about doing "messing with sent packets?"

    P.S. MCInfected can do change people into zombies.

    Thanks,
    Lactem
     
  4. Offline

    RealDope

    Use another plugin that already does it. DisguiseCraft has a nice API. It seems like your pretty new, don't go diving into packets and all that just yet.
     
    SoS_Dylan likes this.
  5. Offline

    lenis0012

    This is impossible

    Me and my friend have been working around with this, the way you create a disguise is by creating a mob using packets.
    And to move the mob you send a move packet.

    But the problem is that you are nto able to vanish yourself, you could send a remove entity packet on the players entity id and the client would make it disappear. but in that case you would not be able to move at all.

    However mc 1.4 has brought enchantment potions for invicibility.
    So since the potions get handled server-side there muyst be a packet tellign the client to vanish the player itself.

    This might be able but i would need to take a look at the new MetaData.

    and depending on the server lagg there might actualy be delay in walking, as you basicly need to first wait for the cleint to respond who sends a packet to the server AFTER the movement was actualy done, at that point the server could send a movement packet for the disguised mob to mvoe for all clients.
     
  6. Offline

    RainoBoy97

    If its impossible, how does DisguiseCraft do it then? :p
     
  7. Offline

    Lactem

    Yes, I do agree that it is possible. If you look at the MCInfected servers, you'll notice that people completely turn into zombies and other mobs. Also, it is different than potions of invisibility. I can tell you this because I turned on tracers, which draw a line to other players around me, and they drew lines to people with invisibility. They did not, however draw lines to the zombies in MCInfected. I think I already know how to give them the effect of invisibility. (player.PotionEffect() or something like that.) Does this help at all?
     
  8. Offline

    chasechocolate

  9. Offline

    Lactem

    I suppose I could do that, but then I would have to be reliant on CraftBukkit AND DisguiseCraft. I was thinking I could cut out the middleman.... (DisguiseCraft)
     
  10. Offline

    RainoBoy97

    You can also use the hidePlayer method, which will hide the player ingame and on the tablist. You could also do the potion thing, but it will make potion particles.
    I suggest using DisguiseCraft as dependency, or look at their source code.
     
  11. Offline

    Lactem

    I am using the DisguiseCraft API, but I can't seem to get it to work. Shall I give you my code?
     
  12. Offline

    chasechocolate

    That would help.
     
  13. Offline

    Lactem

    The website is http://pastebin.com/yeXAFK1D. I know I need the "depend: DisguiseCraft" or whatever in the plugin.yml, but I'm not sure where it goes.
     
  14. Offline

    lenis0012

    I know hod DisguiseCraft does it.

    But seeing yourself as the mob is anrother story.
    You get alot of delay by doing that

    Maybe the error in the log?

    Code:
    //x1, y1, and z1 are the coordinates for the skeles' spawn
                    int x1 = getConfig().getInt("x1");
                    int y1 = getConfig().getInt("y1");
                    int z1 = getConfig().getInt("z1");
    //x2, y2, and z2 are the coordinates for the zombies' spawn
                    int x2 = getConfig().getInt("x2");
                    int y2 = getConfig().getInt("y2");
                    int z2 = getConfig().getInt("z2");
    
    are these variables set in the config?

    Edit:
    Code:
    new Disguise(dcAPI.newEntityID(), DisguiseType.Zombie);
    
    Thats not going to disguise a player.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  15. Offline

    Lactem

    1. I don't mean having yourself look like a mob.
    2. There are no errors. The code just doesn't do it's job.
    3. Why isn't that supposed to disguise a player? I'm pretty sure that's what the DisguiseCraft page said.
     
  16. Offline

    lenis0012

    The DisguiseCraft API is only undertandable for advanced developpers.

    BeTheMob shows coding examples of their api:
    http://dev.bukkit.org/server-mods/bethemob/pages/be-the-mob-api/

    you could do this for example:
    Code:
    Api api = BeTheMob.getApi();
    Disguise dis = api.createDisguise(player, player.getLocation(), EntityType.ZOMBIE, null);
    api.addDisguise(player, dis);
    
    to undsiguise:
    Code:
    Api api = BeTheMob.getApi();
    api.removeDisguise(player);
    
    Hope that makes sense.

    What you did in DisguiseCraft was make a Disguise, but nto bind it to the player.
    BeTheMob is a plugin i created that allows disguising, you should just check the BukkitDev page.
     
  17. Offline

    Lactem

    Thanks. I'll try it out.
     
  18. Offline

    chasechocolate

  19. Offline

    lenis0012

Thread Status:
Not open for further replies.

Share This Page