Monsters and Bandits

A new status update as well as a first preview video of the new version are now available!
  • Hi Red,


    Clearly you are busy (in fact I am too) - so very much a back burner request!


    In the future can we have some sort of API calls to find out what kind of NPC was killed by a player?


    Rather than just knowing if it was a bandit or skeleton it would be super useful to know what kind of bandit or skeleton was killed.


    Such as skeleton no w/ no armour, skeleton with armour, bandit w/ crossbow etc.


    I'm thinking on the lines of abilities to build more advanced XP systems. As killing a fully armoured skeleton is worth more XP than an unarmoured one!


    CHEERS!


    Yahwho

  • Well, basically this is kinda possible, more or less ^^ You can get the variation of an NPC by calling npc.getVariation(), but this is just the variation id. You could check out the game definition file (extract the definitions.db file from the commons.jar [commons/definitions], which can be found in the data folder of the game directory, then open this file with an SQL editor). There is a table called "NpcVariations" which contains all existing NPC variations.


    For example, the samurai skeleton has variation id 5, the semi-armored skeleton has id 2, the archer has id 3 etc.


    Basically variation ids won't change in future updates (although it's possible that they will be different in the new version). Unfortunately you can't find out which item an NPC is actually carrying - there is some randomness in the variation table, so some skeletons either spawn with a mace or a sword, for example.


    You can also get the clothes of an NPC by calling npc.getClothes(), but usually it's sufficient to stick to the variation id ;)


    We will add more functions in the future to get the current item of an NPC, for example.

Participate now!

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