Jump to content
Existing user? Sign In

Sign In



Sign Up

PI - How to give items a category/type attack bonus such as Dragon/Demonbane


Tutus Frutus

Recommended Posts

Mornin fella's, this snippet is nothing special but a lot of people are not aware of how simple this could be done and therefor I release this snippet to show you/them.
Received several requests to add this for 20-30$ whilst it's not even worth a dime...

Example from OSRS Wiki I am talking about: https://oldschool.runescape.wiki/w/Dragonbane_weapons

The base I use as example will be Ascend or SpecialPKz, a PI based 317...


First, you want to declare a list of NPC's... you can do this anywhere you want but I personally prefer NPC.java as it's the most logic place to declare it (in my opinion)..

public boolean isDemon() {

	        switch (npcType) {

	        case 1531:

	        case 3134:

	        case 2006:

	        case 2026:

	        case 7244:

	        case 1432:

	        case 415:

	        case 7410:

	        case 135:

	        case 3133:

	        case 484:

	        case 1619:

	        case 7276:

	        case 3138:

	        case 7397:

	        case 7398:

	        case 11:

	            return true;

	        }

	        return false;

	    }


 

   public boolean isDragon() {
        switch (npcType) {
        case 137:
        case 139:
        case 239:
        case 241:
        case 242:
        case 243:
        case 244:
        case 245:
        case 246:
        case 247:
        case 248:
        case 249:
        case 250:
        case 251:
        case 252:
        case 253:
        case 254:
        case 255:
        case 256:
        case 257:
        case 258:
        case 259:
        case 260:
        case 261:
        case 262:
        case 263:
        case 264:
        case 265:
        case 266:
        case 267:
        case 268:
        case 269:
        case 270:
        case 271:
        case 272:
        case 273:
        case 274:
        case 275:
        case 465:
        case 1871:
        case 1872:
        case 2642:
        case 2918:
        case 2919:
        case 4385:
        case 5194:
        case 5872:
        case 5873:
        case 5878:
        case 5879:
        case 5880:
        case 5881:
        case 5882:
        case 6502:
        case 6593:
        case 6636:
        case 6652:
        case 7039:
        case 7253:
        case 7254:
        case 7255:
        case 7273:
        case 7274:
        case 7275:
        case 8027:
        case 7553:
        case 7554:
        case 7555:
            return true;
        }
        return false;
    }

Add it anywhere in the code... I removed a part of the list for 181, adapt it to your own ID's and add accordingly.

Now, how does one apply this to an item?
As simple as the Ctrl C + Ctrl V you did before...

Go into AttackNPC.java

Find

switch (defender.npcType) {

Underneath you see a bunch of cases..

Add a new case and declare the damage including the check for wether the NPC isDemon or isDragon...
In my case I show you the preview of my Dragon Hunter Lance:

case 22978: //Dragon Hunter Lance
                        if (attacker.lastWeaponUsed == 22978 && defender.isDragon()) {
                            damage *= 1.2;
                            accuracy *= 1.2;
                        }
                        break;

(can copy/paste it in)

As you can see, the case & lastWeaponUsed correspond to the Item you're using to fight the NPC, the && defender.isDragon() check simply looks through all those cases... if the NPC you are fighting is any of these ID's then it amplifies the Damage & Accuracy..
This can be done for anything... just make one of those lists, name it accordingly and apply it this way.

Enjoy.

Edited by Tutus Frutus
Link to comment
Share on other sites

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

  • 7 months later...
  • 3 weeks later...
  • 2 weeks later...

Good stuff. A long switch statement of IDs is quite difficult to maintain so it might be worth using the NPC cache definitions to use names of NPCs instead. I.e if the NPC name contains "wyrm" or "dragon" but it really isn't a super huge deal at this level. Well done :)  

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



Contact

[email protected]

astra.security

What is a RSPS?

A RSPS, also known as RuneScape private server, is an online game based on RuneScape, and controlled by independent individuals.

Popular RSPS Servers

Runewild Ikov RedemptionRSPS

Disclaimer

Runesuite is not affiliated with runescape, jagex in any way & exists solely for educational purposes.

×
×
  • Create New...