Create A Plugin To Make Animals Peaceful But Enemies Aggressive

Trello update: The last weeks we've been improving the terrain generation and we've also put some effort into making landscapes smoother in general (to avoid bumpy terrain). Apart from that, we've also been working on new building tools. You find more information on Trello, but also expect an announcement about the recent changes soon
  • Guys, I have to admit, I am ignorant when it comes to making plugins. I have done research & read things here on the forums, but I am totally lost. I was wondering if someone could make a plugin for me, if this type of plugin would even be possible. I want to be able to keep animals peaceful but bandits, skeletons, etc... aggressive. Would this be possible? Would anyone be willing to do it. I'll pay for it if I have to. Lol. Thanks in advance!

  • If I remember correctly I don't think that is currently possible via the plugin API, but you might be able to do it locally for your game by changing some entries in the game's definitions database. If you are interested in that way it is a bit more involved than simply installing a plugin but I might be able to walk you through it :)

  • should be totally possible but im busy coding PVP zones witch is working now but under testing and then ill release it

    76561198018554331.png


    :thumbsup: Rising Citys @ ip 74.118.138.151:4265 ServerName (Yahgiggles Rising Citys) :thumbsup:


    If at first your code does not work call it version 0.1 with the odd bug :S

  • If I remember correctly I don't think that is currently possible via the plugin API, but you might be able to do it locally for your game by changing some entries in the game's definitions database. If you are interested in that way it is a bit more involved than simply installing a plugin but I might be able to walk you through it :)

    getAttacker()Gets the attacking npc, i.e. the npc who hit the target npc. if attaking name = skeleton{ setCancelled(true) }

    this would be under the NpcHitNpcEvent

    76561198018554331.png


    :thumbsup: Rising Citys @ ip 74.118.138.151:4265 ServerName (Yahgiggles Rising Citys) :thumbsup:


    If at first your code does not work call it version 0.1 with the odd bug :S

  • But that is not a solution, the animal would still try to run up to the player to attack it would simply just not deal damage :/


    So if you wanted to have the hostile animals in a zoo or something they would always escape to run up to players and try to attack them but would end up not dealing damage to them.


    A real solution would be to set the hostile status of certain animals via the API which is not possible as far as I can tell.

  • If I remember correctly I don't think that is currently possible via the plugin API, but you might be able to do it locally for your game by changing some entries in the game's definitions database. If you are interested in that way it is a bit more involved than simply installing a plugin but I might be able to walk you through it :)

    Thanks so much! Actually, my hubby has volunteered, if you're willing to walk him thru it. He is getting into some programming & such that he said this would be good experience for. He was wondering what software you recommend for the editing though.

  • Sorry for the extreme delay in replying, I got caught up at work with a few important things.


    So what you will need is a database browser I recommend DB Browser for SQLite: https://sqlitebrowser.org/

    Then you need to go to the game's files and extract the definitons.db from the commons.jar archive. That is found inside the archive under commons/definitions/definitions.db

    Then you need to open the definitions.db with the DB Browser and navigate to the table named Npcs.

    There find the animals you want to change the behaviour of and set the behaviour field from AGGRESSIVE to DEFAULT.

    Then save the changes via the "Write Changes" button and repack the definitions.db to replace the other one in the commons.jar archive


    If you have any more questions feel free to let me know :)

  • Thank you! Thank you! Thank you! It worked beautifully! This is the experience my community has been asking me to provide them for over a year. They will be so thrilled. We're a bunch of animal loving builders, which is why we wanted all the animals to be peaceful, but we do enjoy a little fight from time to time, which is why we wanted the enemies to remain aggressive. Now we have the best of both worlds, & I while I was at it I gave the bandits a little added health so they will be a bit more of a challenge for us. One of our members is terrified of spiders, so I considered making the spiders huge while I was in the file, but I decided that would be mean. Lol. Okay, now to put it on our server. Again, thank you so very much!:D:)<3

  • Hi Mandy,


    Can you tell me where the file location is for the spider. It would be funny if you can make the spider Huge or information on how to do it? If possible at a later date save it as a blueprint.

    Hi! I was just about to go to bed, but later today I will retrace my steps & tell you exactly how to get to it. We also considered making the rats aggressive & huge as well. Lol. But I def get those steps to you later today or tonight. :)

  • Sorry it took me so long. The past two days have been so hectic. I haven't had a chance to walk back thru the steps yet, but if you look above at Minotorious's response to me, it pretty much tells how to get to those files. Within those files you can adjust behavior, size, etc... Hope that helps. If you need any help, just let me know. Life has to slow down within a day or so. Lol.

  • Not sure where else I could post this, so thought I would post it here for at least some folks to see it. I stumbled across a YouTube channel that is only a few months old & posting some incredible RW builds. Thought maybe some of you might find it interesting. He incorporates a little history into his builds as well. Just my opinion, he deserves more subs & views than he has. Lol.

  • As for the original purpose of this thread, everything worked wonderfully, but I may have made the bandits a little too op. Lol. Going to have to scale them back a bit. Otherwise, just in case anyone else wants to do something similar or needs to get into the same DB I did, you can refer to Minotorious solution above, & whenever I have some free time I will make a video walking thru it & post to my YouTube channel to hopefully help anyone who might be interested. Will post a link here whenever I do it. Also, does anyone on this thread know of a particularly gifted RW builder you'd like to recommend? I am trying to show off the community's work during my streams & videos. Hope you're all having a great day!

  • Minotorious, as I said, this worked perfectly on my client side, but I can't seem to get it to work on my server. Would you have any suggestions on that? Again, thanks so very much!

  • I did, but for some reason it wouldn't take. I reached out to my server provider & explained it to them. I walked them through the steps & it worked when they did it from their end. Just got off with them. Lol. The provider couldn't figure out why it didn't work when I did it either. It was very strange. It is up & running now though. Time to put the last 2 plugins on & a few more blueprints & then turn my little community loose on it. So sorry to have taken up your time, but thanks so very much!

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!