[Only registered and activated users can see links. ]
I think people might know how to add npc drops by now?
BEFORE PEOPLE SAY "OMG LEECHED," I MADE THIS TUTORIAL BASED ON ANOTHER TUTORIAL WHICH TAUGHT WORKING DEFENCE BONUSES. I SIMPLY EDITED IT TO MAGIC BONUSES TO HELP OTHERS, THEREFORE 80% CREDIT TO WHOEVER WROTE THAT FOR THE IDEA
Purpose: To add working magic attack and defence bonuses to your server, as well as splashing.
Difficulty: However hard you make it... 3/10?
Assumed Knowledge: Understanding of booleans and what they do and how to edit them. How to declare a boolean to return a true or false statement.
Server Base: Jukks Cleaned V3
Classes Modified: client.java
Procedure
Step One:
So first things first, make the boolean.
Basically that boolean works out whether or not you hit, judging by your magic attack bonus and your opponents magic defence bonus. "magzDef," excusing my silly variable names, is your opponents magic defence bonuses, which can be edited in order to make splashing more or less likely. At the moment the defence is determined by half of your opponents defence bonus plus one quarter of their defence level if their bonus is greater than 0, and simply their defence bonus plus one quarter of their defence level is their bonus is less than 0.
But I suppose most of you will understand that by the code.
The boolean then determines your magic attack bonus, and if a random number between 0 and your max bonus, is greater than a random number between 0 and their max bonus, then the boolean returns true, and you therefore hit. On the other hand if it less than your opponents bonus, the boolean returns false, which is when splashing occurs.
Okay, thats pretty much just explaining for the sake of not being a "C&P" tutorial and an attempt to prove I do actually understand the code :woot:.
Step Two: (OPTIONAL)
Now, if your server is advanced enough to have working prayers (despite that xx nub xx has just released them...) then you can also add this:
Somewhere in the boolean. Which basically adds to your opponents defence is they are using a defence prayer.
Step Three:
Now all you have to do, is call this boolean in order to check whether you splash when attacking your opponent. To save time adding it to every spell, declare this boolean:
Code:
public boolean splash = false;
Step Four:
Now somewhere within your magic attack void... usually:
I have something like this.. only my splashes if ur mage bonus fals under 5+ and if u fail hitting
Thats a cool idea, but mine is more similar to RS as you still have a chance, even if only slight of hitting with a very low magic bonus, and even a chance to splash with a high magic bonus... And my code also involves the other players defence & bonuses.