[LIB] [1.7] Remote entities - Next generation NPC library [No support]

Discussion in 'Resources' started by kumpelblase2, Nov 10, 2012.

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

    Regenwurm97

    Have a question:

    - Is there a tutorial or a help page on how to let an entity follow waypoints? I found something like Paths in the classes but dont know how to set up such a path :l
     
  2. Offline

    Quaro

    1. How to add equipment for human npc?
    2. How to set visible display name for npc(for example: chicken)
    3. I think this is a bug: when you create 2 npcs, and check: isRemoteEntity, than only last spawned will be true;
     
  3. Offline

    BRampersad

    2. entity.getBukkitEntity().setCustomNameVisible(true);
     
  4. Offline

    Quaro

    1. How to spawn for example baby zombie npc (and disable growing)?
    2. I think this is a bug: when you create 2 npcs, and check: isRemoteEntity, than only last spawned will return true;
     
  5. Offline

    BRampersad

    1.
    Code:
                RemoteEntity entity = npcManager.createEntity(RemoteEntityType.Zombie, p.getLocation());
                Zombie z = (Zombie) entity.getBukkitEntity();
                z.setBaby(true);
     
  6. Offline

    kumpelblase2

    Tested this several times, so issues. I don't know why it happens, because otherwise all the other things shouldn't work either.

    What you found were things I've been working on but wasn't able to finish up to this point. There's no desire for that but since this is a library, you can easily make such thing by yourself. Just create a new desire, add your things to it and apply it on the entity - done.

    1. just like you'd do normally in bukkit.
    3. I'll check.
     
  7. Offline

    JeroenV

    kumpelblase2
    I've been working with your lib for quite a while now and I love it :)

    I've been trying to create my own desires however for some reason they are not fully working, first of all as far as targeting/movement desires for the entity goes, here's what I got:

    Code:
            Mind mind = entity.getMind();
            mind.clearBehaviours();
            mind.clearMovementDesires();
            mind.clearTargetingDesires();
     
            mind.addTargetingDesire(new DesireFindEnemyMinion(entity,LivingEntity.class, 16, false, false,0, null), 1);
            mind.addTargetingDesire(new DesireFindEnemyPlayer(entity,EntityHuman.class, 16, false, false,0,null), 1);
            mind.addMovementDesire(new DesireMoveToTarget(entity,16),1);
       
              entity.move(e_loc);
    Now DesireFindEnemyMinion and DesireFindEnemyPlayer are the custom desires I created. However, there are a few things I'm having problems with:

    1. when using the MoveToTarget desire nothing happens, they simply stand still. I don't know if this is because they don't have a target from the Minion/Player desires or because of something else.
    2. The entity.move(e_loc) doesn't work at distances further than about 15 blocks, I have a scheduler that loops through the remote entities I created and keep repeating the entity.move(e_loc).
    3. I want the Skeleton entity to simply go attack the target with his bow from a distance rather than walk towards it but I can't find a desire that does this.


    Here are my custom desires, I'm uncertain if I messed something up somewhere:
    DesireFindEnemyMinion: http://pastebin.com/5MCk9J65
    DesireFindEnemyPlayer: http://pastebin.com/GB7ejWVC


    Thanks in advance :D
     
  8. Offline

    Ultimate_n00b

    Code:
    12:07:04 AM [SEVERE] Could not load 'plugins\Quests.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: de/kumpelblase2/remoteentities/api/thinking/Desire
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:184)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:305)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:230)
    at org.bukkit.craftbukkit.v1_5_R3.CraftServer.loadPlugins(CraftServer.java:239)
    at org.bukkit.craftbukkit.v1_5_R3.CraftServer.<init>(CraftServer.java:217)
    at net.minecraft.server.v1_5_R3.PlayerList.<init>(PlayerList.java:55)
    at net.minecraft.server.v1_5_R3.DedicatedPlayerList.<init>(SourceFile:11)
    at net.minecraft.server.v1_5_R3.DedicatedServer.init(DedicatedServer.java:106)
    at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:382)
    at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)
    Caused by: java.lang.NoClassDefFoundError: de/kumpelblase2/remoteentities/api/thinking/Desire
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:173)
    ... 9 more
    Caused by: java.lang.ClassNotFoundException: de.kumpelblase2.remoteentities.api.thinking.Desire
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader.java:80)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:53)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 12 more
    ?
     
  9. Offline

    Regenwurm97

    Allright, will try to do so...hope I can get it ;)

    Another 2 questions:

    ... how do you add a new inventory to the npcs (like zombies). There is a class called RemoteEntityFeature but how do I set up such a feature and how do I add entrys to it?

    ... What is the main difference between the "Movement" and the "Target" Desire? I mean does Target always refer to "Attacking" an enemy? The problem is I wanted to make zombs able to shoot with bows and for that, wanted to implement the DesireRangedAttack but the zomb doesnt shoot at all...
     
  10. Offline

    confuserr

    You sure you have the RemoteEntities plugin installed on your server? If you are, did you make sure to depend on it within your plugin.yml so it loads after RemoteEntities?
     
  11. Offline

    Ultimate_n00b

    Yeah, I probably should depend on it..
     
  12. Offline

    soulofw0lf

    EDIT: sorry stupid mistake.. i was creating two managers and saving the wrong one...
     
  13. Offline

    kumpelblase2

    Sorry for the lack of help and updates, but I had to do a lot private stuff especially before I go on holidays tomorrow for two weeks. This means that I won't reply to questions for this time but I will hopefully be able to answer them after I get back home. The same goes for any craftbukkit/minecraft changes.

    I hope you have a great time!
     
    Rprrr likes this.
  14. Offline

    Ultimate_n00b

    Urgh. I am currently using citizens for NPCs, but I would like a option to use a built in library... is there anyway I can package this with my plugin?
     
  15. Offline

    Dread9Nought

    Awesomeness.

    Good work. :D
     
  16. Offline

    BRampersad

    Same here. I am currently deciding between this and Citizens and i would rather have an api rather than a full fledged bukkit plugin that responds to commands and has permissions etc. Citizens tries to do too much.
     
  17. Offline

    Ultimate_n00b

    Erm.. no, I like citizens. I just want a option for those who do not want to use citizens, and looking at Remote Entities features, it looks like a good choice. But again, people have to download it.
     
  18. Offline

    Regenwurm97

    How does the "DesireRangedAttack" work? I gave a bow to a zombie and added the ranged attack desire to his "head" but he doesn't want to fight :l​
     
  19. Offline

    BRampersad

    Take a look at the ShouldExecute method for that goal. It will only work if the goalTarget is not null. You will need to add another goal to the entity that looks for target or write a custom desire that sets the goalTarget to the entity you want to shoot. Only then will the DesireRangedAttack execute. The two goals that come with the library that sets the goal target are DesireFindAttackingTarget and DesireFindNearestTarget.
     
  20. Offline

    TomShar

    When I spawn a Human entity no one can see it unless then re-log

    code:
    Code:
    EntityManager manager = RemoteEntities.createManager(plugin);
                RemoteEntity entity = manager.createNamedEntity(RemoteEntityType.Human, loc, p.getName());
                entity.setStationary(true);
                entity.getMind().addMovementDesire(new DesireLookAtNearest(entity, Player.class, 8F), 1);
     
  21. Offline

    Ultimate_n00b

    So, am I allowed to package this with my plugin?
    I just don't want to make players download something else..
     
  22. Offline

    1SmallVille1

    kumpelblase2
    Hey I was just wondering why when I spawn a human entity it appears to spawn about 20 blocks away but after about 30 seconds in appears where it should. Also, I can't interact with the entity until after it has moved to where it should be. Oh and how would I go about setting the NPC's armor?
     
  23. Offline

    kumpelblase2

    Ultimate_n00b well, you are allowed yes, but it won't work.

    1SmallVille1 & TomShar I'll see if I can find a workaround since I can't seem to find a proper fix.

    1SmallVille1 You set the equipment like you'd do normally with bukkit. Just get the bukkit entity and there you have the needed methods.
     
  24. Offline

    Aqua

    I am having a problem with this. Whenever I try to spawn a monster it tells me it cannot spawn a named NPC without name.
    When I run a check with isNamed() it returns true
    Code:
    Bukkit.broadcastMessage(RemoteEntityType.Human.isNamed() + " - is named"); // Returns true
    entity = manager.createEntity(RemoteEntityType.Human, player.getLocation(), false);// Line of error. See below for stacktrace
    How I define all variables:
    Code:
    RemoteEntity entity;
    //Inside onEnable():
    manager = RemoteEntities.createManager(this);
    

    Stacktrace:
    Show Spoiler

    Code:
    2013-06-09 13:45:32 [INFO] true - is named
    2013-06-09 13:45:32 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'monster' in plugin Monsters v0.0.1 - Alpha
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:189)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchCommand(CraftServer.java:523)
        at net.minecraft.server.v1_5_R3.PlayerConnection.handleCommand(PlayerConnection.java:965)
        at net.minecraft.server.v1_5_R3.PlayerConnection.chat(PlayerConnection.java:883)
        at net.minecraft.server.v1_5_R3.PlayerConnection.a(PlayerConnection.java:840)
        at net.minecraft.server.v1_5_R3.Packet3Chat.handle(Packet3Chat.java:44)
        at net.minecraft.server.v1_5_R3.NetworkManager.b(NetworkManager.java:292)
        at net.minecraft.server.v1_5_R3.PlayerConnection.d(PlayerConnection.java:109)
        at net.minecraft.server.v1_5_R3.ServerConnection.b(SourceFile:35)
        at net.minecraft.server.v1_5_R3.DedicatedServerConnection.b(SourceFile:30)
        at net.minecraft.server.v1_5_R3.MinecraftServer.r(MinecraftServer.java:581)
        at net.minecraft.server.v1_5_R3.DedicatedServer.r(DedicatedServer.java:226)
        at net.minecraft.server.v1_5_R3.MinecraftServer.q(MinecraftServer.java:477)
        at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:410)
        at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)
    Caused by: de.kumpelblase2.remoteentities.exceptions.NoNameException: Tried to spawn a named entity without name
        at de.kumpelblase2.remoteentities.EntityManager.createEntity(EntityManager.java:127)
        at com.minecraftserver.monsters.Main.setUpMonster(Main.java:89)
        at com.minecraftserver.monsters.Main.onCommand(Main.java:45)
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
        ... 15 more
     
  25. Offline

    kumpelblase2

    Aqua There's a separate method for spawning entities with a name.
     
  26. Offline

    Aqua

    kumpelblase2 I define the name via BukkitEntity after I spawn them.
    Code:
    entity.getBukkitEntity().setCustomName("Monster");
    entity.getBukkitEntity().setCustomNameVisible(true);
    EDIT: Found it, createNamedEntity

    kumpelblase2 I think I found a bug, when I spawn an named Human, it spawns the human somewhere around the location and later on teleports it to the correct location.

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

    Draesia

    kumpelblase2 When I have around 50 Entities it really starts to lag (Server Sided), is there any ways of making the entities cause less lag? (eg, How would I remove the Entity from Remote Entities once it has finished it's onetimedesires)

    Also, I am trying to make Zombies move to a location using a custom desire similar to DesireMoveToLocation (Instead it moves along a list of positions)

    This works fine, although I am trying to make it attack anything along the way,

    Code:
                OneTimeDesire d = new DesireMoveToLocations(rz, position);
                rz.getMind().addMovementDesire((Desire) d, 1);
                rz.getMind().addTargetingDesire(new DesireAttackOnCollide(rz, null, false), 5);
                rz.attack(Bukkit.getServer().getOnlinePlayers()[0]);
    It moves to the locations but it does not attack, even though the priority is higher!

    Please can you make some examples on how to use this API! (I love it just I can't use it!)

    Regards, Draesia.
     
  28. Offline

    kumpelblase2

    Aqua This has been reported by some people, though I couldn't seems to reproduce it myself.

    Draesia Just make your own behavior and listen on the DesireEndEvent and check if the entity has still onetimedesires on it (you can register it as a listener in it's onAdd method).

    The reason it doesn't get overridden is that you register them as two separate types. You declare one as a movement desire and one as a target desire, thus they can get executed along another. A target desire should ONLY be a desire to select a target, nothing else (that's why they should be able to get executed along the others). DesireAttackOnCollide however, doesn't do targeting and thus shouldn't belong there but instead should be registered as a movement desire as well. By doing so, it will work like you expect it to work.
     
  29. Offline

    Aqua

    kumpelblase2 I have been testing some more, it seems in a large "populated area" (lot of structures, signs/chests and that kind of stuff) the delay will be bigger, when I moved to a "clean" piece of world the entity spawned almost instantly (still 1-3 seconds delay)
     
  30. Offline

    Jatoc

    kumpelblase2

    Is it possible to change the behavior of an entity so that it will act normally (e.g. attack nearest/walk around randomly), but only within a certain region? (perhaps defined by worldguard) So the entities never leave the region they were spawned in?
     
Thread Status:
Not open for further replies.

Share This Page