NPC creation

Discussion in 'Plugin Development' started by 1928i, Aug 15, 2014.

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

    1928i

    I want to create custom and interactive NPCs of players and mobs to use for my plugin. I have no clue on where and how to begin this even after about an hour of research. So I will start simply. Can anyone help me create a player/mob NPC?
     
  2. Offline

    Garris0n

    Well you should probably start with understanding how to use NMS. Try playing with some packets, custom entities, etc.
     
  3. Offline

    1928i

    Ok... Can anyone provide code that could help me understand how to do this goal?
     
  4. Offline

    ChipDev

    Why is NMS your first response, not your last?
    You could just add metadata to a mob, and onClick get the metadeta and do something.
     
  5. Offline

    1928i

    ChipDev And how would one go about doing that?
     
  6. Offline

    ChipDev

    Use a
    Code:
    Entity e = YourWorld.spawn(loc, Pig.class);
    then, (Well I didn't study metadata yet, so if anyone could tell me..)
    Code:
    e.setCustomName("Teller");
    e.setCustomNameVisible(false);
    Then on click, test for the name "Teller"
     
  7. Offline

    xTigerRebornx

    ChipDev Shouldn't really suggest that people use something you yourself don't know how to use. Edit: @ suggesting NMS, the OP wanted Player NPCs, which requires NMS or related libraries.
    1928i Look at the Metadatable interface and its methods, Entities, Blocks, and Worlds implement it, meaning you can attach metadata to them using the methods
     
  8. Offline

    DinosParkour

    ChipDev 1928i I'd go with
    Code:java
    1. Pig pig =(Pig) p.getWorld().spawnEntity(p.getLocation(), EntityType.PIG);
    2. pig.setCustomName("Player");
    3. pig.setCustomNameVisible(false);
     
  9. Offline

    Garris0n

    Well, I assumed he meant along the lines of Player NPCs that move around and such. That's generally what people mean when they say "NPCs".
     
  10. Offline

    ChipDev

    Definition on NPC :
    Definition: (open)
    A non-player character (NPC), sometimes known as a non-person character or non-playable character, in a game is any character that is not controlled by a player. In electronic games, this usually means a character controlled by the computer through artificial intelligence.

    Does it mean any player, or the player YOU control..?
     
  11. Offline

    Garris0n

    In the context of threads on the Bukkit Forums in the Plugin Development section, when people say "how do I make an NPC" they have a tendency to specifically mean the sorts of NPCs that require NMS code to function.
     
    xTigerRebornx likes this.
  12. Offline

    1928i

  13. Offline

    xTigerRebornx

    1928i Research is how you "learn" NMS, most of the Minecraft source is obfuscated, meaning you have to do your research and deobfuscate it using what little knowledge is provided.
     
  14. In order to understand NMS, one must first understand NMS

    #Recursion
     
    BillyGalbreath and octoshrimpy like this.
  15. Offline

    octoshrimpy

    Garris0n so if I wanted a non-player NPC I wouldn't need NMS?
     
  16. Offline

    Garris0n

    That depends on what you want it to do.
     
  17. Offline

    octoshrimpy

    player = player that spawned specific mob, either from interactEvent with monster_egg or from command;


    Something alongside the lines of a pet(disguised as a block, perhaps. I'll need ProtocolLib for this, I know that for a fact.), that follows the player around (toggleable) that the player can interact with onClick.
     
  18. Offline

    Garris0n

    octoshrimpy For the following, you would probably need to use NMS (unless you created your own pathfinding system and handled the mobs purely with packets and ProtocolLib).

    Or perhaps EntityAPI in the future DSH105 CaptainBern
     
    octoshrimpy and DSH105 like this.
  19. Offline

    DSH105

    Hopefully we can turn that into the very near future ;D
     
    xTigerRebornx and octoshrimpy like this.
  20. Offline

    octoshrimpy

Thread Status:
Not open for further replies.

Share This Page