Load item inventory icons from sprites!
DO NOT release modified versions of my work without my permission! This includes converting it to "non-renamed"
Once again im releasing this because it has 100% no use to me what-so-ever.
This is something i always wanted to do when i first started clientside but never achieved it :sneaky:
was only yesterday i rememered about it and decided to do it since ive learned a LOT more since then :)
How it works with the other items
This will in no way effect your current items or items you add in the future, you will be able to load a sprite simply from a variable in your item ints. If you dont add this with the item ints the client will use the drop model as the inventory icon instead. So this is 100% optional.
[Only registered and activated users can see links. Click Here To Register...]
Firstly open up ItemDef
Declare:
Code:
public String customSpriteLocation;
next search for...
Code:
private void setDefaults()
under that add:
Code:
customSpriteLocation = null;
You can now save+close etc, now open up client.java and search for.....
Code:
Sprite class30_sub2_sub1_sub1_2 = ItemDef.getSprite(j9, rsInterface.invStackSizes[i3], l9);
this line basicly gets the sprite from the items drop model. Now if we add an if statement to tell the client that if you have set a sprite location in the item ints then to use that sprite instead of the drop model.
So under that line add:
Code:
ItemDef itemDef = ItemDef.forID(j9);
if (itemDef.customSpriteLocation != null)
{
class30_sub2_sub1_sub1_2 = new Sprite(itemDef.customSpriteLocation);
}
Save and compile
How to use!
Ok you know you have your item ints and shiz like this
Code:
if(i == 8004)//item id
{
itemDef.actions = new String[5];
itemDef.actions[1] = "Wield";
itemDef.modelID = 6109;//drop model & invent model
itemDef.modelZoom = 2000;
itemDef.modelRotation1 = 572;
itemDef.modelRotation2 = 0;
itemDef.anInt204 = 0;
itemDef.modelOffset1 = 0;
itemDef.modelOffset2 = 1;
itemDef.anInt165 = 6100;//male model id
itemDef.anInt200 = 6100;//female model id
itemDef.name = "Shitty custom";
itemDef.description = "its a shitty custom hardcoded item".getBytes();
}
To make it use a custom sprite instead simply add with your item ints:
Code:
itemDef.customSpriteLocation = SPRITE DIRECTORY;
so the final thing will look something like this:
Code:
if(i == 8004)//item id
{
itemDef.actions = new String[5];
itemDef.actions[1] = "Wield";
itemDef.modelID = 6109;//drop model & invent model
itemDef.modelZoom = 2000;
itemDef.modelRotation1 = 572;
itemDef.modelRotation2 = 0;
itemDef.anInt204 = 0;
itemDef.modelOffset1 = 0;
itemDef.modelOffset2 = 1;
itemDef.anInt165 = 6100;//male model id
itemDef.anInt200 = 6100;//female model id
itemDef.name = "Shitty custom";
itemDef.description = "its a shitty custom hardcoded item".getBytes();
itemDef.customSpriteLocation = "./sprites/customIcon.png";
}
now the client will see that you have added a custom sprite location so for that item it will use a custom sprite instead of the drop model.
Non-renamed version omfg?
Quote:
Originally Posted by Jdog
Step 1:
Open up client.java and search for class9_1.anIntArray252[i3], l9, 9);
Step 2:
Directly Under class9_1.anIntArray252[i3], l9, 9); add this,
Code:
Class8 class8 = Class8.method198(j9);
if (class8.customSpriteLocation != null)
{
class30_sub2_sub1_sub1_2 = new Class30_Sub2_Sub1_Sub1(class8.customSpriteLocation);
}
Step 3:
Close client.java and open class8.java. Then add public String customSpriteLocation; under the first bracket you see.
It should look like this:
Code:
final class Class8
{
public String customSpriteLocation;
Step 4:
Now search for public final void method197()
Under the first bracket in public final void method197() add
customSpriteLocation = null;.
Should look like this:
Code:
public final void method197()
{
customSpriteLocation = null;
Your done!
Example code:
Code:
if(i == 881)
{
class8.aStringArray189 = new String[5];
class8.aStringArray189[1] = "Load";
class8.anInt181 = 720;
class8.anInt190 = 477;
class8.anInt198 = 117;
class8.anInt204 = 1860;
class8.anInt169 = 3;
class8.anInt194 = 5;
class8.anInt165 = 548;
class8.anInt200 = 548;
class8.anInt188 = -1;
class8.anInt164 = -1;
class8.anInt175 = -1;
class8.anInt197 = -1;
class8.aString170 = "Ammo";
class8.aByteArray178 = "Ammo used to fill-up guns.".getBytes();
class8.customSpriteLocation = "./sprites/customIcon.png";
class8.anIntArray156 = new int[1];
class8.anIntArray156[0] = 5656;
class8.anIntArray160 = new int[1];
class8.anIntArray160[0] = 36133;
}
Credits: jdog for unrenaming it