Bᴜsʜɪᴅᴏ Posted October 31, 2024 Posted October 31, 2024 Does anyone know how to make an anti-KS system, or does it have any example code? I searched everywhere, but I didn't find anything useful. Quote
0 Bᴜsʜɪᴅᴏ Posted October 31, 2024 Author Posted October 31, 2024 2 hours ago, ratchet said: anti-ks you mean anti-killsteal? Yes Anti-Kill steal. This prevent the other players to steal your monster. For example you have 1 lvl items and you start killing a medium hard mob, a player with 2 lvl items comes and start hitting the mob he will get the drop because he dealt more damage. I want to prevent that. Quote
0 Salty Mike Posted October 31, 2024 Posted October 31, 2024 (edited) 4 hours ago, Bᴜsʜɪᴅᴏ said: Yes Anti-Kill steal. This prevent the other players to steal your monster. For example you have 1 lvl items and you start killing a medium hard mob, a player with 2 lvl items comes and start hitting the mob he will get the drop because he dealt more damage. I want to prevent that. There are as many approaches as stars in the sky, for all I know. You could create a class variable in MonsterInstance.java, which will hold the Object_ID of its first aggressor/dmg_dealer. From there, you will have to add a check in the RequestAttack and RequestMagicSkillUse packets and/or in some doDamage()/reduceHp() method, which will check if the damage dealer is the first aggressor, and if not - reduce the damage to 0. But you also have to be mindful about special cases, such as: - what happens when a Warlord runs around an area, provoking everything just to trigger the aggression and then just goes to town waiting for someone else to kill the said mobs so that the WL can collect free rewards? You might have to play with the DefaulAI, or the AI of monsters and hook a function that would reset the aggressor_id value under certain conditions, such as - the aggressor is not in X range or the aggressor is dead, or the aggressor is not online, or the NPC/Monster's AI is in INACTIVE state, which would indicate they are not in combat. - what happens when the aggressor is in party? should the said aggressor/dmg_dealer variable be a List/Set of players which are all eligible to deal dmg or receive rewards? Edited October 31, 2024 by Salty Mike Quote
0 Bᴜsʜɪᴅᴏ Posted October 31, 2024 Author Posted October 31, 2024 1 hour ago, Salty Mike said: There are as many approaches as stars in the sky, for all I know. You could create a class variable in MonsterInstance.java, which will hold the Object_ID of its first aggressor/dmg_dealer. From there, you will have to add a check in the RequestAttack and RequestMagicSkillUse packets and/or in some doDamage()/reduceHp() method, which will check if the damage dealer is the first aggressor, and if not - reduce the damage to 0. But you also have to be mindful about special cases, such as: - what happens when a Warlord runs around an area, provoking everything just to trigger the aggression and then just goes to town waiting for someone else to kill the said mobs so that the WL can collect free rewards? You might have to play with the DefaulAI, or the AI of monsters and hook a function that would reset the aggressor_id value under certain conditions, such as - the aggressor is not in X range or the aggressor is dead, or the aggressor is not online, or the NPC/Monster's AI is in INACTIVE state, which would indicate they are not in combat. - what happens when the aggressor is in party? should the said aggressor/dmg_dealer variable be a List/Set of players which are all eligible to deal dmg or receive rewards? Thanks for the detailed info. I also have some ideas in mind but the execution may be hard. Thanks again! Quote
0 ratchet Posted October 31, 2024 Posted October 31, 2024 I also think this feature would bring more harm than good... another example is a dwarf rushing against your mobs so he takes priority, then he plays fake death and proceeds to grief the shit out of you. A minimum damage threshold is necessary, which would basically converge to what is the default feature (i.e. biggest damage dealer) Quote
Question
Bᴜsʜɪᴅᴏ
Does anyone know how to make an anti-KS system, or does it have any example code? I searched everywhere, but I didn't find anything useful.
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.