abhi2011 Posted October 18, 2014 Author Share Posted October 18, 2014 FireBlade97 requested this via PM and since it's been a long time since I wrote a tutorial, I thought why not? After you add this you'll have control over how items in game look by tweaking the colour of the texture. So let's get started. **Note**: I've used Eclipse Worlds for writing this source but this should work on any DX8 engine. **Note2**: This tutorial is not noob friendly at the end. I suggest you have basic understanding of VB6 and certain terminologies like what methods are. **EDITORS** Open up the **item editor** form a make something like this: ![](http://i.imgur.com/AdfQ3sW.png)Properties: Leave the Frame properties as it is. Change the frame caption to Colour if you want. **Label 1**Name: **lblRed**Caption: **Red: 255****Label 2**Name: **lblBlue**Caption: **Blue: 255****Label 3**Name: **lblGreen**Caption: **Green: 255****Label 4**Name: **lblAlpha**Caption: **Alpha: 255****HScroll 1**Name: scrlRed**HScroll 2**Name: scrlBlue**HScroll 3**Name: scrlGreen**HScroll 4**Name: scrlAlphaNow open up the source code of the Editors and paste the following at the end ```Private Sub scrlRed_Change() If EditorIndex < 1 Or EditorIndex > MAX_ITEMS Then Exit Sub Item(EditorIndex).Red = scrlRed.Value lblRed.Caption = "Red: " & scrlRed.ValueEnd SubPrivate Sub scrlBlue_Change() If EditorIndex < 1 Or EditorIndex > MAX_ITEMS Then Exit Sub Item(EditorIndex).Blue = scrlBlue.Value lblBlue.Caption = "Blue: " & scrlBlue.ValueEnd SubPrivate Sub scrlGreen_Change() If EditorIndex < 1 Or EditorIndex > MAX_ITEMS Then Exit Sub Item(EditorIndex).Green = scrlGreen.Value lblGreen.Caption = "Green: " & scrlGreen.ValueEnd SubPrivate Sub scrlAlpha_Change() If EditorIndex < 1 Or EditorIndex > MAX_ITEMS Then Exit Sub Item(EditorIndex).Alpha = scrlAlpha.Value lblAlpha.Caption = "Alpha: " & scrlAlpha.ValueEnd Sub```**modGameEditor:**Find **ItemEditorInit **and before the end with add in this:``` frmEditor_Item.scrlRed = .Red frmEditor_Item.scrlBlue = .Blue frmEditor_Item.scrlGreen = .Green frmEditor_Item.scrlAlpha = .Alpha```**modTypes:** This part is common for both client and server. Open up **modTypes** and find **ItemRec**. Before End Type add the following: ``` Red As Byte Blue As Byte Green As Byte Alpha As Byte```**modRendering:** Find **RenderTextureByRects** method in **modRendering**Add this to the end of the method declaration ```Optional ByVal Red As Long = 255, Optional ByVal Green As Long = 255, Optional ByVal Blue = 255, Optional ByVal Alpha As Long = 255```Add this to the end of the **RenderTexture** call ```D3DColorRGBA(Red, Green, Blue, Alpha) ```Find the **EditorItem_DrawItem **method in **modRendering**Find the **RenderTextureByRects** call in this methodAdd this to the end: ```frmEditor_Item.scrlRed.Value, frmEditor_Item.scrlBlue.Value, frmEditor_Item.scrlGreen.Value, frmEditor_Item.scrlAlpha.Value```**Now this part changes per change so I'll provide you with the code and help you figure out. You'll have to add in the code yourself.**Wherever there items are being drawn in game, declare the following variables. ```Dim R As Long, G As Long, B As Long, A As Long```After this check ```ItemNum = GetPlayerInvItemNum(MyIndex, i)If ItemNum > 0 And ItemNum <= MAX_ITEMS Then```Add the following```R = Item(ItemNum).RedG = Item(ItemNum).GreenB = Item(ItemNum).BlueA = Item(ItemNum).Alpha```Now find the call to the RenderTexture method (It can be just RenderTexture for rendering dropped items or RenderTextureByRects for inventory or it may all just be RenderTexture) Add this to the end of the call: ```R, G, B, A```And it should work. Depending upon how stupid your request of help is I'll help you. If it's very stupid then I won't. Ask someone else. Here are a few methods that render items. I'm not sure if there are more but search for them. (Search for **Tex_Item** and in **modRendering** and you'll find the methods)> DrawMapItem> > DrawHotbar> > DrawInventory> > DrawAnimatedItem> > DrawDraggedItem> > DrawBank> > DrawBankItem**NOTE**: For **DrawMapItem** use this code to set the r,g,b,a rather than using the above mentioned code: ```R = Item(MapItem(ItemNum).num).RedG = Item(MapItem(ItemNum).num).GreenB = Item(MapItem(ItemNum).num).BlueA = Item(MapItem(ItemNum).num).Alpha``` Link to comment Share on other sites More sharing options...
Slasheree Posted October 18, 2014 Share Posted October 18, 2014 if the color and alpha are only 0 to 255 why don't you use a byte for that ? Link to comment Share on other sites More sharing options...
deathtaker26 Posted October 18, 2014 Share Posted October 18, 2014 > ,…,<>" data-cid="929736" data-time="1413631600">> > if the color and alpha are only 0 to 255 why don't you use a byte for that ?Because that makes too much sense, and sense in eclipse is something we don't do. Link to comment Share on other sites More sharing options...
abhi2011 Posted October 18, 2014 Author Share Posted October 18, 2014 > ,…,<>" data-cid="929736" data-time="1413631600">> > if the color and alpha are only 0 to 255 why don't you use a byte for that ?Nice observation. I normally use a long without much thinking so yea.. Editing the OP Link to comment Share on other sites More sharing options...
Slasheree Posted October 18, 2014 Share Posted October 18, 2014 > Wherever there items are being drawn in game, declare the following variables. > ```> Dim R As Long, G As Long, B As Long, A As Long> > ```might want to change these to Byte too :P Link to comment Share on other sites More sharing options...
abhi2011 Posted October 19, 2014 Author Share Posted October 19, 2014 > ,…,<>" data-cid="929746" data-time="1413655184">> > might want to change these to Byte too :Pmeh. It won't cause any memory problems. They'll eventually be disposed. Link to comment Share on other sites More sharing options...
abhi2011 Posted October 20, 2014 Author Share Posted October 20, 2014 Sorry for the double post. Had to do it**Updated** the tutorial. I missed code in **ItemEditorInit** in **modGameEditors**. Scroll to the top and find the section called modGameEditors and add in that code. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now