Maybe it exists? Need a plugin to give mobs a lifespan...

Discussion in 'Archived: Plugin Requests' started by craftopia.net, Dec 7, 2011.

  1. Offline

    craftopia.net

    I am using a plugin to regulate my server to only 128 total mobs (animals & monsters). It seems as though, as soon as all 128 have spawned, they never de-spawn making it hard for newly logged in players to locate and kill them.

    I am in search of a plugin that will give mobs a lifespan, and kill them if they are not interacted with in a specific length of time. This way it gives a chance for new mobs to spawn in populated chunks, rather than just wandering around aimlessly.

    Another bonus would be if the plugin could limit mob count, so only a specific # of mobs can exist on any world, and also if there was an ability to control which mobs you want to spawn and which mobs you don't... this would eliminate a couple other plugins I am running.

    If anyone knows of a plugin that would help me with at least killing off mobs so new ones are able to respawn, please let me know. Thanks :)
     
  2. Offline

    acuddlyheadcrab

    Hrm i might actually take this up (soon), since it sounds do-able

    EDIT: It would include this:
    - mobs have a "limited" time to live (age)
    - mobs that interact with something get more time to live (morbid, i know)
    - ^ mobs that are in a chunk that has a player in it, will let them live longer (i think i can do this... not sure though)
    - I could do the mob count
    - and the custom mob types (hopefully)
     
  3. Offline

    craftopia.net

    Awesome dude, I appreciate it :)

    Oh, another bonus would be if the plugin would be able to set the # of each type of mob?? Would be cool to have 1 or 2 Giants spawn at some random unocupied chunk ;)

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

    acuddlyheadcrab

    um... not sure yet! Right now i'm working on the age feature, cause the other parts should be kinda easy after this.
     
  5. Offline

    thepig

    There is a plugin I know that let's you check how many mobs are alive and be able to kill them. It's called Entity Suppressor. Here's the link to the thread: http://dev.bukkit.org/server-mods/entitysuppressor/
     
  6. Offline

    acuddlyheadcrab

    @craftopia.net
    It just occured to me: Why don't I just check if a mob is outside a certain range of any player and if so, teleport them back to near a player? Would that solve the problem as well?

    @craftopia.net
    Almost done! :D

    I can release a "custom-tailored" version right now, if you want. I'm still learning the new(ish) config methods for bukkit, so there's no config, thus the "custom-tailored".

    Right now it:
    - Checks for old (non-player, and living) entities every 10 ticks (.5 seconds)
    - "Old" right now means the entity has lived for >=600 ticks (30 seconds)
    - ^that seems a little young, but entities can get around this, and have their age reset if:
    • a player makes any movement within their chunk
    • they take damage
    • they are targeted, or target something (in that case two entities' age would be reset)
    • they become tamed
    • they interact with something

    As soon as their age is reset though, it starts adding up again.
    And more:
    - Entities spawn only within a nearby chunk of a player online ("nearby" meaning 1 chunk away)
    - Entities don't spawn when 128 or more entities are already in a world
    - The plugin should not despawn tamed entities.

    EDIT: No custom mobs types yet though :(

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

    craftopia.net

    Yeah I use that plugin right now to limit my map to 128 mobs.

    This would make it pointless to "hunt" wouldnt it?? If mobs just appeared at people there really would be no need to go out and look for them.

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

    acuddlyheadcrab

    Yeah that's true. Right now the spawning works well and spawns creatures in the surrounding chunks of each online player. And when the player moves away, the mob will have a certain amount of time to live

    I may change the whole "surrounding chunks" thing to a simpler way of checking distance from a player. And i need to get the config methods working, still, and then it'll be done :)
     
  9. Offline

    craftopia.net

    awesome.... mind if i get a copy to run on my server?? I am getting complaints from my users they cannot find mobs to kill.
     
  10. Offline

    acuddlyheadcrab

    Sure I can give an early-release copy :)

    Actually I'll just start a bukkitdev project and open a pre-release version. Hold on... :D

    Okay I'm done :) http://dev.bukkit.org/server-mods/mobage/

    The source is in the jar, if you want to modify it for yourself btw
     
  11. Offline

    craftopia.net

    Thanks! I will check it out.

    Okay i get this after the server has loaded... the log shows MobAge loads fine, however at the last second I get this in my console:

    Code:
    22:08:26 [WARNING] Task of 'MobAge' generated an exception
    java.lang.ClassCastException: org.bukkit.craftbukkit.entity.CraftItem cannot be cast to org.bukkit.entity.Tameabl
    e
            at me.acuddlyheadcrab.MobAge.MobAge.killOldMobs(MobAge.java:128)
            at me.acuddlyheadcrab.MobAge.MobAge$1.run(MobAge.java:75)
            at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:137)
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:482)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
    I am also running Entity Suppressor, and when I use it to count mobs, it shows 0 Monsters & 21 Animals... and that never changes. I assume the 21 Animals are various tamed animals. I ran the MobAge without EntitySuppressor and it still did no good, so I have it disabled for now.

    This is on CB1562, i could try with a seperate build if you have a preffered CB

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

    acuddlyheadcrab


    Yeah i caught that error too, and i'm fixing it now. I'll edit this when it's fixed and the link is updated
    edit: ^Oh wait i didnt make a direct link to the download on this thread, lol.

    I'll post a current build download link on the bukkitdev page and tell you when it's fixed

    I fixed the casting error. The limiting should work, but it's set to 128 mobs right now, until i have the config working.

    Ah! Ran out of time tonight. I'll be finishing this tomorrow however
     
  13. Offline

    kudy

    This looks awesome! Would love the option to de-spawn monsters and squid only so that my farms are not effected - any timeline on when you might have a config file working?
     
  14. Offline

    acuddlyheadcrab

    Umm... well I've been really busy with school and other things this past week so I feel like I have barely touched the project :|...

    I think it might be done within a week
     
  15. Offline

    kudy

    Thanks for all of the work, its much appreciated.
     
  16. Offline

    craftopia.net

    Yeah thanks for all your work. I am still having issues with mobs spawning. Sometimes they do, but most the times they dont. Spawners aren't spawning properly either.
     

Share This Page