Hello, so I was writing hunter a couple years back for my server and i've lost every piece of code that had to do with it, so I was thinking what would a proper formula be for -luring- the npc to the trap and the formula for -trapping- the npc.
There are 2 stages the trap has to go through before it can successfully trap a npc.
Stage of luring ->
Formula runs and checks if npc is within distance of trap (the closest one) -> npc walks directly to the trap -> we move on to the stage of trapping.
Stage of trapping ->
Formula runs -> on success the npc is caught, on failure the trap is set off OR on a random chance the npc just flies away.
So what we need to account with the formula for the stage of luring and trapping would probably be
- The hunter level of the player.
- The type of trap the player is using.
- If the trap has any effects (baited, smoked)
- If the player has a familiar which boosts the player's hunter level (this is invisible, as in doesn't effect the real or current level of the player)
Since i'm pretty bad with formula's, i'd suggest others to improve it and share it among everyone else who needs it.
Now i'm not sure if the 2 formulas are the same or completely different.
Formula for luring and trapping.
[SPOIL][/SPOIL]
Formula to determine the maximum amount of traps a player can lay.
[SPOIL]
Code:
/**
* Determines the maximum amount of traps a player can lay.
* @param player the player to determine this for.
* @return a numerical value which determines the amount of traps a player can lay.
*/
public final int getMaximumTraps(Player player) {
return player.getSkills()[Skills.HUNTER].getRealLevel() / 20 + 1;
}
[/SPOIL]
To be continued....